From dfa294791ceaf559bf28ff955739a48a4a89e532 Mon Sep 17 00:00:00 2001 From: Earle Nietzel Date: Fri, 22 Apr 2016 23:25:50 -0400 Subject: [PATCH] SAK-30828 switch jcl logging to slf4j --- .../access/tool/AccessServlet.java | 6 +- .../sakaiproject/access/tool/WebServlet.java | 6 +- .../alias/tool/AliasesAction.java | 6 +- .../impl/BaseAnnouncementService.java | 10 +- .../impl/DbAnnouncementService.java | 6 +- .../impl/SiteEmailNotificationAnnc.java | 6 +- .../AnnouncementEntityProviderImpl.java | 6 +- .../announcement/tool/AnnouncementAction.java | 20 +- .../archive/tool/ArchiveAction.java | 6 +- .../impl/handlers/AnnouncementHandler.java | 6 +- .../impl/AssignmentGradeInfoProvider.java | 6 +- .../AssignmentPeerAssessmentServiceImpl.java | 6 +- .../AssignmentSupplementItemServiceImpl.java | 32 +- .../impl/BaseAssignmentService.java | 27 +- .../assignment/impl/DbAssignmentService.java | 6 +- .../impl/AssignmentSubmissionAccess.java | 7 +- ...DuplicateSubmissionsConversionHandler.java | 6 +- ...bmitterIdAssignmentsConversionHandler.java | 7 +- .../impl/AssignmentActivityProducerImpl.java | 7 +- .../taggable/impl/AssignmentItemImpl.java | 7 +- .../impl/AssignmentComparatorTest.java | 8 +- .../impl/AssignmentServiceTest.java | 6 +- .../AssignmentEntityProvider.java | 6 +- .../assignment/tool/AssignmentAction.java | 18 +- .../RedirectingAssignmentEntityServlet.java | 7 +- .../authz/tool/PermissionsHelperAction.java | 8 +- .../sakaiproject/authz/tool/RealmsAction.java | 18 +- .../extensions/POXMembershipsResponse.java | 6 +- .../org/sakaiproject/blti/ServiceServlet.java | 10 +- .../org/sakaiproject/lti2/LTI2Service.java | 6 +- .../sakaiproject/basiclti/util/BlowFish.java | 4 +- .../basiclti/util/SakaiBLTIUtil.java | 8 +- .../basiclti/util/SakaiCASAUtil.java | 6 +- .../basiclti/util/SakaiContentItemUtil.java | 6 +- .../basiclti/util/SakaiLTIProviderUtil.java | 6 +- .../sakaiproject/linktool/LinkToolUtil.java | 6 +- .../basiclti/impl/BasicLTIArchiveBean.java | 6 +- .../impl/BasicLTISecurityServiceImpl.java | 6 +- .../sakaiproject/lti/impl/BaseLTIService.java | 6 +- .../sakaiproject/lti/impl/DBLTIService.java | 6 +- .../lti/impl/LTIReportingJob.java | 6 +- .../lti/impl/LTIRoleMapperImpl.java | 6 +- .../impl/SiteEmailPreferenceSetterImpl.java | 6 +- .../lti/impl/SiteMembershipUpdaterImpl.java | 6 +- .../impl/SiteMembershipsSynchroniserImpl.java | 6 +- .../lti/impl/UserFinderOrCreatorImpl.java | 6 +- .../lti/impl/UserLocaleSetterImpl.java | 6 +- .../lti/impl/UserPictureSetterImpl.java | 6 +- .../lti/impl/jobs/SiteMembershipsSyncJob.java | 6 +- .../org/sakaiproject/util/foorm/Foorm.java | 4 +- .../sakaiproject/util/foorm/SakaiFoorm.java | 4 +- .../sakaiproject/blti/ProviderServlet.java | 6 +- .../sakaiproject/portlets/IMSBLTIPortlet.java | 6 +- .../sakaiproject/blti/tool/LTIAdminTool.java | 6 +- .../portlet/util/PortletHelper.java | 4 +- .../tsugi/basiclti/BasicLTIProviderUtil.java | 6 +- .../java/org/tsugi/json/IMSJSONRequest.java | 9 +- .../src/java/org/tsugi/lti2/LTI2Servlet.java | 6 +- .../src/java/org/tsugi/pox/IMSPOXRequest.java | 15 +- .../portlet/util/VelocityHelper.java | 6 +- .../sakaiproject/portlets/SakaiIFrame.java | 10 +- .../calendar/impl/BaseCalendarService.java | 6 +- ...seExternalCalendarSubscriptionService.java | 6 +- .../calendar/impl/DbCalendarService.java | 6 +- .../impl/ExclusionRecurrenceRule.java | 6 +- .../impl/ExclusionSeqRecurrenceRule.java | 6 +- .../impl/GenericCalendarImporter.java | 6 +- .../calendar/impl/OpaqueUrlDaoHbm.java | 6 +- .../calendar/impl/RecurrenceRuleBase.java | 6 +- .../calendar/impl/SAK11204Fix.java | 75 +- .../calendar/impl/readers/ICalRecurrence.java | 6 +- .../impl/readers/IcalendarReader.java | 6 +- .../DbCalendarServiceSerializationTest.java | 6 +- .../tool/summarycalendar/ui/CalendarBean.java | 6 +- .../tool/summarycalendar/ui/EventSummary.java | 6 +- .../tool/summarycalendar/ui/PrefsBean.java | 6 +- .../calendar/tool/CalendarAction.java | 6 +- .../calendar/tool/CalendarActionState.java | 6 +- .../org/sakaiproject/util/CalendarUtil.java | 6 +- .../model/impl/ChatChannelEntityProvider.java | 6 +- .../chat2/model/impl/ChatContentProducer.java | 8 +- .../chat2/model/impl/ChatDataMigration.java | 6 +- .../chat2/model/impl/ChatEntityProducer.java | 6 +- .../chat2/model/impl/ChatManagerImpl.java | 10 +- .../model/impl/ChatMessageEntityProvider.java | 6 +- .../chat2/model/impl/ChatRestDelivery.java | 8 +- .../chat2/model/impl/ChatRestListener.java | 6 +- .../chat2/tool/AlertDelivery.java | 4 +- .../sakaiproject/chat2/tool/ChatDelivery.java | 10 +- .../org/sakaiproject/chat2/tool/ChatTool.java | 6 +- .../citation/impl/BaseCitationService.java | 8 +- .../impl/BaseConfigurationService.java | 6 +- .../citation/impl/BaseSearchManager.java | 6 +- .../impl/CitationListAccessServlet.java | 6 +- .../citation/impl/DbCitationService.java | 6 +- .../citation/impl/SakaiOsidLoader.java | 6 +- .../impl/SampleSiteOsidConfiguration.java | 204 +- .../citation/impl/openurl/BookConverter.java | 6 +- .../impl/openurl/JournalConverter.java | 6 +- .../citation/impl/openurl/KEVFormat.java | 6 +- .../lib/osid/base/loader/OsidLoader.java | 2 - .../lib/osid/base/repository/http/Asset.java | 26 +- .../base/repository/http/AssetIterator.java | 28 +- .../http/ContributorPartStructure.java | 5 +- .../http/CoveragePartStructure.java | 2 - .../repository/http/CreatorPartStructure.java | 2 - .../repository/http/DOIPartStructure.java | 2 - .../repository/http/DatePartStructure.java | 3 - .../http/DateRetrievedPartStructure.java | 4 - .../repository/http/EditionPartStructure.java | 6 +- .../repository/http/EndPagePartStructure.java | 2 - .../repository/http/FormatPartStructure.java | 2 - .../http/InLineCitationPartStructure.java | 2 - .../http/IsnIdentifierPartStructure.java | 2 - .../repository/http/IssuePartStructure.java | 2 - .../http/LanguagePartStructure.java | 2 - .../lib/osid/base/repository/http/Logger.java | 2 +- .../repository/http/LongValueIterator.java | 2 - .../osid/base/repository/http/Managers.java | 2 - .../repository/http/MetasearchException.java | 2 - .../repository/http/NotePartStructure.java | 1 - .../base/repository/http/ObjectIterator.java | 2 - .../repository/http/OpenUrlPartStructure.java | 2 - .../repository/http/PagesPartStructure.java | 2 - .../lib/osid/base/repository/http/Part.java | 8 +- .../base/repository/http/PartIterator.java | 2 - .../http/PartStructureIterator.java | 2 - .../http/PreferredUrlPartStructure.java | 2 - .../osid/base/repository/http/Properties.java | 2 - .../repository/http/PropertiesIterator.java | 2 - .../PublicationLocationPartStructure.java | 2 - .../http/PublisherPartStructure.java | 2 - .../lib/osid/base/repository/http/Record.java | 14 +- .../base/repository/http/RecordIterator.java | 2 - .../base/repository/http/RecordStructure.java | 8 +- .../http/RecordStructureIterator.java | 6 +- .../http/RelationPartStructure.java | 2 - .../osid/base/repository/http/Repository.java | 29 +- .../repository/http/RepositoryIterator.java | 2 - .../repository/http/RepositoryManager.java | 40 +- .../repository/http/RightsPartStructure.java | 3 - .../repository/http/SharedProperties.java | 2 - .../repository/http/SourcePartStructure.java | 2 - .../http/SourceTitlePartStructure.java | 2 - .../http/StartPagePartStructure.java | 2 - .../repository/http/SubjectPartStructure.java | 2 - .../lib/osid/base/repository/http/Type.java | 2 - .../base/repository/http/TypeIterator.java | 2 - .../repository/http/TypePartStructure.java | 2 - .../repository/http/URLPartStructure.java | 2 - .../repository/http/VolumePartStructure.java | 2 - .../repository/http/YearPartStructure.java | 2 - .../edu/indiana/lib/osid/component/id/Id.java | 7 +- .../lib/twinpeaks/net/HttpAuthenticator.java | 12 +- .../lib/twinpeaks/net/HttpTransaction.java | 20 +- .../search/HttpTransactionQueryBase.java | 13 +- .../lib/twinpeaks/search/MatchItem.java | 5 +- .../twinpeaks/search/PreferredUrlHandler.java | 1 - .../lib/twinpeaks/search/QueryBase.java | 4 +- .../twinpeaks/search/SearchResultBase.java | 15 +- .../lib/twinpeaks/search/SearchSource.java | 41 +- .../search/singlesearch/CqlParser.java | 27 +- .../search/singlesearch/musepeer/Query.java | 56 +- .../singlesearch/musepeer/Response.java | 24 +- .../search/singlesearch/web2/Web2Query.java | 53 +- .../singlesearch/web2/Web2Response.java | 26 +- .../lib/twinpeaks/search/sru/CqlParser.java | 22 +- .../twinpeaks/search/sru/SruQueryBase.java | 3 +- .../search/sru/ss360search/Query.java | 41 +- .../search/sru/ss360search/Response.java | 25 +- .../search/sru/ss360search/ResultUtils.java | 7 +- .../indiana/lib/twinpeaks/util/ByteUtils.java | 12 +- .../lib/twinpeaks/util/CaseBlindHashMap.java | 6 +- .../lib/twinpeaks/util/CookieData.java | 5 +- .../lib/twinpeaks/util/CookieUtils.java | 6 +- .../indiana/lib/twinpeaks/util/DomUtils.java | 6 +- .../twinpeaks/util/HttpTransactionUtils.java | 7 +- .../indiana/lib/twinpeaks/util/LogUtils.java | 32 +- .../lib/twinpeaks/util/ParameterMap.java | 6 +- .../lib/twinpeaks/util/SessionContext.java | 16 +- .../lib/twinpeaks/util/StatusUtils.java | 11 +- .../lib/twinpeaks/util/StringUtils.java | 4 +- .../sakaibrary/osid/loader/OsidLoader.java | 23 +- .../osid/repository/xserver/Asset.java | 27 +- .../repository/xserver/AssetIterator.java | 51 +- .../xserver/AssetPresentationBean.java | 9 +- .../xserver/CreatorPartStructure.java | 9 +- .../repository/xserver/DOIPartStructure.java | 8 +- .../repository/xserver/DatePartStructure.java | 9 +- .../xserver/DateRetrievedPartStructure.java | 9 +- .../xserver/EditionPartStructure.java | 8 +- .../xserver/EndPagePartStructure.java | 9 +- .../xserver/InLineCitationPartStructure.java | 9 +- .../xserver/IsnIdentifierPartStructure.java | 9 +- .../xserver/IssuePartStructure.java | 9 +- .../xserver/LanguagePartStructure.java | 9 +- .../xserver/LocIdentifierPartStructure.java | 9 +- .../repository/xserver/NotePartStructure.java | 9 +- .../xserver/OpenUrlPartStructure.java | 9 +- .../xserver/PagesPartStructure.java | 9 +- .../osid/repository/xserver/Part.java | 9 +- .../xserver/PreferredUrlPartStructure.java | 9 +- .../PublicationLocationPartStructure.java | 9 +- .../xserver/PublisherPartStructure.java | 9 +- .../osid/repository/xserver/Record.java | 15 +- .../repository/xserver/RecordStructure.java | 10 +- .../osid/repository/xserver/Repository.java | 40 +- .../repository/xserver/RepositoryManager.java | 23 +- .../xserver/RightsPartStructure.java | 8 +- .../xserver/SourceTitlePartStructure.java | 9 +- .../xserver/StartPagePartStructure.java | 9 +- .../xserver/SubjectPartStructure.java | 9 +- .../repository/xserver/TypePartStructure.java | 9 +- .../xserver/URLFormatPartStructure.java | 8 +- .../xserver/URLLabelPartStructure.java | 8 +- .../repository/xserver/URLPartStructure.java | 9 +- .../xserver/VolumePartStructure.java | 9 +- .../repository/xserver/YearPartStructure.java | 9 +- .../sakaibrary/xserver/FindResultSetBean.java | 21 +- .../org/sakaibrary/xserver/XMLCleanup.java | 22 +- .../org/sakaibrary/xserver/XMLTransform.java | 17 +- .../java/org/sakaibrary/xserver/XServer.java | 61 +- .../session/MetasearchSessionManager.java | 11 +- .../sakaiproject/component/osid/id/Id.java | 9 +- .../component/osid/id/IdManager.java | 9 +- .../servlet/BatchCitationServlet.java | 6 +- .../citation/servlet/CitationServlet.java | 44 +- .../citation/tool/CitationHelperAction.java | 8 +- .../tool/EditorIntegrationHelperAction.java | 8 +- .../util/impl/CQL2XServerFindCommand.java | 25 +- .../citation/util/impl/CQLSearchQuery.java | 15 +- .../{Logger.java => CommonLogger.java} | 2 +- .../cloudcontent/SwiftFileSystemHandler.java | 46 +- .../cmprovider/AbstractCmEntityProvider.java | 6 +- .../archive/impl/ArchiveService2Impl.java | 6 +- .../archive/impl/ImportMetadataImpl.java | 8 +- .../impl/ImportMetadataServiceImpl.java | 8 +- .../archive/impl/SiteArchiver.java | 17 +- .../sakaiproject/archive/impl/SiteMerger.java | 10 +- .../sakaiproject/archive/impl/SiteZipper.java | 6 +- .../edu/person/FileSystemPhotoService.java | 6 +- .../edu/person/SakaiPersonManagerImpl.java | 6 +- .../edu/person/SakaiPersonObserver.java | 6 +- .../edu/person/SakaiPersonPhotoService.java | 6 +- .../common/manager/PersistableHelper.java | 26 +- .../common/type/TypeManagerImpl.java | 6 +- .../common/edu/person/InetOrgPersonImpl.java | 6 +- .../common/edu/person/SakaiPersonImpl.java | 6 +- .../common/manager/PersistableImpl.java | 6 +- .../manager/TypeablePersistableImpl.java | 6 +- .../component/common/type/TypeImpl.java | 6 +- .../importer/impl/handlers/LBCCHandler.java | 6 +- .../impl/handlers/ResourcesHandler.java | 6 +- .../Bb55AnnouncementTranslator.java | 6 +- .../Bb6AnnouncementTranslator.java | 6 +- .../impl/CommonCartridgeFileParser.java | 6 +- .../impl/LBCommonCartridgeFileParser.java | 6 +- .../component/privacy/PrivacyManagerImpl.java | 6 +- .../component/test/privacy/PrivacyTest.java | 6 +- .../turnitin/util/TurnitinAPIUtil.java | 6 +- .../content/CleanupDeletedContent.java | 18 +- .../content/copyright/CopyrightManager.java | 8 +- .../providers/BaseEventDelayHandler.java | 6 +- .../logic/MetadataServiceFromContent.java | 6 +- .../metadata/model/ListMetadataType.java | 2 +- .../content/tool/AttachmentAction.java | 6 +- .../content/tool/FilePickerAction.java | 6 +- .../sakaiproject/content/tool/ListItem.java | 6 +- .../tool/ResourceConditionsHelper.java | 8 +- .../content/tool/ResourcesAction.java | 10 +- .../content/tool/ResourcesHelperAction.java | 6 +- .../content/tool/ResourcesMetadata.java | 6 +- .../SiteEmailNotificationDragAndDrop.java | 6 +- .../types/ContentTypeRegistryBean.java | 6 +- .../content/types/FileUploadType.java | 6 +- .../courier/impl/BasicCourierService.java | 6 +- .../courier/tool/CourierTool.java | 6 +- .../dash/dao/DashHibernateDao.java | 6 +- .../dash/dao/mapper/CalendarItemMapper.java | 6 +- .../dash/entity/AnnouncementSupport.java | 125 +- .../dash/entity/EntitySupportUtil.java | 6 +- .../dash/entity/ResourceSupport.java | 6 +- .../dash/entity/ScheduleSupport.java | 170 +- .../dash/jobs/DashAggregateJob.java | 6 +- .../dash/jobs/DashCheckAdminChangesJob.java | 6 +- .../dash/jobs/DashCheckAvailabilityJob.java | 6 +- .../dash/jobs/DashExpirePurgeJob.java | 6 +- .../sakaiproject/dash/jobs/DashQuartzJob.java | 6 +- .../dash/jobs/DashRepeatEventJob.java | 6 +- .../dash/jobs/DashSyncUserSitesJob.java | 6 +- .../dash/logic/DashboardConfigImpl.java | 6 +- .../dash/logic/DashboardLogicImpl.java | 2 +- .../dash/tool/util/JsonHelper.java | 6 +- .../java/org/sakaiproject/dav/DavRealm.java | 6 +- .../java/org/sakaiproject/dav/DavServlet.java | 6 +- ...ManagementAdministrationHibernateImpl.java | 6 +- .../CourseManagementServiceFederatedImpl.java | 6 +- .../CourseManagementServiceHibernateImpl.java | 6 +- .../impl/CourseSitePublishServiceImpl.java | 8 +- .../impl/CourseSiteRemovalServiceImpl.java | 8 +- .../coursemanagement/impl/IndexGenerator.java | 6 +- .../impl/SampleDataLoader.java | 6 +- .../impl/SiteTitleAdvisorCMS.java | 6 +- ...eManagementAdministrationAuthzAdvisor.java | 6 +- .../impl/job/ClassPathCMSyncJob.java | 6 +- .../impl/job/CmSynchronizer.java | 20 +- .../CourseManagementAdministrationTest.java | 6 +- .../test/CourseManagementServiceTest.java | 6 +- .../test/HibernateTestDataLoader.java | 6 +- .../test/performance/IndexPerformance.java | 6 +- .../tool/gradebook/GradableObject.java | 6 +- .../tool/gradebook/GradeMapping.java | 6 +- .../tool/gradebook/GradebookArchive.java | 6 +- .../tool/gradebook/Spreadsheet.java | 6 +- .../gradebook/BaseHibernateManager.java | 6 +- ...radebookExternalAssessmentServiceImpl.java | 10 +- .../GradebookFrameworkServiceImpl.java | 6 +- .../GradebookServiceHibernateImpl.java | 8 +- .../facades/sakai2impl/AuthnSakai2Impl.java | 6 +- .../facades/sakai2impl/AuthzSakai2Impl.java | 6 +- .../sakai2impl/BaseEntityProducer.java | 2 +- .../ContextManagementSakai2Impl.java | 6 +- .../GradebookConfigurationSakai.java | 6 +- .../sakai2impl/GradebookEntityProducer.java | 8 +- .../UserDirectoryServiceSakai2Impl.java | 6 +- .../facades/sections/AuthzSectionsImpl.java | 6 +- ...irectoryServiceStandaloneSectionsImpl.java | 6 +- .../standalone/AuthnStandaloneImpl.java | 6 +- .../ContextManagementStandaloneImpl.java | 6 +- .../EventTrackingServiceStandaloneImpl.java | 60 +- .../impl/ScoringServiceImpl.java | 6 +- .../support/IntegrationSupportImpl.java | 6 +- .../support/UserManagerHibernateImpl.java | 6 +- .../integration/IntegrationSupportTest.java | 6 +- .../section/SectionAwarenessImplTest.java | 10 +- .../section/SectionIntegrationTestSuite.java | 6 +- .../section/sakai/CourseManagerImpl.java | 6 +- .../section/sakai/SectionAwarenessImpl.java | 6 +- .../sakai/SectionCmMetadataSynchronizer.java | 12 +- .../section/sakai/SectionManagerImpl.java | 8 +- .../component/section/sakai/CourseImpl.java | 6 +- .../section/sakai/CourseSectionImpl.java | 6 +- .../section/sakai/SectionEnrollmentsImpl.java | 6 +- .../section/sakai/facade/SakaiUtil.java | 6 +- .../section/CourseManagerHibernateImpl.java | 6 +- .../SectionAwarenessHibernateImpl.java | 6 +- .../section/SectionEnrollmentsImpl.java | 6 +- .../section/SectionManagerHibernateImpl.java | 12 +- .../impl/standalone/AuthzStandaloneImpl.java | 6 +- .../impl/EmailTemplateServiceImpl.java | 6 +- .../tool/handler/ModifyEmailHandler.java | 8 +- .../tool/locators/EmailTemplateLocator.java | 6 +- .../tool/producers/MainViewProducer.java | 6 +- .../tool/producers/ModifyEmailProducer.java | 6 +- .../providers/ExternalEmailNotification.java | 8 +- .../providers/MembershipEntityProvider.java | 6 +- .../providers/NotificationEntityProvider.java | 8 +- .../providers/SessionEntityProvider.java | 6 +- .../providers/SiteEntityProvider.java | 6 +- .../providers/UserEntityProvider.java | 6 +- .../SakaiExternalIntegrationProvider.java | 6 +- .../util/ReloadableComponentProxy.java | 6 +- .../spring/BeanCollectorAutoRegistrar.java | 6 +- .../spring/EntityProviderAutoRegistrar.java | 6 +- .../feedback/tool/FeedbackTool.java | 6 +- .../feedback/util/SakaiProxy.java | 6 +- .../impl/GradebookCalculationImpl.java | 6 +- .../impl/GradebookManagerHibernateImpl.java | 18 +- .../jsf/AssignmentGradeValidator.java | 6 +- .../jsf/AssignmentPointsConverter.java | 6 +- .../jsf/CategoryPointsConverter.java | 6 +- .../tool/gradebook/jsf/ClassAvgConverter.java | 6 +- .../jsf/ClassAvgConverterBasicDisplay.java | 6 +- .../gradebook/jsf/DivMessageRenderer.java | 6 +- .../gradebook/jsf/DivMessageRendererBase.java | 6 +- .../gradebook/jsf/DivMessagesRenderer.java | 6 +- .../gradebook/jsf/FacesPhaseListener.java | 6 +- .../tool/gradebook/jsf/FacesUtil.java | 6 +- .../gradebook/jsf/HtmlSortHeaderRenderer.java | 7 +- .../jsf/NontrailingDoubleConverter.java | 6 +- .../gradebook/jsf/PercentageConverter.java | 6 +- .../tool/gradebook/jsf/PointsConverter.java | 6 +- .../jsf/PrecisePercentageConverter.java | 6 +- .../tool/gradebook/jsf/ScoreConverter.java | 6 +- .../gradebook/jsf/TotalPointsConverter.java | 6 +- .../jsf/dhtmlpopup/DhtmlPopupComponent.java | 6 +- .../GradebookItemTableRenderer.java | 6 +- .../jsf/iterator/IteratorComponent.java | 6 +- .../jsf/spreadsheetUI/SpreadsheetUITag.java | 6 +- .../tool/gradebook/ui/AssignmentBean.java | 10 +- .../gradebook/ui/AssignmentDetailsBean.java | 6 +- .../tool/gradebook/ui/ConfigurationBean.java | 6 +- .../gradebook/ui/CourseGradeDetailsBean.java | 10 +- ...seGradesToSpreadsheetConverterDefault.java | 6 +- ...rseGradesToSpreadsheetCustomConverter.java | 6 +- .../gradebook/ui/EnrollmentTableBean.java | 6 +- .../tool/gradebook/ui/EntryServlet.java | 8 +- .../gradebook/ui/FeedbackOptionsBean.java | 8 +- .../tool/gradebook/ui/GradebookBean.java | 6 +- .../tool/gradebook/ui/GradebookSetupBean.java | 8 +- .../tool/gradebook/ui/GraderRulesBean.java | 6 +- .../tool/gradebook/ui/InitializableBean.java | 6 +- .../tool/gradebook/ui/InstructorViewBean.java | 6 +- .../tool/gradebook/ui/OverviewBean.java | 6 +- .../gradebook/ui/RemoveAssignmentBean.java | 6 +- .../tool/gradebook/ui/RoleFilter.java | 6 +- .../tool/gradebook/ui/RosterBean.java | 6 +- .../gradebook/ui/SpreadsheetRemoveBean.java | 6 +- .../gradebook/ui/SpreadsheetUploadBean.java | 18 +- .../tool/gradebook/ui/StudentViewBean.java | 6 +- .../tool/gradebook/ui/ViewByStudentBean.java | 6 +- .../gradebook/ui/standalone/AuthnFilter.java | 6 +- .../FrameworkManagerSectionsImpl.java | 8 +- .../ui/standalone/SelectGradebookBean.java | 6 +- .../tool/gradebook/ui/test/LoginAsBean.java | 6 +- .../gradebook/logic/ExternalLogic.java | 6 +- .../component/app/help/DefaultGlossary.java | 8 +- .../component/app/help/HelpManagerImpl.java | 10 +- .../app/help/RestConfigurationImpl.java | 6 +- .../app/help/TutorialEntityProviderImpl.java | 6 +- .../tool/help/ContentServlet.java | 6 +- .../sakaiproject/tool/help/HelpJsfTool.java | 6 +- .../sakaiproject/tool/help/QuestionTool.java | 30 +- .../tool/help/RestContentProvider.java | 9 +- .../tool/help/TableOfContentsTool.java | 8 +- .../hierarchy/dao/HierarchyDaoImpl.java | 100 +- .../hierarchy/impl/HierarchyServiceImpl.java | 2276 ++++----- .../scheduler/ConnectionProviderDelegate.java | 8 +- .../scheduler/DelayedInvocationReader.java | 82 +- .../scheduler/NavigableEventLogListener.java | 8 +- .../ScheduledInvocationManagerImpl.java | 6 +- .../app/scheduler/SchedulerManagerImpl.java | 6 +- .../jobs/AuthzGroupProviderSync.java | 6 +- .../app/scheduler/jobs/ContentCheckJob.java | 6 +- .../scheduler/jobs/SakaiEventArchiveJob.java | 6 +- .../jobs/ScheduledInvocationRunner.java | 6 +- .../scheduler/jobs/SoftSiteDeletionJob.java | 4 +- .../jobs/backfillrole/BackFillRoleJob.java | 8 +- .../jobs/backfilltool/BackFillToolJob.java | 8 +- .../coursepublish/CourseSitePublishJob.java | 8 +- .../coursepublish/CourseSiteRemovalJob.java | 8 +- .../jobs/logmessage/LogMessageJob.java | 12 +- .../conditions/job/DatetimeEventJob.java | 8 +- .../ScheduledInvocationTestCommand.java | 6 +- .../scheduler/ScheduledInvocationTestJob.java | 6 +- .../component/app/scheduler/jobs/TestJob.java | 8 +- .../app/scheduler/jobs/TestJob2.java | 8 +- .../ScheduledInvocationTestCommand.java | 6 +- .../scheduler/ScheduledInvocationTestJob.java | 6 +- .../scheduler/jobs/TestConfigurableJob.java | 8 +- .../scheduler/jobs/TestEventGeneratorJob.java | 8 +- .../component/app/scheduler/jobs/TestJob.java | 8 +- .../app/scheduler/jobs/TestJob2.java | 8 +- .../tool/app/scheduler/SchedulerTool.java | 6 +- .../jsf/app/SakaiPhaseListener.java | 6 +- .../jsf/app/SakaiVariableResolver.java | 6 +- .../jsf/app/SakaiViewHandler.java | 6 +- .../jsf/app/SakaiViewHandlerWrapper.java | 6 +- .../SpreadsheetDataFileWriterCsv.java | 10 +- .../SpreadsheetDataFileWriterPdf.java | 14 +- .../SpreadsheetDataFileWriterXls.java | 10 +- .../jsf/util/HelperAwareJsfTool.java | 6 +- .../org/sakaiproject/jsf/util/JsfTool.java | 6 +- .../org/sakaiproject/jsf/util/JSFDepends.java | 6 +- .../sakaiproject/jsf/component/FlowState.java | 6 +- .../jsf/renderer/InputRichTextRenderer.java | 8 +- .../jsf/renderer/PagerRenderer.java | 6 +- .../sakaiproject/jsf/tag/FlowStateTag.java | 6 +- .../org/sakaiproject/jsf/util/LocaleUtil.java | 38 +- .../commons/dbcp/SakaiBasicDataSource.java | 6 +- .../dbcp/SakaiPoolableConnectionFactory.java | 6 +- .../jdbc/pool/SakaiBasicDataSource.java | 6 +- .../jdbc/pool/SakaiBasicDataSource.java | 6 +- .../org/sakaiproject/util/RequestFilter.java | 22 +- .../util/ResponseHeaderFilter.java | 6 +- .../sakaiproject/util/TrustedLoginFilter.java | 6 +- .../util/api/MockFormattedText.java | 6 +- .../util/cover/LinkMigrationHelper.java | 6 +- .../util/TrustedLoginTokenTest.java | 6 +- .../cover/TestComponentManagerContainer.java | 8 +- .../impl/DynamicDefaultSakaiProperties.java | 10 +- .../component/impl/MockCompMgr.java | 6 +- .../component/impl/SakaiContextLoader.java | 6 +- .../component/impl/SpringCompMgr.java | 10 +- .../sakaiproject/util/ComponentsLoader.java | 6 +- .../ReversiblePropertyOverrideConfigurer.java | 2 +- .../util/SakaiContextLoaderListener.java | 6 +- .../sakaiproject/util/SakaiProperties.java | 8 +- .../util/TerracottaClassLoader.java | 6 +- .../alias/impl/BaseAliasService.java | 6 +- .../alias/impl/DbAliasService.java | 6 +- .../antivirus/impl/ClamAVScanner.java | 6 +- .../authz/impl/BaseAuthzGroup.java | 6 +- .../authz/impl/BaseAuthzGroupService.java | 6 +- .../org/sakaiproject/authz/impl/BaseRole.java | 6 +- .../authz/impl/DbAuthzGroupService.java | 8 +- .../authz/impl/FunctionManagerComponent.java | 6 +- .../sakaiproject/authz/impl/NoSecurity.java | 6 +- .../authz/impl/SakaiSecurity.java | 6 +- .../cluster/impl/SakaiClusterService.java | 6 +- .../impl/BasicConfigurationService.java | 6 +- .../impl/ToolConfigurationService.java | 8 +- .../conditions/impl/BaseConditionService.java | 6 +- .../impl/HibernateConfigItemDaoImpl.java | 6 +- .../config/impl/StoredConfigService.java | 6 +- .../content/impl/BaseContentService.java | 16 +- .../impl/BasicContentPrintService.java | 6 +- .../impl/BasicContentTypeImageService.java | 6 +- .../impl/CollectionAccessFormatter.java | 6 +- .../ContentHostingHandlerResolverImpl.java | 8 +- .../content/impl/DbContentService.java | 40 +- .../content/impl/DbResourceTypeRegistry.java | 6 +- .../content/impl/DropboxContextObserver.java | 6 +- .../content/impl/DropboxNotification.java | 6 +- .../content/impl/LockManagerImpl.java | 32 +- .../impl/ResourceTypeRegistryImpl.java | 6 +- .../FileSizeResourcesConversionHandler.java | 7 +- .../SAXSerializableCollectionAccess.java | 7 +- .../SAXSerializableResourceAccess.java | 9 +- .../sakaiproject/db/impl/BasicSqlService.java | 8 +- .../email/impl/BaseDigestService.java | 6 +- .../email/impl/BasicEmailService.java | 6 +- .../email/impl/DbDigestService.java | 6 +- .../entity/impl/EntityManagerComponent.java | 6 +- .../entity/impl/ReferenceComponent.java | 6 +- .../event/impl/ActivityServiceImpl.java | 6 +- .../event/impl/BaseEventTrackingService.java | 6 +- .../BaseLearningResourceStoreService.java | 6 +- .../event/impl/BaseNotificationService.java | 6 +- .../event/impl/BasicEventTracking.java | 6 +- .../event/impl/ClusterEventTracking.java | 6 +- .../event/impl/DbNotificationService.java | 6 +- .../event/impl/EventQueryServiceImpl.java | 6 +- .../impl/UsageSessionServiceAdaptor.java | 6 +- .../id/impl/UuidV4IdComponent.java | 6 +- .../memory/impl/BaseMemoryService.java | 6 +- .../sakaiproject/memory/impl/BasicCache.java | 6 +- .../memory/impl/BasicMapCache.java | 6 +- .../memory/impl/EhCacheJmxRegistration.java | 6 +- .../memory/impl/EhcacheCache.java | 6 +- .../memory/impl/EhcacheMemoryService.java | 6 +- .../memory/impl/HazelcastCache.java | 6 +- .../memory/impl/HazelcastMemoryService.java | 6 +- .../impl/SakaiCacheManagerFactoryBean.java | 6 +- .../impl/CachingMessageBundleServiceImpl.java | 6 +- .../impl/MessageBundleServiceImpl.java | 6 +- .../org/sakaiproject/site/impl/BaseGroup.java | 6 +- .../org/sakaiproject/site/impl/BaseSite.java | 6 +- .../sakaiproject/site/impl/BaseSitePage.java | 6 +- .../site/impl/BaseSiteService.java | 6 +- .../site/impl/BaseToolConfiguration.java | 6 +- .../sakaiproject/site/impl/DbSiteService.java | 6 +- .../site/impl/JoinSiteDelegate.java | 6 +- .../SiteAliasCleanupNotificationAction.java | 8 +- .../sakaiproject/site/impl/SiteCacheImpl.java | 6 +- .../sakaiproject/site/impl/SiteCacheSafe.java | 6 +- .../impl/ThreadLocalComponent.java | 6 +- .../time/impl/BasicTimeService.java | 6 +- .../tool/impl/ActiveToolComponent.java | 6 +- .../impl/RebuildBreakdownServiceImpl.java | 6 +- .../sakaiproject/tool/impl/ToolComponent.java | 6 +- .../org/sakaiproject/tool/impl/ToolImpl.java | 6 +- .../user/impl/AuthenticationCache.java | 6 +- .../user/impl/AuthnCacheWatcher.java | 8 +- .../user/impl/BasePreferencesService.java | 6 +- .../user/impl/BaseUserDirectoryService.java | 6 +- .../user/impl/DbPreferencesService.java | 6 +- .../sakaiproject/user/impl/DbUserService.java | 6 +- .../user/impl/OpenAuthnComponent.java | 6 +- .../PasswordPolicyProviderDefaultImpl.java | 6 +- .../user/impl/PasswordService.java | 6 +- .../user/impl/PrecachingDbUserService.java | 6 +- .../user/impl/UserAuthnComponent.java | 6 +- .../util/impl/FormattedTextImpl.java | 8 +- .../util/impl/LinkMigrationHelperImpl.java | 6 +- .../authz/impl/DummyUserEncodingTest.java | 8 +- .../authz/impl/RoleProviderTest.java | 8 +- .../impl/BasicConfigurationServiceTest.java | 8 +- .../test/ConfigurationLoadingTest.java | 8 +- .../test/DynamicConfigurationTest.java | 8 +- .../test/dynamic/DbPropertiesDao.java | 6 +- .../config/test/StoredConfigServiceTest.java | 8 +- .../content/impl/db/test/CheckBlobSafety.java | 6 +- .../impl/test/ByteStorageConversionCheck.java | 6 +- .../impl/test/GMTDateformatterTest.java | 6 +- .../serialize/impl/test/MySQLByteStorage.java | 6 +- .../impl/test/ProfileSerializerTest.java | 6 +- .../ContentHostingServiceRecycleTest.java | 8 +- .../impl/test/ContentHostingServiceTest.java | 8 +- .../test/ContentIntegrationTestDisabled.java | 8 +- .../impl/test/MockContentCollection.java | 6 +- .../content/impl/test/MockContentEntity.java | 6 +- .../impl/test/MockContentResource.java | 6 +- .../content/impl/test/RoleAccessTest.java | 6 +- .../content/impl/test/RoleViewTest.java | 6 +- .../content/impl/test/VirusScannerTest.java | 10 +- .../email/impl/test/EmailServiceTest.java | 10 +- ...anupNotificationActionIntegrationTest.java | 8 +- ...iteAliasCleanupNotificationActionTest.java | 6 +- .../site/impl/test/SiteSearchTest.java | 10 +- .../site/impl/test/SiteServiceTest.java | 8 +- .../impl/BaseUserDirectoryServiceTest.java | 8 +- .../test/AuthenticatedUserProviderTest.java | 12 +- .../impl/test/AuthenticationCacheTest.java | 8 +- .../test/ContextualDisplayServiceTest.java | 8 +- .../user/impl/test/GetUsersByEidTest.java | 8 +- ...eLocalAccountLegacyAuthenticationTest.java | 8 +- .../test/UserDirectoryServiceGetTest.java | 8 +- .../hibernate/AddableSessionFactoryBean.java | 6 +- .../orm/hibernate/HibernateJMXAgent.java | 6 +- .../orm/hibernate/SakaiCacheProvider.java | 6 +- .../impl/AdditionalHibernateMappingsImpl.java | 6 +- .../util/BaseDbBinarySingleStorage.java | 6 +- .../util/BaseDbDoubleStorage.java | 6 +- .../util/BaseDbDualSingleStorage.java | 6 +- .../sakaiproject/util/BaseDbFlatStorage.java | 6 +- .../util/BaseDbSingleStorage.java | 6 +- .../sakaiproject/util/BaseXmlFileStorage.java | 6 +- .../util/DbSingleStorageReader.java | 6 +- .../util/DefaultEntityHandler.java | 6 +- .../util/EntityReaderAdapter.java | 6 +- .../org/sakaiproject/util/PathHashUtil.java | 6 +- .../org/sakaiproject/util/StorageUtils.java | 6 +- .../util/conversion/CheckConnection.java | 6 +- .../SchemaConversionController.java | 6 +- .../util/conversion/UpgradeSchema.java | 6 +- ...Type1BaseResourcePropertiesSerializer.java | 7 +- .../content/util/ZipContentUtil.java | 12 +- .../memory/util/CacheInitializer.java | 16 +- .../memory/util/EhCacheFactoryBean.java | 6 +- .../util/BaseResourceProperties.java | 6 +- .../sakaiproject/util/EmailNotification.java | 6 +- .../org/sakaiproject/util/FormattedText.java | 6 +- .../org/sakaiproject/util/PasswordCheck.java | 6 +- .../org/sakaiproject/util/PathHashUtil.java | 6 +- .../sakaiproject/util/RemoteHostFilter.java | 6 +- .../java/org/sakaiproject/util/Resource.java | 6 +- .../org/sakaiproject/util/ResourceLoader.java | 6 +- ...tificationPreferencesRegistrationImpl.java | 6 +- .../java/org/sakaiproject/util/Validator.java | 6 +- .../main/java/org/sakaiproject/util/Web.java | 8 +- .../main/java/org/sakaiproject/util/Xml.java | 6 +- .../java/org/sakaiproject/util/WebTest.java | 8 +- .../ccexport/Assignment2Export.java | 6 +- .../service/Assignment2Entity.java | 6 +- .../service/MnemeEntity.java | 6 +- .../service/ScormEntity.java | 6 +- .../service/YaftTopicEntity.java | 6 +- .../lessonbuildertool/cc/AbstractParser.java | 6 +- .../lessonbuildertool/cc/LtiParser.java | 6 +- .../lessonbuildertool/cc/Parser.java | 6 +- .../lessonbuildertool/cc/PrintHandler.java | 6 +- .../lessonbuildertool/cc/ZipLoader.java | 6 +- .../ccexport/AssignmentExport.java | 6 +- .../ccexport/BltiExport.java | 6 +- .../lessonbuildertool/ccexport/CCExport.java | 6 +- .../ccexport/ForumsExport.java | 6 +- .../ccexport/JForumExport.java | 6 +- .../ccexport/SamigoExport.java | 6 +- .../lessonbuildertool/service/AjaxServer.java | 6 +- .../service/AssignmentEntity.java | 43 +- .../lessonbuildertool/service/BltiEntity.java | 6 +- .../service/ForumEntity.java | 6 +- .../service/GradebookIfc.java | 8 +- .../service/GroupPermissionsService.java | 6 +- .../service/JForumEntity.java | 6 +- .../service/LessonBuilderAccessService.java | 6 +- .../service/LessonBuilderEntityProducer.java | 10 +- .../service/LessonsAccess.java | 6 +- .../service/LessonsEntityContentProducer.java | 6 +- .../service/SamigoEntity.java | 8 +- .../tool/beans/GradingBean.java | 6 +- .../tool/beans/ReportHandlerHook.java | 6 +- .../tool/beans/SimplePageBean.java | 8 +- .../LessonsEntityProvider.java | 6 +- .../tool/evolvers/SakaiFCKTextEvolver.java | 6 +- .../producers/AssignmentPickerProducer.java | 6 +- .../tool/producers/BltiPickerProducer.java | 6 +- .../producers/ChecklistProgressProducer.java | 8 +- .../tool/producers/CommentsProducer.java | 6 +- .../tool/producers/EditPageProducer.java | 6 +- .../tool/producers/ForumPickerProducer.java | 6 +- .../tool/producers/IFrameWindowProducer.java | 6 +- .../tool/producers/LinkTrackerProducer.java | 8 +- .../tool/producers/LtiFileItemProducer.java | 6 +- .../tool/producers/PagePickerProducer.java | 6 +- .../tool/producers/PeerEvalStatsProducer.java | 6 +- .../tool/producers/PreviewProducer.java | 6 +- .../tool/producers/QuizPickerProducer.java | 6 +- .../tool/producers/ReorderProducer.java | 6 +- .../producers/ResourcePickerProducer.java | 6 +- .../tool/producers/ShowPageProducer.java | 6 +- .../service/LessonsGradeInfoProvider.java | 6 +- .../sakaiproject/login/tool/AuthnPortal.java | 6 +- .../LoginRenderEngineContextListener.java | 6 +- .../velocity/VelocityLoginRenderContext.java | 6 +- .../velocity/VelocityLoginRenderEngine.java | 6 +- .../SafeDelegatingFilterProxy.java | 6 +- .../login/tool/ContainerLogin.java | 6 +- .../login/tool/ContainerLogout.java | 6 +- .../login/tool/SkinnableLogin.java | 6 +- .../impl/BaseMailArchiveService.java | 6 +- .../impl/DbMailArchiveService.java | 6 +- .../org/sakaiproject/james/JamesServlet.java | 6 +- .../james/PhoenixLauncherMain.java | 6 +- .../org/sakaiproject/james/SakaiMailet.java | 6 +- .../SakaiMessageHandlerFactory.java | 6 +- .../MailArchiveEntityProvider.java | 7 +- .../mailarchive/tool/MailboxAction.java | 13 +- .../logic/impl/ComposeLogicImpl.java | 8 +- .../logic/impl/ExternalLogicImpl.java | 6 +- .../mailsender/tool/beans/EmailBean.java | 8 +- .../fragments/UserGroupingProducer.java | 8 +- .../producers/fragments/UsersProducer.java | 8 +- .../message/tool/SynopticMessageAction.java | 10 +- .../message/util/BaseMessage.java | 6 +- .../message/MessageContentProducer.java | 23 +- .../app/messageforums/PermissionsMask.java | 6 +- .../messageforums/AuthzGroupComparator.java | 6 +- .../messageforums/DiscussionForumTool.java | 16 +- .../messageforums/ForumsEmailService.java | 6 +- .../tool/messageforums/GroupComparator.java | 6 +- .../messageforums/PrivateMessagesTool.java | 8 +- .../ForumsEntityProviderImpl.java | 6 +- .../jsf/HierDataTableRender.java | 6 +- .../messageforums/jsf/HierDataTableTag.java | 6 +- .../jsf/HierPvtMsgDataTableRender.java | 7 +- .../jsf/HierPvtMsgDataTableTag.java | 6 +- .../messageforums/ui/DiscussionAreaBean.java | 6 +- .../messageforums/ui/DiscussionForumBean.java | 7 +- .../ui/DiscussionMessageBean.java | 6 +- .../messageforums/ui/DiscussionTopicBean.java | 7 +- .../ui/EmailNotificationBean.java | 6 +- .../tool/messageforums/ui/ForumRankBean.java | 6 +- .../ui/MessageForumStatisticsBean.java | 10 +- .../ui/MessageForumSynopticBean.java | 10 +- .../ui/MessageForumSynopticBeanLite.java | 6 +- .../messageforums/AnonymousManagerImpl.java | 6 +- .../app/messageforums/AreaManagerImpl.java | 6 +- .../DefaultPermissionsManagerImpl.java | 6 +- .../DiscussionForumServiceImpl.java | 10 +- .../app/messageforums/DummyDataHelper.java | 6 +- .../EmailNotificationManagerImpl.java | 55 +- .../ForumScheduleNotificationImpl.java | 6 +- .../messageforums/MembershipManagerImpl.java | 6 +- .../MessageForumsForumManagerImpl.java | 8 +- .../MessageForumsMessageManagerImpl.java | 6 +- .../MessageForumsTypeManagerImpl.java | 9 +- .../MessageForumsUserManagerImpl.java | 8 +- .../PermissionLevelManagerImpl.java | 6 +- .../messageforums/PermissionManagerImpl.java | 6 +- .../app/messageforums/RankManagerImpl.java | 6 +- .../SynopticMsgcntrManagerImpl.java | 37 +- .../ForumMessageEntityProviderImpl.java | 6 +- .../MessageForumsEntityContentProducer.java | 11 +- ...SynopticMsgcntrItemEntityProviderImpl.java | 6 +- .../entity/TopicEntityProviderImpl.java | 6 +- .../jobs/UpdateSynopticMessageCounts.java | 44 +- .../ui/DiscussionForumManagerImpl.java | 7 +- .../ui/PrivateMessageManagerImpl.java | 7 +- .../ui/UIPermissionsManagerImpl.java | 175 +- .../dao/hibernate/ActorPermissionsImpl.java | 6 +- .../messageforums/dao/hibernate/AreaImpl.java | 6 +- .../dao/hibernate/AttachmentImpl.java | 6 +- .../dao/hibernate/BaseForumImpl.java | 6 +- .../dao/hibernate/ControlPermissionsImpl.java | 6 +- .../dao/hibernate/DateRestrictionsImpl.java | 6 +- .../dao/hibernate/DiscussionForumImpl.java | 6 +- .../dao/hibernate/DiscussionTopicImpl.java | 6 +- .../dao/hibernate/EmailNotificationImpl.java | 6 +- .../dao/hibernate/LabelImpl.java | 6 +- .../dao/hibernate/MessageImpl.java | 6 +- .../dao/hibernate/MessagePermissionsImpl.java | 6 +- .../dao/hibernate/MutableEntityImpl.java | 6 +- .../dao/hibernate/OpenForumImpl.java | 6 +- .../dao/hibernate/OpenTopicImpl.java | 6 +- .../dao/hibernate/PrivateForumImpl.java | 6 +- .../dao/hibernate/PrivateMessageImpl.java | 6 +- .../dao/hibernate/PrivateTopicImpl.java | 6 +- .../dao/hibernate/RankImageImpl.java | 6 +- .../messageforums/dao/hibernate/RankImpl.java | 6 +- .../dao/hibernate/TopicImpl.java | 6 +- .../dao/hibernate/UnreadStatusImpl.java | 6 +- .../oauth/filter/OAuthPostFilter.java | 6 +- .../tool/podcasts/podHomeBean.java | 6 +- .../tool/podcasts/podPermBean.java | 6 +- .../app/podcasts/BasicPodfeedService.java | 6 +- .../app/podcasts/PodcastComparator.java | 6 +- .../app/podcasts/PodcastServiceImpl.java | 12 +- .../tool/podcasts/RSSPodfeedServlet.java | 6 +- .../poll/dao/impl/PollDoaImpl.java | 6 +- .../poll/logic/impl/ExternalLogicImpl.java | 6 +- .../service/impl/PollListManagerImpl.java | 6 +- .../service/impl/PollVoteManagerImpl.java | 6 +- .../poll/logic/test/PollListManagerTest.java | 6 +- .../PollVoteEntityProvider.java | 10 +- .../poll/tool/params/PermissionAction.java | 8 +- .../poll/tool/params/PollToolBean.java | 6 +- .../poll/tool/producers/AddPollProducer.java | 6 +- .../poll/tool/producers/ConfirmProducer.java | 6 +- .../tool/producers/PermissionsProducer.java | 6 +- .../producers/PollOptionDeleteProducer.java | 6 +- .../tool/producers/PollOptionProducer.java | 6 +- .../poll/tool/producers/PollToolProducer.java | 6 +- .../poll/tool/producers/PollVoteProducer.java | 6 +- .../poll/tool/producers/ResultsProducer.java | 6 +- .../poll/tool/validators/OptionValidator.java | 6 +- .../poll/tool/validators/VoteValidator.java | 6 +- .../sakaiproject/editor/EditorServlet.java | 6 +- .../portal/charon/SkinnableCharonPortal.java | 14 +- .../charon/handlers/BasePortalHandler.java | 6 +- .../charon/handlers/DirectToolHandler.java | 6 +- .../handlers/GenerateBugReportHandler.java | 6 +- .../portal/charon/handlers/PageHandler.java | 6 +- .../charon/handlers/RoleSwitchHandler.java | 6 +- .../charon/handlers/RoleSwitchOutHandler.java | 6 +- .../portal/charon/handlers/SiteHandler.java | 6 +- .../portal/charon/handlers/StaticHandler.java | 6 +- .../portal/charon/handlers/ToolHandler.java | 6 +- .../charon/handlers/WorksiteHandler.java | 6 +- .../charon/site/DefaultSiteViewImpl.java | 6 +- .../portal/charon/site/MoreSiteViewImpl.java | 6 +- .../charon/site/PortalSiteHelperImpl.java | 6 +- .../PortalRenderEngineContextListener.java | 7 +- .../velocity/VelocityPortalRenderContext.java | 6 +- .../velocity/VelocityPortalRenderEngine.java | 6 +- .../portal/charon/test/MockCharonPortal.java | 6 +- .../portal/charon/test/PortalRenderTest.java | 6 +- .../charon/test/PortalTestFileUtils.java | 6 +- .../charon/test/http/AnonPortalTest.java | 6 +- .../charon/test/http/LoginActionHandler.java | 6 +- .../CompatibilityToolRenderService.java | 7 +- .../fragment/FragmentToolRenderService.java | 6 +- .../iframe/IFrameToolRenderService.java | 6 +- .../portlet/PortletToolRenderService.java | 8 +- ...SakaiOptionalPortletContainerServices.java | 7 +- .../services/SakaiPortalCallbackService.java | 6 +- .../state/EnhancedPortletStateEncoder.java | 6 +- .../portlet/services/state/PortletState.java | 6 +- .../portal/service/AliasingSiteAdvisor.java | 8 +- .../portal/service/PortalServiceImpl.java | 6 +- .../portal/service/PortletTool.java | 6 +- .../service/SakaiPortletRegistryListener.java | 6 +- .../service/SiteNeighbourhoodServiceImpl.java | 6 +- .../sakaiproject/portal/tool/ToolPortal.java | 6 +- .../portal/util/ErrorReporter.java | 8 +- .../sakaiproject/portal/util/URLUtils.java | 6 +- .../sakaiproject/tool/postem/PostemTool.java | 6 +- .../presence/impl/BasePresenceService.java | 6 +- .../presence/impl/ClusterPresenceService.java | 6 +- .../presence/tool/PresenceTool.java | 6 +- .../authzGroup/AllHandsGroupProvider.java | 6 +- .../impl/provider/BaseRoleResolver.java | 6 +- .../CourseManagementGroupProvider.java | 6 +- .../provider/CourseOfferingRoleResolver.java | 6 +- .../impl/provider/CourseSetRoleResolver.java | 6 +- .../impl/provider/SectionRoleResolver.java | 6 +- .../user/FilterUserDirectoryProvider.java | 6 +- .../user/IMSEntUserDirectoryProvider.java | 6 +- ...sensusLdapConnectionLivenessValidator.java | 6 +- .../sakai/user/EmptyStringUserTypeMapper.java | 6 +- .../user/EntryAttributeToUserTypeMapper.java | 6 +- .../EntryContainerRdnToUserTypeMapper.java | 6 +- .../sakai/user/JLDAPDirectoryProvider.java | 6 +- ...fetimeLdapConnectionLivenessValidator.java | 6 +- ...NativeLdapConnectionLivenessValidator.java | 6 +- .../amc/sakai/user/PooledLDAPConnection.java | 6 +- .../user/PooledLDAPConnectionFactory.java | 6 +- .../user/PoolingLdapConnectionManager.java | 6 +- ...cutingLdapConnectionLivenessValidator.java | 6 +- .../sakai/user/SimpleLdapAttributeMapper.java | 6 +- .../user/SimpleLdapConnectionManager.java | 6 +- .../amc/sakai/user/StringUserTypeMapper.java | 6 +- .../sakai/user/UserAttributeRoleProvider.java | 6 +- .../kerberos/user/JassAuthenticate.java | 6 +- .../user/KerberosUserDirectoryProvider.java | 6 +- .../asic/user/OpenLdapDirectoryProvider.java | 6 +- .../authzGroup/SampleGroupProvider.java | 6 +- .../user/SampleUserDirectoryProvider.java | 6 +- .../impl/jobs/CheckAccountsJob.java | 6 +- .../impl/jobs/CheckValidations.java | 6 +- .../logic/impl/ValidationLogicImpl.java | 6 +- .../tool/otp/AcountValidationLocator.java | 6 +- .../tool/otp/ClaimLocator.java | 6 +- .../producers/BaseValidationProducer.java | 6 +- .../tool/producers/MainProducer.java | 6 +- .../tool/producers/NewUserProducer.java | 6 +- .../tool/producers/PasswordResetProducer.java | 6 +- .../producers/RequestAccountProducer.java | 6 +- .../TransferMembershipsProducer.java | 6 +- .../tool/producers/ValidationProducer.java | 6 +- .../tool/resetpass/FormHandler.java | 6 +- .../tool/resetpass/UserValidator.java | 6 +- .../rights/impl/BaseRightsService.java | 6 +- .../roster/api/RosterMemberComparator.java | 6 +- .../roster/impl/SakaiProxyImpl.java | 6 +- .../sakaiproject/roster/tool/RosterTool.java | 6 +- .../RosterPOIEntityProvider.java | 6 +- .../RosterSiteEntityProvider.java | 6 +- .../sakai/rwiki/access/WikiAccessServlet.java | 6 +- .../RWikiCurrentObjectContentDaoImpl.java | 19 +- .../dao/impl/RWikiCurrentObjectDaoImpl.java | 6 +- .../RWikiHistoryObjectContentDaoImpl.java | 19 +- .../dao/impl/RWikiHistoryObjectDaoImpl.java | 6 +- .../dao/impl/RWikiPropertyDaoImpl.java | 6 +- .../component/macros/SakaiLinkMacro.java | 6 +- .../component/message/MessageServiceImpl.java | 6 +- .../message/PreferenceServiceImpl.java | 6 +- .../component/message/TriggerServiceImpl.java | 6 +- .../message/dao/impl/MessageDaoImpl.java | 6 +- .../message/dao/impl/PagePresenceDaoImpl.java | 6 +- .../message/dao/impl/PreferenceDaoImpl.java | 6 +- .../message/dao/impl/TriggerDaoImpl.java | 6 +- .../impl/DataMigrationSpecification.java | 25 +- .../component/model/impl/RWikiEntityImpl.java | 6 +- .../model/impl/SHAHashMigration.java | 6 +- .../model/impl/SQLScriptMigration.java | 6 +- .../service/impl/RWikiBaseRenderEngine.java | 6 +- .../impl/RenderContextFactoryImpl.java | 6 +- .../service/impl/RenderEngineFactoryImpl.java | 6 +- .../service/impl/BaseFOPSerializer.java | 11 +- .../impl/RWikiEntityContentProducer.java | 6 +- .../service/impl/RWikiObjectServiceImpl.java | 6 +- .../impl/RWikiSecurityServiceImpl.java | 6 +- .../service/impl/RenderServiceImpl.java | 6 +- .../impl/SiteEmailNotificationRWiki.java | 13 +- .../service/impl/XSLTEntityHandler.java | 6 +- .../impl/test/XSLTEntityHandlerTest.java | 6 +- .../tool/ExcludeEscapeHtmlReference.java | 6 +- .../caret/sakai/rwiki/tool/RWikiServlet.java | 6 +- .../caret/sakai/rwiki/tool/RequestHelper.java | 6 +- .../rwiki/tool/RequestScopeSuperBean.java | 6 +- .../sakai/rwiki/tool/bean/FullSearchBean.java | 6 +- .../rwiki/tool/bean/PrePopulateBean.java | 6 +- .../rwiki/tool/bean/ResourceLoaderBean.java | 6 +- .../AuthZGroupCollectionBeanHelper.java | 7 +- .../bean/helper/MultiRealmEditBeanHelper.java | 7 +- .../helper/RecentlyVisitedHelperBean.java | 6 +- .../command/AddAttachmentReturnCommand.java | 6 +- .../rwiki/tool/command/BasicHttpCommand.java | 6 +- .../tool/command/EditAuthZGroupCommand.java | 6 +- .../command/EditManyAuthZGroupCommand.java | 6 +- .../rwiki/tool/command/HelperCommand.java | 6 +- .../rwiki/tool/command/RevertCommand.java | 8 +- .../sakai/rwiki/tool/command/SaveCommand.java | 6 +- .../command/UpdatePermissionsCommand.java | 6 +- .../command/UpdatePreferencesCommand.java | 6 +- .../DirectServletPageLinkRenderer.java | 6 +- .../entityproviders/RWikiEntityProvider.java | 6 +- .../tool/entityproviders/SparserPage.java | 6 +- .../tool/service/impl/CommandServiceImpl.java | 6 +- .../service/impl/PopulateServiceImpl.java | 6 +- .../service/impl/ToolRenderServiceImpl.java | 6 +- .../commons/jrcs/rcs/KeywordsFormat.java | 4 +- .../src/java/org/radeox/EngineManager.java | 6 +- .../org/radeox/engine/BaseRenderEngine.java | 6 +- .../java/org/radeox/filter/FilterPipe.java | 6 +- .../org/radeox/filter/LinkTestFilter.java | 6 +- .../java/org/radeox/filter/ListFilter.java | 8 +- .../java/org/radeox/filter/MacroFilter.java | 6 +- .../org/radeox/filter/ParagraphFilter.java | 10 +- .../java/org/radeox/filter/XHTMLFilter.java | 6 +- .../org/radeox/filter/balance/Balancer.java | 6 +- .../radeox/filter/interwiki/InterWiki.java | 6 +- .../regex/LocaleRegexReplaceFilter.java | 8 +- .../filter/regex/LocaleRegexTokenFilter.java | 6 +- .../org/radeox/filter/regex/RegexFilter.java | 6 +- .../filter/regex/RegexReplaceFilter.java | 8 +- .../radeox/filter/regex/RegexTokenFilter.java | 6 +- .../java/org/radeox/macro/ApiDocMacro.java | 6 +- .../src/java/org/radeox/macro/AsinMacro.java | 6 +- .../org/radeox/macro/BaseLocaleMacro.java | 8 +- .../src/java/org/radeox/macro/CodeMacro.java | 6 +- .../java/org/radeox/macro/FilePathMacro.java | 6 +- .../org/radeox/macro/LocalePreserved.java | 6 +- .../java/org/radeox/macro/MacroLoader.java | 6 +- .../org/radeox/macro/MacroRepository.java | 6 +- .../java/org/radeox/macro/MailToMacro.java | 6 +- .../java/org/radeox/macro/PluginLoader.java | 6 +- .../src/java/org/radeox/macro/QuoteMacro.java | 6 +- .../src/java/org/radeox/macro/api/ApiDoc.java | 6 +- .../radeox/macro/book/TextFileUrlMapper.java | 6 +- .../org/radeox/macro/table/AvgFunction.java | 6 +- .../radeox/macro/table/FunctionLoader.java | 6 +- .../org/radeox/macro/table/MaxFunction.java | 6 +- .../org/radeox/macro/table/MinFunction.java | 6 +- .../org/radeox/macro/table/SumFunction.java | 6 +- .../org/radeox/macro/xref/XrefMapper.java | 6 +- .../test/filter/balance/BalanceTest.java | 6 +- .../caret/sakai/rwiki/utils/NameHelper.java | 6 +- .../sakai/rwiki/utils/SimpleCoverage.java | 6 +- .../caret/sakai/rwiki/utils/TimeLogger.java | 6 +- .../data/dao/grading/ItemGradingData.java | 6 +- .../src/java/com/corejsf/UploadFilter.java | 6 +- .../src/java/com/corejsf/UploadRenderer.java | 6 +- .../jsf/renderer/RichTextEditArea.java | 6 +- .../sakaiproject/jsf/util/SamigoJsfTool.java | 6 +- .../tool/assessment/api/SamigoApiFactory.java | 6 +- .../assessment/api/spring/FactoryUtil.java | 6 +- .../tool/assessment/api/spring/SamigoApi.java | 6 +- .../questionpool/QuestionPoolTreeImpl.java | 6 +- .../jsf/renderer/PagerRenderer.java | 6 +- .../producers/BeginAssessmentProducer.java | 6 +- .../shared/impl/qti/QTIServiceImpl.java | 6 +- .../assessment/ui/bean/author/AnswerBean.java | 6 +- .../ui/bean/author/AssessmentBean.java | 6 +- .../bean/author/AssessmentSettingsBean.java | 8 +- .../assessment/ui/bean/author/AuthorBean.java | 6 +- .../ui/bean/author/EventLogBean.java | 8 +- .../assessment/ui/bean/author/IndexBean.java | 6 +- .../ui/bean/author/ItemAuthorBean.java | 8 +- .../assessment/ui/bean/author/ItemBean.java | 2 +- .../PublishRepublishNotificationBean.java | 6 +- .../bean/author/PublishedAssessmentBean.java | 6 +- .../author/PublishedAssessmentBeanie.java | 6 +- .../PublishedAssessmentSettingsBean.java | 6 +- .../ui/bean/author/SectionActivityBean.java | 6 +- .../ui/bean/author/SectionBean.java | 6 +- .../ui/bean/authz/AuthorizationBean.java | 6 +- .../ui/bean/delivery/DeliveryBean.java | 6 +- .../ui/bean/delivery/DeliveryBeanie.java | 6 +- .../ui/bean/delivery/ItemContentsBean.java | 6 +- .../ui/bean/delivery/SectionContentsBean.java | 6 +- .../ui/bean/delivery/SelectionBean.java | 8 +- .../ui/bean/evaluation/AgentResults.java | 6 +- .../DownloadFileSubmissionsBean.java | 6 +- .../bean/evaluation/ExportResponsesBean.java | 10 +- .../HistogramQuestionScoresBean.java | 6 +- .../bean/evaluation/QuestionScoresBean.java | 6 +- .../bean/evaluation/RetakeAssessmentBean.java | 168 +- .../ui/bean/evaluation/StudentScoresBean.java | 6 +- .../bean/evaluation/SubmissionStatusBean.java | 6 +- .../ui/bean/evaluation/TotalScoresBean.java | 6 +- .../ui/bean/print/PDFAssessmentBean.java | 25 +- .../assessment/ui/bean/qti/XMLController.java | 6 +- .../assessment/ui/bean/qti/XMLImportBean.java | 6 +- .../bean/questionpool/QuestionPoolBean.java | 6 +- .../questionpool/QuestionPoolDataBean.java | 6 +- .../questionpool/QuestionPoolShareBean.java | 536 +- .../ui/bean/samlite/SamLiteBean.java | 6 +- .../ui/bean/shared/BackingBean.java | 6 +- .../assessment/ui/bean/shared/PersonBean.java | 6 +- .../assessment/ui/bean/util/EmailBean.java | 640 +-- .../listener/author/ActionSelectListener.java | 6 +- .../listener/author/AuthorActionListener.java | 10 +- .../author/AuthorAssessmentListener.java | 6 +- .../listener/author/AuthorPartListener.java | 6 +- .../author/AuthorQuestionListener.java | 2 +- .../author/AuthorSettingsListener.java | 6 +- .../author/ChooseExportTypeListener.java | 104 +- .../ConfirmPublishAssessmentListener.java | 6 +- .../ConfirmRemoveAssessmentListener.java | 6 +- .../ConfirmRemoveAttachmentListener.java | 2 +- ...firmRemovePublishedAssessmentListener.java | 176 +- .../ConfirmRepublishAssessmentListener.java | 6 +- .../author/CopyAssessmentListener.java | 6 +- .../author/DeleteTemplateListener.java | 2 +- .../author/EditAssessmentListener.java | 6 +- .../ui/listener/author/EditPartListener.java | 2 +- ...EditPublishedQuestionPoolPartListener.java | 8 +- .../author/EditPublishedSettingsListener.java | 6 +- .../listener/author/EditTemplateListener.java | 6 +- .../ui/listener/author/EventLogListener.java | 6 +- .../author/EventLogNextPageListener.java | 8 +- .../author/EventLogPreviousPageListener.java | 8 +- .../author/ExportAssessmentListener.java | 6 +- .../listener/author/ExportItemListener.java | 6 +- .../author/FavoriteColChoiceListener.java | 6 +- .../author/ImportAssessmentListener.java | 6 +- .../ui/listener/author/ItemAddListener.java | 6 +- .../listener/author/ItemModifyListener.java | 6 +- .../PreviewPublishedAssessmentListener.java | 2 +- .../author/PublishAssessmentListener.java | 14 +- .../PublishRepublishNotificationListener.java | 6 +- .../author/RemoveAssessmentListener.java | 2 +- .../author/RemoveAttachmentListener.java | 2 +- .../listener/author/RemovePartListener.java | 2 +- .../RemovePublishedAssessmentListener.java | 6 +- .../RemovePublishedAssessmentThread.java | 6 +- .../author/RemoveQuestionListener.java | 2 +- .../listener/author/ReorderPartsListener.java | 6 +- .../author/ReorderQuestionsListener.java | 6 +- .../author/RepublishAssessmentListener.java | 8 +- .../ResetAssessmentAttachmentListener.java | 6 +- .../author/ResetItemAttachmentListener.java | 6 +- .../author/ResetPartAttachmentListener.java | 6 +- ...PublishedAssessmentAttachmentListener.java | 6 +- .../SaveAssessmentAttachmentListener.java | 6 +- .../author/SaveAssessmentSettings.java | 10 +- .../SaveAssessmentSettingsListener.java | 6 +- .../author/SavePartAttachmentListener.java | 6 +- .../ui/listener/author/SavePartListener.java | 6 +- .../author/SavePublishedSettingsListener.java | 10 +- .../author/SectionActivityListener.java | 8 +- .../author/SortCoreAssessmentListener.java | 6 +- ...rtInactivePublishedAssessmentListener.java | 6 +- .../SortPublishedAssessmentListener.java | 6 +- .../author/StartCreateItemListener.java | 6 +- .../author/StartInsertItemListener.java | 6 +- .../listener/author/TemplateBaseListener.java | 2 +- .../ui/listener/author/TemplateListener.java | 6 +- .../listener/author/TemplateLoadListener.java | 6 +- .../author/TemplateUpdateListener.java | 8 +- .../delivery/AudioUploadActionListener.java | 6 +- .../delivery/BeginDeliveryActionListener.java | 8 +- .../delivery/DeliveryActionListener.java | 6 +- .../LinearAccessDeliveryActionListener.java | 564 +-- .../delivery/ResetDeliveryListener.java | 6 +- .../delivery/ResultsActionListener.java | 124 +- .../delivery/SaCharCountListener.java | 6 +- .../delivery/ShowFeedbackActionListener.java | 6 +- .../SubmitToGradingActionListener.java | 9 +- .../TableOfContentsActionListener.java | 6 +- .../delivery/UpdateTimerFromTOCListener.java | 6 +- .../delivery/UpdateTimerListener.java | 6 +- .../ConfirmRetakeAssessmentListener.java | 114 +- .../DownloadFileSubmissionsListener.java | 6 +- .../evaluation/ExportResponsesListener.java | 100 +- .../evaluation/GrantSubmissionListener.java | 304 +- .../evaluation/HistogramListener.java | 6 +- .../evaluation/QuestionScoreListener.java | 1952 ++++---- .../QuestionScorePagerListener.java | 228 +- .../QuestionScoreUpdateListener.java | 6 +- .../ResetQuestionScoreListener.java | 6 +- .../evaluation/ResetTotalScoreListener.java | 6 +- .../evaluation/RetakeAssessmentListener.java | 122 +- .../StudentScoreAttachmentListener.java | 6 +- .../evaluation/StudentScoreListener.java | 6 +- .../StudentScoreUpdateListener.java | 6 +- .../evaluation/SubmissionStatusListener.java | 6 +- .../evaluation/TotalScoreListener.java | 6 +- .../evaluation/TotalScoreUpdateListener.java | 6 +- .../util/EvaluationListenerUtil.java | 6 +- .../CancelImportToAssessmentListener.java | 6 +- .../questionpool/CancelPoolListener.java | 6 +- .../ImportQuestionsToAuthoring.java | 2 +- .../questionpool/PoolSaveListener.java | 502 +- .../SortQuestionListListener.java | 6 +- .../StartRemoveItemsListener.java | 6 +- .../listener/samlite/AssessmentListener.java | 6 +- .../ui/listener/samlite/ParserListener.java | 15 +- .../listener/select/SelectActionListener.java | 6 +- .../select/SelectRecordedListener.java | 8 +- .../shared/ConfirmRemoveMediaListener.java | 2 +- .../listener/shared/RemoveMediaListener.java | 2 +- .../ui/listener/util/ContextUtil.java | 6 +- .../ui/listener/util/EmailListener.java | 6 +- .../assessment/ui/listener/util/TimeUtil.java | 6 +- .../delivery/SubmitTimedAssessmentThread.java | 6 +- .../queue/delivery/TimedAssessmentQueue.java | 6 +- .../assessment/ui/servlet/InitMimeTypes.java | 6 +- .../ui/servlet/StoreApplicationContext.java | 6 +- .../ui/servlet/cp/DownloadCPServlet.java | 424 +- .../delivery/DownloadAllMediaServlet.java | 934 ++-- .../ui/servlet/delivery/LoginServlet.java | 6 +- .../delivery/ShowAttachmentMediaServlet.java | 352 +- .../ui/servlet/delivery/ShowMediaServlet.java | 6 +- .../delivery/UploadAudioMediaServlet.java | 6 +- .../ui/servlet/qti/ShowQTIServlet.java | 6 +- .../assessment/ui/web/action/InitAction.java | 6 +- .../ui/web/session/SessionUtil.java | 6 +- .../tool/assessment/util/AttachmentUtil.java | 6 +- .../assessment/util/BeanSortComparator.java | 6 +- .../assessment/util/DownloadFileUtil.java | 6 +- .../assessment/util/SamigoEmailService.java | 758 +-- .../entity/helper/AuthoringHelperTest.java | 8 +- .../business/entity/helper/QTITester.java | 6 +- .../tool/assessment/jsf/TestWSBean.java | 6 +- .../FakeBeginDeliveryActionListener.java | 6 +- .../ui/listener/TestActionListener.java | 6 +- .../contentpackaging/ImportService.java | 356 +- .../assessment/contentpackaging/Manifest.java | 556 +-- .../contentpackaging/ManifestGenerator.java | 968 ++-- .../data/dao/assessment/AssessmentData.java | 6 +- .../assessment/PublishedAttachmentData.java | 6 +- ...gComparatorByScoreAndUniqueIdentifier.java | 6 +- .../handlers/SamigoAssessmentHandler.java | 6 +- .../impl/handlers/SamigoPoolHandler.java | 6 +- .../assessment/shared/SakaiBootStrap.java | 6 +- .../tool/assessment/qti/asi/ASIBaseClass.java | 6 +- .../tool/assessment/qti/asi/Assessment.java | 6 +- .../tool/assessment/qti/asi/Item.java | 6 +- .../tool/assessment/qti/asi/Section.java | 6 +- .../qti/helper/AttachmentHelper.java | 248 +- .../qti/helper/AuthoringHelper.java | 8 +- .../assessment/qti/helper/AuthoringXml.java | 6 +- .../qti/helper/ExtractionHelper.java | 16 +- .../assessment/qti/helper/MetaDataList.java | 6 +- .../assessment/AssessmentHelper12Impl.java | 6 +- .../assessment/AssessmentHelper20Impl.java | 6 +- .../assessment/AssessmentHelperBase.java | 6 +- .../qti/helper/item/ItemHelper12Impl.java | 6 +- .../qti/helper/item/ItemHelper20Impl.java | 6 +- .../qti/helper/item/ItemHelperBase.java | 6 +- .../item/ItemTypeExtractionStrategy.java | 6 +- .../helper/section/SectionHelper12Impl.java | 6 +- .../helper/section/SectionHelper20Impl.java | 6 +- .../qti/helper/section/SectionHelperBase.java | 6 +- .../qti/util/Iso8601DateFormat.java | 6 +- .../qti/util/Iso8601TimeInterval.java | 6 +- .../tool/assessment/qti/util/URIResolver.java | 8 +- .../tool/assessment/qti/util/XmlMapper.java | 8 +- .../assessment/qti/util/XmlStringBuffer.java | 6 +- .../tool/assessment/qti/util/XmlUtil.java | 8 +- .../assessment/services/qti/QTIService.java | 6 +- .../assessment/business/entity/FileNamer.java | 6 +- .../business/entity/RecordingData.java | 8 +- .../business/entity/SortableDate.java | 6 +- .../tool/assessment/facade/AgentFacade.java | 6 +- .../facade/AssessmentBaseFacade.java | 6 +- .../facade/AssessmentFacadeQueries.java | 6 +- .../AssessmentGradingFacadeQueries.java | 70 +- .../assessment/facade/EventLogFacade.java | 8 +- .../facade/EventLogFacadeQueries.java | 7 +- .../FavoriteColChoicesFacadeQueries.java | 6 +- .../assessment/facade/GradebookFacade.java | 6 +- .../tool/assessment/facade/ItemFacade.java | 6 +- .../assessment/facade/ItemFacadeQueries.java | 6 +- .../facade/PublishedAssessmentFacade.java | 6 +- .../PublishedAssessmentFacadeQueries.java | 7 +- .../facade/PublishedItemFacadeQueries.java | 7 +- .../facade/PublishedSectionFacade.java | 246 +- .../facade/PublishedSectionFacadeQueries.java | 6 +- .../assessment/facade/QuestionPoolFacade.java | 6 +- .../facade/QuestionPoolFacadeQueries.java | 8 +- .../tool/assessment/facade/SectionFacade.java | 6 +- .../facade/SectionFacadeQueries.java | 6 +- .../assessment/facade/TypeFacadeQueries.java | 6 +- .../authz/AuthorizationFacadeQueries.java | 6 +- .../facade/util/PagingUtilQueries.java | 6 +- .../context/IntegrationContextFactory.java | 8 +- .../context/spring/FactoryUtil.java | 6 +- .../context/spring/IntegrationContext.java | 6 +- .../integrated/AbstractSectionsImpl.java | 6 +- .../helper/integrated/AgentHelperImpl.java | 6 +- .../AssessmentGradeInfoProvider.java | 6 +- .../integrated/CalendarServiceHelperImpl.java | 38 +- .../helper/integrated/FacadeUtils.java | 6 +- .../integrated/GradebookHelperImpl.java | 8 +- .../GradebookServiceHelperImpl.java | 6 +- .../PublishingTargetHelperImpl.java | 6 +- .../SectionAwareServiceHelperImpl.java | 6 +- .../ServerConfigurationServiceHelperImpl.java | 6 +- .../assessment/impl/SectionIteratorImpl.java | 6 +- .../services/AutoSubmitAssessmentsJob.java | 6 +- .../assessment/services/GradingService.java | 178 +- .../tool/assessment/services/ItemService.java | 34 +- .../services/PersistenceHelper.java | 6 +- .../services/PersistenceService.java | 6 +- .../services/PublishedItemService.java | 124 +- .../services/QuestionPoolService.java | 73 +- .../assessment/services/SectionService.java | 9 +- .../assessment/AssessmentEntityProducer.java | 8 +- .../assessment/AssessmentService.java | 56 +- .../services/assessment/EventLogService.java | 8 +- .../PublishedAssessmentService.java | 32 +- .../gradebook/GradebookServiceHelper.java | 6 +- .../services/shared/MediaService.java | 6 +- .../services/shared/TypeService.java | 18 +- .../assessment/AssessmentServiceImpl.java | 6 +- .../impl/assessment/ItemServiceImpl.java | 6 +- .../PublishedAssessmentServiceImpl.java | 6 +- .../impl/assessment/SectionServiceImpl.java | 6 +- .../assessment/SecureDeliveryServiceImpl.java | 6 +- .../shared/impl/common/MediaServiceImpl.java | 6 +- .../shared/impl/common/TypeServiceImpl.java | 6 +- .../impl/grading/GradebookServiceImpl.java | 2 +- .../impl/grading/GradingServiceImpl.java | 6 +- .../questionpool/QuestionPoolServiceImpl.java | 6 +- .../util/MediaContentConverter.java | 6 +- .../tool/assessment/util/MimeType.java | 6 +- .../tool/assessment/util/TextFormat.java | 10 +- .../samlite/impl/SamLiteServiceImpl.java | 6 +- .../ElasticSearchIndexBuilder.java | 6 +- .../elasticsearch/ElasticSearchList.java | 8 +- .../elasticsearch/ElasticSearchResult.java | 6 +- .../elasticsearch/ElasticSearchService.java | 6 +- .../search/elasticsearch/RebuildSiteTask.java | 8 +- .../filter/impl/SearchSecurityFilter.java | 7 +- .../adapter/SearchIndexBuilderAdapter.java | 6 +- .../search/adapter/SearchServiceAdapter.java | 6 +- .../contenthosting/BaseContentDigester.java | 6 +- .../ContentHostingContentProducer.java | 18 +- .../DefaultContentDigester.java | 9 +- .../DefaultFullContentDigester.java | 11 +- .../contenthosting/HtmlContentDigester.java | 10 +- .../contenthosting/PDFContentDigester.java | 10 +- .../contenthosting/PPTContentDigester.java | 10 +- .../contenthosting/PoiContentDigester.java | 8 +- .../SanslanContentDigester.java | 6 +- .../contenthosting/TikaContentDigester.java | 8 +- .../contenthosting/XLContentDigester.java | 8 +- .../adapter/site/SiteContentProducer.java | 12 +- .../entitybroker/SearchProviderImpl.java | 6 +- .../search/tool/ControllerServlet.java | 6 +- .../search/tool/ControllerServlet2.java | 14 +- .../search/tool/RestSearchServlet.java | 6 +- .../search/tool/SearchBeanFactoryImpl.java | 6 +- .../search/tool/SearchBeanImpl.java | 12 +- .../sakaiproject/search/util/FileUtils.java | 6 +- .../sakaiproject/search/util/HTMLParser.java | 6 +- .../search/util/test/FileUtilsTest.java | 6 +- .../decorator/EnrollmentDecorator.java | 6 +- .../section/decorator/SectionDecorator.java | 6 +- .../decorator/StudentSectionDecorator.java | 6 +- .../section/jsf/HtmlSortHeaderRenderer.java | 7 +- .../tool/section/jsf/JsfUtil.java | 6 +- .../jsf/RowGroupDataTableRenderer.java | 270 +- .../tool/section/EntryServlet.java | 6 +- .../section/facade/sakai/AuthnSakaiImpl.java | 6 +- .../section/facade/sakai/AuthzSakaiImpl.java | 6 +- .../facade/sakai/ContextSakaiImpl.java | 6 +- .../tool/section/filter/AuthnFilter.java | 6 +- .../tool/section/filter/RoleFilter.java | 6 +- .../tool/section/jsf/DivMessageRenderer.java | 6 +- .../section/jsf/DivMessageRendererBase.java | 6 +- .../tool/section/jsf/DivMessagesRenderer.java | 6 +- .../tool/section/jsf/JsfTool.java | 6 +- .../jsf/backingbean/AddSectionsBean.java | 6 +- .../jsf/backingbean/CourseDependentBean.java | 6 +- .../jsf/backingbean/EditManagersBean.java | 6 +- .../jsf/backingbean/EditSectionBean.java | 6 +- .../backingbean/EditStudentSectionsBean.java | 6 +- .../jsf/backingbean/EditStudentsBean.java | 6 +- .../FilteredSectionListingBean.java | 6 +- .../jsf/backingbean/InitializableBean.java | 6 +- .../jsf/backingbean/LocalMeetingModel.java | 6 +- .../jsf/backingbean/LocalSectionModel.java | 6 +- .../section/jsf/backingbean/NavMenuBean.java | 6 +- .../section/jsf/backingbean/OptionsBean.java | 6 +- .../section/jsf/backingbean/OverviewBean.java | 6 +- .../section/jsf/backingbean/RosterBean.java | 6 +- .../jsf/backingbean/StudentViewBean.java | 6 +- .../sakaiproject/test/section/AuthzTest.java | 6 +- .../test/section/CourseManagerTest.java | 6 +- .../test/section/SectionAwarenessTest.java | 6 +- .../test/section/SectionManagerTest.java | 6 +- .../test/section/TimeConversionTest.java | 6 +- .../test/section/dataload/DataLoadTest.java | 6 +- .../section/dataload/GradebookDataLoader.java | 6 +- .../impl/BaseShortenedUrlService.java | 6 +- .../shortenedurl/impl/BitlyUrlService.java | 6 +- .../shortenedurl/impl/NoOpUrlService.java | 6 +- .../impl/RandomisedUrlService.java | 6 +- .../messages/SignupEventTrackingInfo.java | 244 +- .../signup/model/SignupAttachment.java | 6 +- .../signup/dao/SignupMeetingDaoImpl.java | 680 +-- .../signup/logic/SakaiFacadeImpl.java | 2934 +++++------ .../signup/logic/SignupCacheServiceImpl.java | 374 +- .../signup/logic/SignupEmailFacadeImpl.java | 1638 +++--- .../logic/SignupMeetingServiceImpl.java | 2294 ++++----- .../signup/logic/SignupNotifyJob.java | 6 +- .../signup/logic/messages/EmailDeliverer.java | 6 +- .../signup/tool/SignupServlet.java | 756 +-- .../downloadEvents/DownloadEventBean.java | 6 +- .../entityproviders/CopyFileProcessor.java | 304 +- .../entityproviders/EventProcessHandler.java | 6 +- .../entityproviders/SignupEntityProducer.java | 942 ++-- .../tool/jsf/HtmlSortHeaderRenderer.java | 215 +- .../signup/tool/jsf/NewSignupMeetingBean.java | 4396 ++++++++--------- .../signup/tool/jsf/SignupMeetingsBean.java | 2320 ++++----- .../tool/jsf/SignupPermissionsUpdateBean.java | 6 +- .../signup/tool/jsf/SignupUIBaseBean.java | 1956 ++++---- .../jsf/attachment/AttachmentHandler.java | 6 +- .../jsf/organizer/OrganizerSignupMBean.java | 2902 +++++------ .../jsf/organizer/action/RemoveWaiter.java | 350 +- .../jsf/organizer/action/SignupAction.java | 598 +-- .../signup/tool/util/Utilities.java | 1060 ++-- .../portal/portlets/rss/SimpleRSSPortlet.java | 4 +- .../site/tool/helper/order/rsf/ErrorUtil.java | 8 +- .../helper/siteAssoc/SiteAssociationBean.java | 7 +- .../tool/servlet/SiteAssocJsfTool.java | 6 +- .../impl/SiteManageGroupHandler.java | 10 +- .../managegroup/rsf/GroupDelProducer.java | 6 +- .../managegroup/rsf/GroupEditProducer.java | 6 +- .../managegroup/rsf/GroupListProducer.java | 6 +- .../impl/RoleGroupEventWatcher.java | 6 +- .../SiteManageGroupSectionRoleHandler.java | 18 +- .../rsf/CreateJoinableGroupsProducer.java | 6 +- .../rsf/GroupAutoCreateProducer.java | 6 +- .../rsf/GroupDelProducer.java | 6 +- .../rsf/GroupEditProducer.java | 6 +- .../rsf/GroupImportStep1Producer.java | 6 +- .../rsf/GroupImportStep2Producer.java | 6 +- .../rsf/GroupListProducer.java | 6 +- .../impl/AffiliatedSectionProviderImpl.java | 6 +- .../impl/ETSUserNotificationProviderImpl.java | 8 +- .../impl/SectionFieldProviderImpl.java | 6 +- .../impl/SiteSetupQuestionServiceImpl.java | 37 +- .../sitemanage/impl/SiteTypeProviderImpl.java | 6 +- .../impl/UserNotificationProviderImpl.java | 6 +- .../sakaiproject/site/tool/LinkAction.java | 6 +- .../impl/SiteAddParticipantHandler.java | 8 +- .../helper/participant/rsf/AddProducer.java | 6 +- .../participant/rsf/ConfirmProducer.java | 6 +- .../rsf/DifferentRoleProducer.java | 6 +- .../participant/rsf/EmailNotiProducer.java | 6 +- .../participant/rsf/SameRoleProducer.java | 6 +- .../site/tool/JoinableSiteSettings.java | 6 +- .../site/tool/MembershipAction.java | 18 +- .../sakaiproject/site/tool/SiteAction.java | 32 +- .../site/tool/SiteBrowserAction.java | 15 +- .../site/tool/SiteInfoToolServlet.java | 6 +- .../site/util/SiteComparator.java | 6 +- .../site/util/SiteParticipantHelper.java | 6 +- .../util/SiteSetupQuestionFileParser.java | 8 +- .../service/SitePermsService.java | 6 +- .../tool/ResourceLoaderMessageSource.java | 8 +- .../tool/SitePermsController.java | 6 +- .../mbm/tool/ResourceLoaderMessageSource.java | 8 +- .../site/tool/AdminSitesAction.java | 35 +- .../sitestats/impl/ConvOldPrefsJobImpl.java | 8 +- .../sakaiproject/sitestats/impl/DBHelper.java | 6 +- .../impl/ServerWideReportManagerImpl.java | 3262 ++++++------ .../sitestats/impl/StatsAggregateJobImpl.java | 6 +- .../sitestats/impl/StatsAuthzImpl.java | 6 +- .../sitestats/impl/StatsManagerImpl.java | 6 +- .../impl/StatsUpdateManagerImpl.java | 6 +- .../impl/chart/ChartServiceImpl.java | 6 +- .../impl/event/EntityBrokerEventRegistry.java | 6 +- .../impl/event/EventRegistryServiceImpl.java | 6 +- .../impl/event/FileEventRegistry.java | 6 +- .../impl/report/ReportDefEntityProvider.java | 6 +- .../impl/report/ReportManagerImpl.java | 6 +- .../impl/report/fop/LibraryURIResolver.java | 6 +- .../test/EventAggregatorTestPerf.java | 6 +- .../sitestats/test/data/FakeDataPreload.java | 6 +- .../SiteStatsEntityProvider.java | 6 +- .../wicket/components/AjaxLazyLoadImage.java | 6 +- .../tool/wicket/models/SiteModel.java | 6 +- .../tool/wicket/pages/ReportDataPage.java | 1480 +++--- .../tool/wicket/pages/ReportsEditPage.java | 8 +- .../tool/wicket/pages/ReportsPage.java | 632 +-- .../wicket/providers/ReportDefsProvider.java | 6 +- .../wicket/providers/ReportsDataProvider.java | 8 +- .../tool/wicket/widget/ActivityWidget.java | 6 +- .../tool/wicket/widget/LessonsWidget.java | 6 +- .../tool/wicket/widget/ResourcesWidget.java | 6 +- .../tool/wicket/widget/VisitsWidget.java | 6 +- .../tool/wicket/widget/WidgetTabTemplate.java | 6 +- .../tool/syllabus/SyllabusTool.java | 11 +- .../FixPublicSyllabusAttachmentsJob.java | 6 +- .../app/syllabus/SyllabusServiceImpl.java | 18 +- .../taggable/impl/TaggingManagerImpl.java | 7 +- .../connector/fck/ConnectorHelper.java | 6 +- .../connector/fck/FCKConnectorServlet.java | 6 +- .../AssignmentSiteVolumeFactory.java | 6 +- .../content/ContentSiteVolumeFactory.java | 6 +- .../java/org/sakaiproject/tool/su/SuTool.java | 6 +- .../user/tool/AdminPrefsTool.java | 6 +- .../sakaiproject/user/tool/PrivacyBean.java | 6 +- .../sakaiproject/user/tool/UserPrefsTool.java | 6 +- .../tool/entity/UserPrefsEntityProvider.java | 6 +- .../sakaiproject/user/tool/UsersAction.java | 50 +- .../tool/UserAuditEventLog.java | 12 +- .../util/UserAuditJsfTool.java | 6 +- .../util/UserAuditRegistrationUtil.java | 6 +- .../org/sakaiproject/umem/impl/AuthzImpl.java | 6 +- .../umem/tool/jsf/HtmlSortHeaderRenderer.java | 6 +- .../org/sakaiproject/umem/tool/ui/Export.java | 6 +- .../umem/tool/ui/SiteListBean.java | 6 +- .../umem/tool/ui/UserListBean.java | 6 +- .../cheftool/ControllerState.java | 2 +- .../cheftool/NewPagedResourceAction.java | 10 +- .../cheftool/PagedResourceAction.java | 8 +- .../cheftool/PagedResourceActionII.java | 8 +- .../cheftool/PagedResourceHelperAction.java | 8 +- .../sakaiproject/cheftool/ToolServlet.java | 6 +- .../VelocityPortletPaneledAction.java | 72 +- .../cheftool/VelocityPortletStateAction.java | 11 +- .../sakaiproject/web/impl/WebServiceImpl.java | 6 +- .../portlet/util/VelocityHelper.java | 6 +- .../sakaiproject/portlets/PortletIFrame.java | 6 +- .../sakaiproject/web/tool/IFrameAction.java | 6 +- .../sakaiproject/webservices/Activity.java | 6 +- .../sakaiproject/webservices/Assignments.java | 6 +- .../webservices/ContentHosting.java | 8 +- .../webservices/MessageForums.java | 6 +- .../webservices/SakaiConfiguration.java | 8 +- .../webservices/SakaiGradebook.java | 6 +- .../sakaiproject/webservices/SakaiJob.java | 6 +- .../sakaiproject/webservices/SakaiLogin.java | 6 +- .../webservices/SakaiPortalLogin.java | 6 +- .../sakaiproject/webservices/SakaiReport.java | 6 +- .../sakaiproject/webservices/SakaiScript.java | 6 +- .../webservices/ShortenedUrl.java | 6 +- .../webservices/TestsAndQuizzes.java | 6 +- ...criptAddMemberToSiteWithRoleBatchTest.java | 4 +- ...SakaiScriptChangeSiteMemberStatusTest.java | 4 +- ...aiScriptRemoveMemberFromSiteBatchTest.java | 4 +- .../SakaiScriptSetUserPropertyTest.java | 4 +- .../SakaiScriptSetUserTimeZoneTest.java | 4 +- 1492 files changed, 26936 insertions(+), 27654 deletions(-) rename cloud-content/impl/src/main/java/coza/opencollab/sakai/cloudcontent/{Logger.java => CommonLogger.java} (97%) diff --git a/access/access-impl/impl/src/java/org/sakaiproject/access/tool/AccessServlet.java b/access/access-impl/impl/src/java/org/sakaiproject/access/tool/AccessServlet.java index 587686bebf0a..dfe0590aceab 100644 --- a/access/access-impl/impl/src/java/org/sakaiproject/access/tool/AccessServlet.java +++ b/access/access-impl/impl/src/java/org/sakaiproject/access/tool/AccessServlet.java @@ -32,8 +32,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.SecurityAdvisor; import org.sakaiproject.authz.api.SecurityService; import org.sakaiproject.cheftool.VmServlet; @@ -74,7 +74,7 @@ public class AccessServlet extends VmServlet { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(AccessServlet.class); + private static Logger M_log = LoggerFactory.getLogger(AccessServlet.class); /** Resource bundle using current language locale */ protected static ResourceLoader rb = new ResourceLoader("access"); diff --git a/access/access-impl/impl/src/java/org/sakaiproject/access/tool/WebServlet.java b/access/access-impl/impl/src/java/org/sakaiproject/access/tool/WebServlet.java index 6d7ee87ab637..4d4bdcd6a162 100644 --- a/access/access-impl/impl/src/java/org/sakaiproject/access/tool/WebServlet.java +++ b/access/access-impl/impl/src/java/org/sakaiproject/access/tool/WebServlet.java @@ -31,8 +31,8 @@ import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileUpload; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.content.api.ContentCollection; import org.sakaiproject.content.api.ContentHostingService; @@ -62,7 +62,7 @@ public class WebServlet extends AccessServlet { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(WebServlet.class); + private static Logger M_log = LoggerFactory.getLogger(WebServlet.class); protected ContentHostingService contentHostingService; protected UserDirectoryService userDirectoryService; protected TimeService timeService; diff --git a/alias/alias-tool/tool/src/java/org/sakaiproject/alias/tool/AliasesAction.java b/alias/alias-tool/tool/src/java/org/sakaiproject/alias/tool/AliasesAction.java index b184d5197ed8..786c86d71030 100644 --- a/alias/alias-tool/tool/src/java/org/sakaiproject/alias/tool/AliasesAction.java +++ b/alias/alias-tool/tool/src/java/org/sakaiproject/alias/tool/AliasesAction.java @@ -27,6 +27,7 @@ import java.util.Iterator; import java.util.List; +import lombok.extern.slf4j.Slf4j; import org.sakaiproject.alias.api.AliasEdit; import org.sakaiproject.alias.api.AliasService; import org.sakaiproject.authz.api.SecurityService; @@ -55,6 +56,7 @@ * AliasesAction is the Sakai aliases editor. *

*/ +@Slf4j public class AliasesAction extends PagedResourceActionII { private static final long serialVersionUID = -5477742481219305334L; @@ -143,7 +145,7 @@ else if (mode.equals("confirm")) } else { - Log.warn("chef", "AliasesAction: mode: " + mode); + log.warn("mode: {}", mode); template = buildListContext(state, context); } @@ -305,7 +307,7 @@ public void doEdit(RunData data, Context context) } catch (IdUnusedException e) { - Log.warn("chef", "AliasesAction.doEdit: alias not found: " + id); + log.warn("alias not found: {}", id); addAlert(state, rb.getFormattedMessage("alias.notfound", new Object[]{id})); state.removeAttribute("mode"); diff --git a/announcement/announcement-impl/impl/src/java/org/sakaiproject/announcement/impl/BaseAnnouncementService.java b/announcement/announcement-impl/impl/src/java/org/sakaiproject/announcement/impl/BaseAnnouncementService.java index 688d55098d09..5b856c1e8372 100644 --- a/announcement/announcement-impl/impl/src/java/org/sakaiproject/announcement/impl/BaseAnnouncementService.java +++ b/announcement/announcement-impl/impl/src/java/org/sakaiproject/announcement/impl/BaseAnnouncementService.java @@ -47,8 +47,8 @@ import javax.xml.transform.stream.StreamResult; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.alias.api.Alias; import org.sakaiproject.alias.api.AliasService; import org.sakaiproject.announcement.api.AnnouncementChannel; @@ -110,7 +110,7 @@ public abstract class BaseAnnouncementService extends BaseMessage implements Ann EntityTransferrer, EntityTransferrerRefMigrator { /** Our logger. */ - private static Log M_log = LogFactory.getLog(BaseAnnouncementService.class); + private static Logger M_log = LoggerFactory.getLogger(BaseAnnouncementService.class); /** private constants definitions */ private final static String SAKAI_ANNOUNCEMENT_TOOL_ID = "sakai.announcements"; @@ -1668,7 +1668,7 @@ private void setMessageUnreleasedMax(int currentMax) { } } } catch (PermissionException ex) { - M_log.error(ex); + M_log.error(ex.getMessage()); } } @@ -1689,7 +1689,7 @@ private int setMessageOrderMax(MessageEdit msg) { } msg.getHeaderEdit().setMessage_order(++currentMax); } catch (PermissionException ex) { - M_log.error(ex); + M_log.error(ex.getMessage()); } return currentMax; } diff --git a/announcement/announcement-impl/impl/src/java/org/sakaiproject/announcement/impl/DbAnnouncementService.java b/announcement/announcement-impl/impl/src/java/org/sakaiproject/announcement/impl/DbAnnouncementService.java index 5d0389311d93..9f4a835b62de 100644 --- a/announcement/announcement-impl/impl/src/java/org/sakaiproject/announcement/impl/DbAnnouncementService.java +++ b/announcement/announcement-impl/impl/src/java/org/sakaiproject/announcement/impl/DbAnnouncementService.java @@ -27,8 +27,8 @@ import java.util.List; import java.util.Stack; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroup; import org.sakaiproject.authz.api.GroupNotDefinedException; import org.sakaiproject.authz.api.Role; @@ -60,7 +60,7 @@ public class DbAnnouncementService extends BaseAnnouncementService { /** Our logger. */ - private static Log M_log = LogFactory.getLog(DbAnnouncementService.class); + private static Logger M_log = LoggerFactory.getLogger(DbAnnouncementService.class); /** The name of the db table holding announcement channels. */ protected String m_cTableName = "ANNOUNCEMENT_CHANNEL"; diff --git a/announcement/announcement-impl/impl/src/java/org/sakaiproject/announcement/impl/SiteEmailNotificationAnnc.java b/announcement/announcement-impl/impl/src/java/org/sakaiproject/announcement/impl/SiteEmailNotificationAnnc.java index 64e8262b7149..151ab19cdb5e 100644 --- a/announcement/announcement-impl/impl/src/java/org/sakaiproject/announcement/impl/SiteEmailNotificationAnnc.java +++ b/announcement/announcement-impl/impl/src/java/org/sakaiproject/announcement/impl/SiteEmailNotificationAnnc.java @@ -25,8 +25,8 @@ import java.util.Iterator; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.announcement.api.AnnouncementChannel; import org.sakaiproject.announcement.api.AnnouncementMessage; import org.sakaiproject.announcement.api.AnnouncementMessageEdit; @@ -73,7 +73,7 @@ public class SiteEmailNotificationAnnc extends SiteEmailNotification private static final String PORTLET_CONFIG_PARM_MERGED_CHANNELS = "mergedAnnouncementChannels"; /** Our logger. */ - private static Log M_log = LogFactory.getLog(SiteEmailNotificationAnnc.class); + private static Logger M_log = LoggerFactory.getLogger(SiteEmailNotificationAnnc.class); private EntityManager entityManager; private SecurityService securityService; diff --git a/announcement/announcement-tool/tool/src/java/org/sakaiproject/announcement/entityprovider/AnnouncementEntityProviderImpl.java b/announcement/announcement-tool/tool/src/java/org/sakaiproject/announcement/entityprovider/AnnouncementEntityProviderImpl.java index a27829b4d066..fb1cac3a3d9d 100644 --- a/announcement/announcement-tool/tool/src/java/org/sakaiproject/announcement/entityprovider/AnnouncementEntityProviderImpl.java +++ b/announcement/announcement-tool/tool/src/java/org/sakaiproject/announcement/entityprovider/AnnouncementEntityProviderImpl.java @@ -36,8 +36,8 @@ import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.math.NumberUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.announcement.api.AnnouncementChannel; import org.sakaiproject.announcement.api.AnnouncementMessage; import org.sakaiproject.announcement.api.AnnouncementMessageHeader; @@ -92,7 +92,7 @@ public class AnnouncementEntityProviderImpl extends AbstractEntityProvider imple private static final String MOTD_CHANNEL_SUFFIX = "motd"; public static int DEFAULT_NUM_ANNOUNCEMENTS = 3; public static int DEFAULT_DAYS_IN_PAST = 10; - private static final Log log = LogFactory.getLog(AnnouncementEntityProviderImpl.class); + private static final Logger log = LoggerFactory.getLogger(AnnouncementEntityProviderImpl.class); private static ResourceLoader rb = new ResourceLoader("announcement"); /** diff --git a/announcement/announcement-tool/tool/src/java/org/sakaiproject/announcement/tool/AnnouncementAction.java b/announcement/announcement-tool/tool/src/java/org/sakaiproject/announcement/tool/AnnouncementAction.java index 95a8da8d3748..db3998939b08 100644 --- a/announcement/announcement-tool/tool/src/java/org/sakaiproject/announcement/tool/AnnouncementAction.java +++ b/announcement/announcement-tool/tool/src/java/org/sakaiproject/announcement/tool/AnnouncementAction.java @@ -39,8 +39,8 @@ import java.text.RuleBasedCollator; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.announcement.api.AnnouncementChannel; import org.sakaiproject.announcement.api.AnnouncementChannelEdit; import org.sakaiproject.announcement.api.AnnouncementMessage; @@ -126,7 +126,7 @@ public class AnnouncementAction extends PagedResourceActionII { /** Our logger. */ - private static Log M_log = LogFactory.getLog(AnnouncementAction.class); + private static Logger M_log = LoggerFactory.getLogger(AnnouncementAction.class); /** Resource bundle using current language locale */ private static ResourceLoader rb = new ResourceLoader("announcement"); @@ -1171,10 +1171,8 @@ else if (view.equals(VIEW_MODE_PUBLIC)) menu_new = channel.allowAddMessage(); menu_delete = channel.allowRemoveMessage(message); menu_revise = channel.allowEditMessage(message.getId()); - } catch (IdUnusedException e) { - M_log.error(e); - } catch (PermissionException e) { - M_log.error(e); + } catch (IdUnusedException | PermissionException e) { + M_log.error(e.getMessage()); } } @@ -1940,7 +1938,7 @@ protected String buildPreviewContext(VelocityPortlet portlet, Context context, R context.put("annToGroups", allGroupString); } catch (IdUnusedException e1) { - M_log.error(e1); + M_log.error(e1.getMessage()); } } @@ -4868,10 +4866,8 @@ public void doReorderUpdate(RunData rundata, Context context) messageOrder++; } } - } catch (PermissionException e1) { - M_log.error(e1); - } catch (IdUnusedException e1) { - M_log.error(e1); + } catch (PermissionException | IdUnusedException e1) { + M_log.error(e1.getMessage()); } } } diff --git a/archive/archive-tool/tool/src/java/org/sakaiproject/archive/tool/ArchiveAction.java b/archive/archive-tool/tool/src/java/org/sakaiproject/archive/tool/ArchiveAction.java index 19cc7c3fa862..cccbf637ef06 100644 --- a/archive/archive-tool/tool/src/java/org/sakaiproject/archive/tool/ArchiveAction.java +++ b/archive/archive-tool/tool/src/java/org/sakaiproject/archive/tool/ArchiveAction.java @@ -24,8 +24,8 @@ import org.apache.commons.io.FileUtils; import org.apache.commons.io.filefilter.SuffixFileFilter; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.archive.api.ArchiveService; import org.sakaiproject.archive.tool.model.SparseFile; import org.sakaiproject.archive.tool.model.SparseSite; @@ -89,7 +89,7 @@ public class ArchiveAction private SecurityService securityService; private IdManager idManager; - private static final Log log = LogFactory.getLog(ArchiveAction.class); + private static final Logger log = LoggerFactory.getLogger(ArchiveAction.class); // for batch archive private long batchArchiveStarted = 0; diff --git a/archive/import-handlers/announcement-handlers/src/java/org/sakaiproject/importer/impl/handlers/AnnouncementHandler.java b/archive/import-handlers/announcement-handlers/src/java/org/sakaiproject/importer/impl/handlers/AnnouncementHandler.java index 29515686a3da..ef242e51196c 100644 --- a/archive/import-handlers/announcement-handlers/src/java/org/sakaiproject/importer/impl/handlers/AnnouncementHandler.java +++ b/archive/import-handlers/announcement-handlers/src/java/org/sakaiproject/importer/impl/handlers/AnnouncementHandler.java @@ -17,8 +17,8 @@ package org.sakaiproject.importer.impl.handlers; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.announcement.api.AnnouncementChannel; import org.sakaiproject.announcement.api.AnnouncementService; @@ -38,7 +38,7 @@ */ public class AnnouncementHandler implements HandlesImportable { - private static Log log = LogFactory.getLog(AnnouncementHandler.class); + private static Logger log = LoggerFactory.getLogger(AnnouncementHandler.class); protected AnnouncementService announcementService = null; diff --git a/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/AssignmentGradeInfoProvider.java b/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/AssignmentGradeInfoProvider.java index ec486210d2c9..c09ff68528ae 100644 --- a/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/AssignmentGradeInfoProvider.java +++ b/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/AssignmentGradeInfoProvider.java @@ -28,8 +28,8 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.assignment.api.Assignment; import org.sakaiproject.assignment.api.AssignmentService; @@ -51,7 +51,7 @@ public class AssignmentGradeInfoProvider implements ExternalAssignmentProvider, ExternalAssignmentProviderCompat { - private Log log = LogFactory.getLog(AssignmentGradeInfoProvider.class); + private Logger log = LoggerFactory.getLogger(AssignmentGradeInfoProvider.class); // Sakai Service Beans private AssignmentService assignmentService; diff --git a/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/AssignmentPeerAssessmentServiceImpl.java b/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/AssignmentPeerAssessmentServiceImpl.java index af8dc2c71516..55f8e3aaa49c 100644 --- a/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/AssignmentPeerAssessmentServiceImpl.java +++ b/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/AssignmentPeerAssessmentServiceImpl.java @@ -10,8 +10,8 @@ import java.util.Map; import java.util.Map.Entry; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.HibernateException; import org.hibernate.Query; import org.hibernate.Session; @@ -41,7 +41,7 @@ import org.springframework.orm.hibernate3.support.HibernateDaoSupport; public class AssignmentPeerAssessmentServiceImpl extends HibernateDaoSupport implements AssignmentPeerAssessmentService { - private static Log log = LogFactory.getLog(AssignmentPeerAssessmentServiceImpl.class); + private static Logger log = LoggerFactory.getLogger(AssignmentPeerAssessmentServiceImpl.class); private ScheduledInvocationManager scheduledInvocationManager; private TimeService timeService; protected AssignmentService assignmentService; diff --git a/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/AssignmentSupplementItemServiceImpl.java b/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/AssignmentSupplementItemServiceImpl.java index eae3b8fc527c..86fcbe7401f4 100644 --- a/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/AssignmentSupplementItemServiceImpl.java +++ b/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/AssignmentSupplementItemServiceImpl.java @@ -29,8 +29,8 @@ import org.sakaiproject.time.cover.TimeService; import java.sql.SQLException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.assignment.api.AssignmentConstants; import org.sakaiproject.assignment.api.AssignmentSubmission; import org.sakaiproject.assignment.api.Assignment; @@ -57,14 +57,14 @@ public class AssignmentSupplementItemServiceImpl extends HibernateDaoSupport implements AssignmentSupplementItemService { - private final static Log Log = LogFactory.getLog(AssignmentSupplementItemServiceImpl.class); + private final static Logger Logger = LoggerFactory.getLogger(AssignmentSupplementItemServiceImpl.class); /** * Init */ public void init() { - Log.info("init()"); + Logger.info("init()"); } /** @@ -72,7 +72,7 @@ public void init() */ public void destroy() { - Log.info("destroy()"); + Logger.info("destroy()"); } /** Dependency: UserDirectoryService */ @@ -150,7 +150,7 @@ public boolean saveAttachment(AssignmentSupplementItemAttachment attachment) catch (DataAccessException e) { e.printStackTrace(); - Log.warn(this + ".saveModelAnswerQuestion() Hibernate could not save attachment " + attachment.getId()); + Logger.warn(this + ".saveModelAnswerQuestion() Hibernate could not save attachment " + attachment.getId()); return false; } } @@ -205,7 +205,7 @@ public boolean removeAttachment(AssignmentSupplementItemAttachment attachment) catch (DataAccessException e) { e.printStackTrace(); - Log.warn(this + ".removeAttachment() Hibernate could not delete attachment " + attachment.getId()); + Logger.warn(this + ".removeAttachment() Hibernate could not delete attachment " + attachment.getId()); return false; } } @@ -232,7 +232,7 @@ public boolean saveModelAnswer(AssignmentModelAnswerItem mItem) catch (DataAccessException e) { e.printStackTrace(); - Log.warn(this + ".saveModelAnswerQuestion() Hibernate could not save model answer for assignment " + mItem.getAssignmentId()); + Logger.warn(this + ".saveModelAnswerQuestion() Hibernate could not save model answer for assignment " + mItem.getAssignmentId()); return false; } } @@ -251,7 +251,7 @@ public boolean removeModelAnswer(AssignmentModelAnswerItem mItem) catch (DataAccessException e) { e.printStackTrace(); - Log.warn(this + ".removeModelAnswer() Hibernate could not delete ModelAnswer for assignment " + mItem.getAssignmentId()); + Logger.warn(this + ".removeModelAnswer() Hibernate could not delete ModelAnswer for assignment " + mItem.getAssignmentId()); return false; } @@ -292,7 +292,7 @@ public boolean saveNoteItem(AssignmentNoteItem nItem) catch (DataAccessException e) { e.printStackTrace(); - Log.warn(this + ".saveNoteItem() Hibernate could not save private note for assignment " + nItem.getAssignmentId()); + Logger.warn(this + ".saveNoteItem() Hibernate could not save private note for assignment " + nItem.getAssignmentId()); return false; } } @@ -311,7 +311,7 @@ public boolean removeNoteItem(AssignmentNoteItem mItem) catch (DataAccessException e) { e.printStackTrace(); - Log.warn(this + ".removeNoteItem() Hibernate could not delete NoteItem for assignment " + mItem.getAssignmentId()); + Logger.warn(this + ".removeNoteItem() Hibernate could not delete NoteItem for assignment " + mItem.getAssignmentId()); return false; } @@ -353,7 +353,7 @@ public boolean saveAllPurposeItem(AssignmentAllPurposeItem nItem) catch (DataAccessException e) { e.printStackTrace(); - Log.warn(this + ".saveAllPurposeItem() Hibernate could not save private AllPurpose for assignment " + nItem.getAssignmentId()); + Logger.warn(this + ".saveAllPurposeItem() Hibernate could not save private AllPurpose for assignment " + nItem.getAssignmentId()); return false; } } @@ -372,7 +372,7 @@ public boolean removeAllPurposeItem(AssignmentAllPurposeItem mItem) catch (DataAccessException e) { e.printStackTrace(); - Log.warn(this + ".removeAllPurposeItem() Hibernate could not delete AllPurposeItem for assignment " + mItem.getAssignmentId()); + Logger.warn(this + ".removeAllPurposeItem() Hibernate could not delete AllPurposeItem for assignment " + mItem.getAssignmentId()); return false; } @@ -430,7 +430,7 @@ public boolean saveAllPurposeItemAccess(AssignmentAllPurposeItemAccess access) catch (DataAccessException e) { e.printStackTrace(); - Log.warn(this + ".saveAllPurposeItemAccess() Hibernate could not save access " + access.getAccess() + " for " + access.getAssignmentAllPurposeItem().getTitle()); + Logger.warn(this + ".saveAllPurposeItemAccess() Hibernate could not save access " + access.getAccess() + " for " + access.getAssignmentAllPurposeItem().getTitle()); return false; } } @@ -449,7 +449,7 @@ public boolean removeAllPurposeItemAccess(AssignmentAllPurposeItemAccess access) catch (DataAccessException e) { e.printStackTrace(); - Log.warn(this + ".removeAllPurposeItemAccess() Hibernate could not delete access for all purpose item " + access.getAssignmentAllPurposeItem().getId() + " for access" + access.getAccess()); + Logger.warn(this + ".removeAllPurposeItemAccess() Hibernate could not delete access for all purpose item " + access.getAssignmentAllPurposeItem().getId() + " for access" + access.getAccess()); return false; } } @@ -659,7 +659,7 @@ else if (now != null) } catch (Exception e) { - Log.warn(this + ".callViewAllPurposeItem() Hibernate cannot access user role for user id= " + u.getId()); + Logger.warn(this + ".callViewAllPurposeItem() Hibernate cannot access user role for user id= " + u.getId()); return rv; } diff --git a/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/BaseAssignmentService.java b/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/BaseAssignmentService.java index 20e7711a2e8b..b1abbfa04ee8 100644 --- a/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/BaseAssignmentService.java +++ b/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/BaseAssignmentService.java @@ -26,8 +26,8 @@ import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.math.NumberUtils; import org.apache.commons.lang.exception.ExceptionUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.poi.hssf.usermodel.*; import org.apache.poi.ss.util.WorkbookUtil; import org.sakaiproject.announcement.api.AnnouncementChannel; @@ -118,7 +118,7 @@ public abstract class BaseAssignmentService implements AssignmentService, EntityTransferrer, EntityTransferrerRefMigrator { /** Our logger. */ - private static Log M_log = LogFactory.getLog(BaseAssignmentService.class); + private static Logger M_log = LoggerFactory.getLogger(BaseAssignmentService.class); /** the resource bundle */ private static ResourceLoader rb = new ResourceLoader("assignment"); @@ -3501,17 +3501,15 @@ public AssignmentSubmission getSubmission(String assignmentReference, User perso } } else { - M_log.info("Assignmentt" +a.getId() + " is grouped but " + person.getId() + " is not in any of the site groups"); + M_log.info("Assignment {} is grouped but {} is not in any of the site groups", a.getId(), person.getId()); } } - } catch (IdUnusedException iue) { - M_log.debug(iue); - } catch (PermissionException pme) { - M_log.debug(pme); + } catch (IdUnusedException | PermissionException e) { + M_log.debug(e.getMessage()); } } - M_log.debug("No submission found for user " + person.getId() + " in assignment " + assignmentReference); + M_log.debug("No submission found for user {} in assignment {}", person.getId(), assignmentReference); return submission; } @@ -3549,7 +3547,7 @@ public AssignmentSubmission getSubmission(String assignmentReference, String sub } catch (PermissionException e) { - M_log.debug(e); + M_log.debug(e.getMessage()); return null; } } @@ -3571,12 +3569,11 @@ public AssignmentSubmission getSubmission(List submissions, User person) { for (String userId : sub.getSubmitterIds()) { - M_log.debug(this + " getSubmission(List, User) comparing aUser id : " + userId + " and chosen user id : " - + person.getId()); + M_log.debug("getSubmission(List, User) comparing aUser id : {} and chosen user id : {}", + userId, person.getId()); if (userId.equals(person.getId())) { - - M_log.debug(this + " getSubmission(List, User) found a match : return value is " + sub.getId()); + M_log.debug("getSubmission(List, User) found a match : return value is {}", sub.getId()); retVal = sub; } } @@ -12620,7 +12617,7 @@ public void postAttachment(List attachments){ } else { - // error, assignment couldn't be found. Log the error + // error, assignment couldn't be found. Logger the error M_log.debug(this + " BaseAssignmentSubmissionEdit postAttachment: Unable to find assignment associated with submission id= " + this.m_id + " and assignment id=" + this.m_assignment); } } diff --git a/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/DbAssignmentService.java b/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/DbAssignmentService.java index d2f219db18d1..6c9c90b5719e 100644 --- a/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/DbAssignmentService.java +++ b/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/DbAssignmentService.java @@ -28,8 +28,8 @@ import java.util.Iterator; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.assignment.api.Assignment; import org.sakaiproject.assignment.api.AssignmentContent; import org.sakaiproject.assignment.api.AssignmentContentEdit; @@ -57,7 +57,7 @@ public class DbAssignmentService extends BaseAssignmentService { /** Our logger. */ - private static Log M_log = LogFactory.getLog(DbAssignmentService.class); + private static Logger M_log = LoggerFactory.getLogger(DbAssignmentService.class); /** The name of the db table holding assignment objects. */ protected String m_assignmentsTableName = "ASSIGNMENT_ASSIGNMENT"; diff --git a/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/conversion/impl/AssignmentSubmissionAccess.java b/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/conversion/impl/AssignmentSubmissionAccess.java index 476a5e64b5a5..9a7b495ba154 100644 --- a/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/conversion/impl/AssignmentSubmissionAccess.java +++ b/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/conversion/impl/AssignmentSubmissionAccess.java @@ -33,8 +33,8 @@ import javax.xml.parsers.SAXParserFactory; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.assignment.api.AssignmentConstants; import org.sakaiproject.assignment.impl.conversion.api.SerializableSubmissionAccess; import org.sakaiproject.assignment.impl.conversion.impl.SAXSerializablePropertiesAccess; @@ -55,8 +55,7 @@ public class AssignmentSubmissionAccess implements SerializableSubmissionAccess, SerializableEntity { - protected static final Log log = LogFactory - .getLog(AssignmentSubmissionAccess.class); + protected static final Logger log = LoggerFactory.getLogger(AssignmentSubmissionAccess.class); private SAXParserFactory parserFactory; protected SAXSerializablePropertiesAccess saxSerializableProperties = new SAXSerializablePropertiesAccess(); diff --git a/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/conversion/impl/CombineDuplicateSubmissionsConversionHandler.java b/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/conversion/impl/CombineDuplicateSubmissionsConversionHandler.java index 76cd829b7567..152080aabc9d 100644 --- a/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/conversion/impl/CombineDuplicateSubmissionsConversionHandler.java +++ b/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/conversion/impl/CombineDuplicateSubmissionsConversionHandler.java @@ -34,8 +34,8 @@ import java.util.TreeSet; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.util.conversion.SchemaConversionHandler; import org.sakaiproject.entity.cover.EntityManager; @@ -44,7 +44,7 @@ public class CombineDuplicateSubmissionsConversionHandler implements SchemaConversionHandler { - private static final Log log = LogFactory.getLog(CombineDuplicateSubmissionsConversionHandler.class); + private static final Logger log = LoggerFactory.getLogger(CombineDuplicateSubmissionsConversionHandler.class); // db driver private String m_dbDriver = null; diff --git a/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/conversion/impl/SubmitterIdAssignmentsConversionHandler.java b/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/conversion/impl/SubmitterIdAssignmentsConversionHandler.java index babf80c62b06..ec449521693b 100644 --- a/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/conversion/impl/SubmitterIdAssignmentsConversionHandler.java +++ b/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/conversion/impl/SubmitterIdAssignmentsConversionHandler.java @@ -26,8 +26,8 @@ import java.sql.SQLException; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.util.conversion.SchemaConversionHandler; /** @@ -38,8 +38,7 @@ public class SubmitterIdAssignmentsConversionHandler implements SchemaConversionHandler { - private static final Log log = LogFactory - .getLog(SubmitterIdAssignmentsConversionHandler.class); + private static final Logger log = LoggerFactory.getLogger(SubmitterIdAssignmentsConversionHandler.class); // db driver private String m_dbDriver = null; diff --git a/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/taggable/impl/AssignmentActivityProducerImpl.java b/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/taggable/impl/AssignmentActivityProducerImpl.java index 430811e9b628..162eb14827fe 100644 --- a/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/taggable/impl/AssignmentActivityProducerImpl.java +++ b/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/taggable/impl/AssignmentActivityProducerImpl.java @@ -25,8 +25,8 @@ import java.util.Iterator; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.assignment.api.Assignment; import org.sakaiproject.assignment.api.AssignmentService; import org.sakaiproject.assignment.api.AssignmentSubmission; @@ -47,8 +47,7 @@ public class AssignmentActivityProducerImpl implements AssignmentActivityProducer { - private static final Log logger = LogFactory - .getLog(AssignmentActivityProducerImpl.class); + private static final Logger logger = LoggerFactory.getLogger(AssignmentActivityProducerImpl.class); private static ResourceLoader rb = new ResourceLoader("assignment"); diff --git a/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/taggable/impl/AssignmentItemImpl.java b/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/taggable/impl/AssignmentItemImpl.java index c69b5097941e..25b2d0f42bfa 100644 --- a/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/taggable/impl/AssignmentItemImpl.java +++ b/assignment/assignment-impl/impl/src/java/org/sakaiproject/assignment/taggable/impl/AssignmentItemImpl.java @@ -23,8 +23,8 @@ import java.util.Date; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.assignment.api.AssignmentSubmission; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.exception.IdUnusedException; @@ -39,8 +39,7 @@ public class AssignmentItemImpl implements TaggableItem { - private static final Log logger = LogFactory - .getLog(AssignmentItemImpl.class); + private static final Logger logger = LoggerFactory.getLogger(AssignmentItemImpl.class); private static ResourceLoader rb = new ResourceLoader("assignment"); diff --git a/assignment/assignment-impl/impl/src/test/org/sakaiproject/assignment/impl/AssignmentComparatorTest.java b/assignment/assignment-impl/impl/src/test/org/sakaiproject/assignment/impl/AssignmentComparatorTest.java index 881eebb0248d..f53069e6e43b 100644 --- a/assignment/assignment-impl/impl/src/test/org/sakaiproject/assignment/impl/AssignmentComparatorTest.java +++ b/assignment/assignment-impl/impl/src/test/org/sakaiproject/assignment/impl/AssignmentComparatorTest.java @@ -24,8 +24,8 @@ import junit.framework.TestCase; import org.junit.runner.RunWith; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @@ -39,7 +39,7 @@ @PrepareForTest(UserDirectoryService.class) public class AssignmentComparatorTest extends TestCase { - private static final Log log = LogFactory.getLog(AssignmentComparatorTest.class); + private static final Logger log = LoggerFactory.getLogger(AssignmentComparatorTest.class); private BaseAssignmentService.AssignmentComparator sortNameComparator; private BaseAssignmentService.AssignmentComparator submitterNameComparator; @@ -91,7 +91,7 @@ protected void setUp() throws Exception { Mockito.when(UserDirectoryService.getUser("usernull")).thenReturn(null); } catch (Exception e) { // TODO: handle exception - log.error(e); + log.error(e.getMessage()); } } diff --git a/assignment/assignment-impl/impl/src/test/org/sakaiproject/assignment/impl/AssignmentServiceTest.java b/assignment/assignment-impl/impl/src/test/org/sakaiproject/assignment/impl/AssignmentServiceTest.java index f77204f3963e..d25568daad4f 100644 --- a/assignment/assignment-impl/impl/src/test/org/sakaiproject/assignment/impl/AssignmentServiceTest.java +++ b/assignment/assignment-impl/impl/src/test/org/sakaiproject/assignment/impl/AssignmentServiceTest.java @@ -41,12 +41,12 @@ ///import junit.framework.Assert; import junit.framework.TestCase; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class AssignmentServiceTest extends TestCase { - private static final Log log = LogFactory.getLog(AssignmentServiceTest.class); + private static final Logger log = LoggerFactory.getLogger(AssignmentServiceTest.class); // test interation number int testNumber = 5; diff --git a/assignment/assignment-tool/tool/src/java/org/sakaiproject/assignment/entityproviders/AssignmentEntityProvider.java b/assignment/assignment-tool/tool/src/java/org/sakaiproject/assignment/entityproviders/AssignmentEntityProvider.java index 517a8beae519..bf63462381f1 100644 --- a/assignment/assignment-tool/tool/src/java/org/sakaiproject/assignment/entityproviders/AssignmentEntityProvider.java +++ b/assignment/assignment-tool/tool/src/java/org/sakaiproject/assignment/entityproviders/AssignmentEntityProvider.java @@ -55,8 +55,8 @@ import org.sakaiproject.time.api.Time; import org.sakaiproject.time.cover.TimeService; import org.sakaiproject.tool.api.SessionManager; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.service.gradebook.shared.GradebookExternalAssessmentService; import org.sakaiproject.service.gradebook.shared.GradebookService; @@ -66,7 +66,7 @@ public class AssignmentEntityProvider extends AbstractEntityProvider implements AutoRegisterEntityProvider, PropertyProvideable, Outputable, Inputable { public final static String ENTITY_PREFIX = "assignment"; - private static Log M_log = LogFactory.getLog(AssignmentEntityProvider.class); + private static Logger M_log = LoggerFactory.getLogger(AssignmentEntityProvider.class); @AllArgsConstructor public class DecoratedAttachment implements Comparable { diff --git a/assignment/assignment-tool/tool/src/java/org/sakaiproject/assignment/tool/AssignmentAction.java b/assignment/assignment-tool/tool/src/java/org/sakaiproject/assignment/tool/AssignmentAction.java index 907034b0219c..5cbfbf5f7cf5 100644 --- a/assignment/assignment-tool/tool/src/java/org/sakaiproject/assignment/tool/AssignmentAction.java +++ b/assignment/assignment-tool/tool/src/java/org/sakaiproject/assignment/tool/AssignmentAction.java @@ -60,8 +60,8 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; @@ -191,7 +191,7 @@ public class AssignmentAction extends PagedResourceActionII private static ResourceLoader rb = new ResourceLoader("assignment"); /** Our logger. */ - private static Log M_log = LogFactory.getLog(AssignmentAction.class); + private static Logger M_log = LoggerFactory.getLogger(AssignmentAction.class); private static final String ASSIGNMENT_TOOL_ID = "sakai.assignment.grades"; @@ -3900,7 +3900,7 @@ private Integer calcPageFromSubmission(SessionState state) } catch( NumberFormatException ex ) { - M_log.debug( ex ); + M_log.debug(ex.getMessage()); } if( pageSize <= 1 ) @@ -7633,7 +7633,7 @@ else if (!Integer.valueOf(Assignment.NON_ELECTRONIC_ASSIGNMENT_SUBMISSION).equal } } } catch (IdUnusedException | PermissionException e) { - M_log.error(e); + M_log.error(e.getMessage()); } validPointGrade(state, gradePoints, scaleFactor); @@ -9609,7 +9609,7 @@ public boolean createTIIAssignment(AssignmentContentEdit assign, String assignme contentReviewService.createAssignment(assign.getContext(), assignmentRef, opts); return true; } catch (Exception e) { - M_log.error(e); + M_log.error(e.getMessage()); String uiService = ServerConfigurationService.getString("ui.service", "Sakai"); String[] args = new String[]{contentReviewService.getServiceName(), uiService, e.toString()}; state.setAttribute("alertMessage", rb.getFormattedMessage("content_review.error.createAssignment", args)); @@ -11089,7 +11089,7 @@ public void doAssignment_form(RunData data) SessionState state = ((JetspeedRunData) data).getPortletSessionState(((JetspeedRunData) data).getJs_peid()); String actualGradeSubmissionId = (String) params.getString("submissionId"); - Log.debug("chef", "doAssignment_form(): actualGradeSubmissionId = " + actualGradeSubmissionId); + M_log.debug("actualGradeSubmissionId = {}", actualGradeSubmissionId); String option = (String) params.getString("option"); String fromView = (String) state.getAttribute(FROM_VIEW); @@ -11316,10 +11316,10 @@ else if ("options".equals(option)) // added by Branden Visser - Check that the state is consistent boolean checkSubmissionStateConsistency(SessionState state, String actualGradeSubmissionId) { String stateGradeSubmissionId = (String)state.getAttribute(GRADE_SUBMISSION_SUBMISSION_ID); - Log.debug("chef", "checkSubmissionStateConsistency(): stateGradeSubmissionId = " + stateGradeSubmissionId); + M_log.debug("stateGradeSubmissionId = {}", stateGradeSubmissionId); boolean is_good = stateGradeSubmissionId.equals(actualGradeSubmissionId); if (!is_good) { - Log.warn("chef", "checkSubissionStateConsistency(): State is inconsistent! Aborting grade save."); + M_log.warn("State is inconsistent! Aborting grade save."); addAlert(state, rb.getString("grading.alert.multiTab")); } return is_good; diff --git a/assignment/assignment-tool/tool/src/java/org/sakaiproject/assignment/tool/RedirectingAssignmentEntityServlet.java b/assignment/assignment-tool/tool/src/java/org/sakaiproject/assignment/tool/RedirectingAssignmentEntityServlet.java index 9d2863d6fa43..acfe4d69543a 100644 --- a/assignment/assignment-tool/tool/src/java/org/sakaiproject/assignment/tool/RedirectingAssignmentEntityServlet.java +++ b/assignment/assignment-tool/tool/src/java/org/sakaiproject/assignment/tool/RedirectingAssignmentEntityServlet.java @@ -14,8 +14,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.assignment.entityproviders.AssignmentEntityProvider; import org.sakaiproject.authz.api.SecurityAdvisor; import org.sakaiproject.component.cover.ComponentManager; @@ -37,8 +37,7 @@ public class RedirectingAssignmentEntityServlet extends HttpServlet implements EntityViewAccessProvider { - private static Log M_log = LogFactory - .getLog(RedirectingAssignmentEntityServlet.class); + private static Logger M_log = LoggerFactory.getLogger(RedirectingAssignmentEntityServlet.class); private static final long serialVersionUID = 0L; private EntityBroker entityBroker; diff --git a/authz/authz-tool/tool/src/java/org/sakaiproject/authz/tool/PermissionsHelperAction.java b/authz/authz-tool/tool/src/java/org/sakaiproject/authz/tool/PermissionsHelperAction.java index 31a505e11316..dd0ab369d2a3 100755 --- a/authz/authz-tool/tool/src/java/org/sakaiproject/authz/tool/PermissionsHelperAction.java +++ b/authz/authz-tool/tool/src/java/org/sakaiproject/authz/tool/PermissionsHelperAction.java @@ -27,8 +27,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroup; import org.sakaiproject.authz.api.AuthzPermissionException; import org.sakaiproject.authz.api.GroupAlreadyDefinedException; @@ -66,7 +66,7 @@ public class PermissionsHelperAction extends VelocityPortletPaneledAction { /** Our logger. */ - private static Log M_log = LogFactory.getLog(PermissionsHelperAction.class); + private static Logger M_log = LoggerFactory.getLogger(PermissionsHelperAction.class); private static ResourceLoader rb = new ResourceLoader("authz-tool"); @@ -161,7 +161,7 @@ protected void toolModeDispatch(String methodBase, String methodExt, HttpServlet } catch (IOException e) { - Log.warn("chef", this + " : ", e); + M_log.warn(e.getMessage()); } return; } diff --git a/authz/authz-tool/tool/src/java/org/sakaiproject/authz/tool/RealmsAction.java b/authz/authz-tool/tool/src/java/org/sakaiproject/authz/tool/RealmsAction.java index 7dbd177e5f46..42b764f9fa3e 100644 --- a/authz/authz-tool/tool/src/java/org/sakaiproject/authz/tool/RealmsAction.java +++ b/authz/authz-tool/tool/src/java/org/sakaiproject/authz/tool/RealmsAction.java @@ -29,8 +29,8 @@ import java.util.Vector; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.*; import org.sakaiproject.cheftool.Context; import org.sakaiproject.cheftool.JetspeedRunData; @@ -66,7 +66,7 @@ public class RealmsAction extends PagedResourceActionII /** Resource bundle using current language locale */ private static ResourceLoader rb = new ResourceLoader("authz-tool"); - private static Log M_log = LogFactory.getLog(RealmsAction.class); + private static Logger logger = LoggerFactory.getLogger(RealmsAction.class); private AuthzGroupService authzGroupService; private FunctionManager functionManager; @@ -207,7 +207,7 @@ else if ("viewRole".equals(mode)) else { - Log.warn("chef", "RealmsAction: mode: " + mode); + logger.warn("mode: {}", mode); template = buildListContext(state, context); } @@ -661,7 +661,7 @@ public void doEdit(RunData data, Context context) } catch (GroupNotDefinedException e) { - Log.warn("chef", "RealmsAction.doEdit: realm not found: " + id); + logger.warn("realm not found: {}", id); addAlert(state, rb.getFormattedMessage("realm.notfound", new Object[]{id})); state.removeAttribute("mode"); @@ -734,7 +734,7 @@ public void doSave_edit(RunData data, Context context) } catch (Exception e) { - Log.warn("chef", this + "doSave_edit(): realmId = " + realm.getId() + " " + e.getMessage()); + logger.warn("realmId = {} {}", realm.getId(), e.getMessage()); } } @@ -886,7 +886,7 @@ public void doView(RunData data, Context context) } catch (GroupNotDefinedException e) { - Log.warn("chef", "RealmsAction.doView: realm not found: " + id); + logger.warn("realm not found: {}", id); addAlert(state, rb.getFormattedMessage("realm.notfound", new Object[]{id})); state.removeAttribute("mode"); @@ -1301,7 +1301,7 @@ public void doEdit_user(RunData data, Context context) } catch (UserNotDefinedException e) { - Log.warn("chef", this + "doEdit_user(): user not found: " + id); + logger.warn("user not found: {}", id); addAlert(state, rb.getString("realm.user.notfound")); } @@ -1486,7 +1486,7 @@ private boolean isAccessAllowed() { String userId = sessionManager.getCurrentSessionUserId(); if(securityService.unlock(userId, AuthzGroupService.SECURE_VIEW_ALL_AUTHZ_GROUPS, siteRef)) { - M_log.debug("Granting view access to Realms tool for userId: " + userId); + logger.debug("Granting view access to Realms tool for userId: " + userId); return true; } diff --git a/basiclti/basiclti-api/src/java/org/sakaiproject/lti/extensions/POXMembershipsResponse.java b/basiclti/basiclti-api/src/java/org/sakaiproject/lti/extensions/POXMembershipsResponse.java index 67ee62d41437..cbb4c1d19c42 100644 --- a/basiclti/basiclti-api/src/java/org/sakaiproject/lti/extensions/POXMembershipsResponse.java +++ b/basiclti/basiclti-api/src/java/org/sakaiproject/lti/extensions/POXMembershipsResponse.java @@ -9,8 +9,8 @@ import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.xml.sax.Attributes; import org.xml.sax.InputSource; @@ -20,7 +20,7 @@ public class POXMembershipsResponse { public static final String UNSPECIFIED = "unspecified"; - private static Log M_log = LogFactory.getLog(POXMembershipsResponse.class); + private static Logger M_log = LoggerFactory.getLogger(POXMembershipsResponse.class); private MembershipsHandler handler = new MembershipsHandler(); diff --git a/basiclti/basiclti-blis/src/java/org/sakaiproject/blti/ServiceServlet.java b/basiclti/basiclti-blis/src/java/org/sakaiproject/blti/ServiceServlet.java index 5e3fcaa0f2f3..c2d78d474033 100644 --- a/basiclti/basiclti-blis/src/java/org/sakaiproject/blti/ServiceServlet.java +++ b/basiclti/basiclti-blis/src/java/org/sakaiproject/blti/ServiceServlet.java @@ -62,8 +62,8 @@ import javax.xml.xpath.XPathConstants; import org.sakaiproject.component.cover.ComponentManager; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.tsugi.basiclti.BasicLTIUtil; import org.sakaiproject.authz.api.Member; import org.sakaiproject.authz.api.Role; @@ -120,7 +120,7 @@ public class ServiceServlet extends HttpServlet { private static final long serialVersionUID = 1L; - private static Log M_log = LogFactory.getLog(ServiceServlet.class); + private static Logger M_log = LoggerFactory.getLogger(ServiceServlet.class); private static ResourceLoader rb = new ResourceLoader("blis"); protected static SakaiFoorm foorm = new SakaiFoorm(); @@ -348,7 +348,7 @@ protected void doPostForm(HttpServletRequest request, HttpServletResponse respon placement_id = dec2.substring(pos+3); } } catch (Exception e) { - // Log some detail for ourselves + // Logger some detail for ourselves M_log.warn("Unable to decrypt result_sourcedid IP=" + ipAddress + " Error=" + e.getMessage(),e); signature = null; placement_id = null; @@ -838,7 +838,7 @@ protected void doPostXml(HttpServletRequest request, HttpServletResponse respons placement_id = dec2.substring(pos+3); } } catch (Exception e) { - // Log some detail for ourselves + // Logger some detail for ourselves M_log.warn("Unable to decrypt result_sourcedid IP=" + ipAddress + " Error=" + e.getMessage(),e); signature = null; placement_id = null; diff --git a/basiclti/basiclti-blis/src/java/org/sakaiproject/lti2/LTI2Service.java b/basiclti/basiclti-blis/src/java/org/sakaiproject/lti2/LTI2Service.java index 861f23e99877..0902bc886e2a 100644 --- a/basiclti/basiclti-blis/src/java/org/sakaiproject/lti2/LTI2Service.java +++ b/basiclti/basiclti-blis/src/java/org/sakaiproject/lti2/LTI2Service.java @@ -34,8 +34,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.tsugi.basiclti.BasicLTIConstants; import org.tsugi.json.IMSJSONRequest; import org.tsugi.lti2.LTI2Config; @@ -73,7 +73,7 @@ public class LTI2Service extends HttpServlet { private static final long serialVersionUID = 1L; - private static Log M_log = LogFactory.getLog(LTI2Service.class); + private static Logger M_log = LoggerFactory.getLogger(LTI2Service.class); private static ResourceLoader rb = new ResourceLoader("blis"); protected static SakaiFoorm foorm = new SakaiFoorm(); diff --git a/basiclti/basiclti-common/src/java/org/sakaiproject/basiclti/util/BlowFish.java b/basiclti/basiclti-common/src/java/org/sakaiproject/basiclti/util/BlowFish.java index 52f284254b69..9dffc7e172c2 100644 --- a/basiclti/basiclti-common/src/java/org/sakaiproject/basiclti/util/BlowFish.java +++ b/basiclti/basiclti-common/src/java/org/sakaiproject/basiclti/util/BlowFish.java @@ -26,8 +26,8 @@ import org.sakaiproject.component.cover.ServerConfigurationService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.security.*; import javax.crypto.*; diff --git a/basiclti/basiclti-common/src/java/org/sakaiproject/basiclti/util/SakaiBLTIUtil.java b/basiclti/basiclti-common/src/java/org/sakaiproject/basiclti/util/SakaiBLTIUtil.java index 7046c94f3568..ee8f93fff3f0 100644 --- a/basiclti/basiclti-common/src/java/org/sakaiproject/basiclti/util/SakaiBLTIUtil.java +++ b/basiclti/basiclti-common/src/java/org/sakaiproject/basiclti/util/SakaiBLTIUtil.java @@ -36,8 +36,8 @@ import org.json.simple.JSONObject; import org.json.simple.JSONArray; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.tsugi.basiclti.BasicLTIUtil; import org.tsugi.basiclti.BasicLTIConstants; @@ -112,7 +112,7 @@ @SuppressWarnings("deprecation") public class SakaiBLTIUtil { - private static Log M_log = LogFactory.getLog(SakaiBLTIUtil.class); + private static Logger M_log = LoggerFactory.getLogger(SakaiBLTIUtil.class); public static final boolean verbosePrint = false; @@ -1839,7 +1839,7 @@ public static Properties parseFormString(String str) { } else if (kv.length == 1 && i < positional.length) { op.setProperty(positional[i++], kv[0]); } else { - // TODO : Log something here + // TODO : Logger something here } } return op; diff --git a/basiclti/basiclti-common/src/java/org/sakaiproject/basiclti/util/SakaiCASAUtil.java b/basiclti/basiclti-common/src/java/org/sakaiproject/basiclti/util/SakaiCASAUtil.java index 3623ae6dc57e..8a56a3007a78 100644 --- a/basiclti/basiclti-common/src/java/org/sakaiproject/basiclti/util/SakaiCASAUtil.java +++ b/basiclti/basiclti-common/src/java/org/sakaiproject/basiclti/util/SakaiCASAUtil.java @@ -30,8 +30,8 @@ import org.tsugi.jackson.JacksonUtil; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.tsugi.basiclti.BasicLTIUtil; import org.tsugi.casa.CASAUtil; @@ -54,7 +54,7 @@ @SuppressWarnings("deprecation") public class SakaiCASAUtil { - private static Log M_log = LogFactory.getLog(SakaiCASAUtil.class); + private static Logger M_log = LoggerFactory.getLogger(SakaiCASAUtil.class); public static Application getCASAEntry(String toolRegistration) { diff --git a/basiclti/basiclti-common/src/java/org/sakaiproject/basiclti/util/SakaiContentItemUtil.java b/basiclti/basiclti-common/src/java/org/sakaiproject/basiclti/util/SakaiContentItemUtil.java index e5d32e7223c1..0de080cba388 100644 --- a/basiclti/basiclti-common/src/java/org/sakaiproject/basiclti/util/SakaiContentItemUtil.java +++ b/basiclti/basiclti-common/src/java/org/sakaiproject/basiclti/util/SakaiContentItemUtil.java @@ -21,8 +21,8 @@ import java.util.ArrayList; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.basiclti.util.SakaiBLTIUtil; import org.sakaiproject.basiclti.util.SakaiLTIProviderUtil; @@ -43,7 +43,7 @@ @SuppressWarnings("deprecation") public class SakaiContentItemUtil { - private static Log M_log = LogFactory.getLog(SakaiContentItemUtil.class); + private static Logger M_log = LoggerFactory.getLogger(SakaiContentItemUtil.class); public static LtiLinkItem getLtiLinkItem(String toolRegistration) { diff --git a/basiclti/basiclti-common/src/java/org/sakaiproject/basiclti/util/SakaiLTIProviderUtil.java b/basiclti/basiclti-common/src/java/org/sakaiproject/basiclti/util/SakaiLTIProviderUtil.java index 6d8a92219619..f03ee78553df 100644 --- a/basiclti/basiclti-common/src/java/org/sakaiproject/basiclti/util/SakaiLTIProviderUtil.java +++ b/basiclti/basiclti-common/src/java/org/sakaiproject/basiclti/util/SakaiLTIProviderUtil.java @@ -19,8 +19,8 @@ package org.sakaiproject.basiclti.util; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.basiclti.util.SakaiBLTIUtil; @@ -30,7 +30,7 @@ @SuppressWarnings("deprecation") public class SakaiLTIProviderUtil { - private static Log M_log = LogFactory.getLog(SakaiLTIProviderUtil.class); + private static Logger M_log = LoggerFactory.getLogger(SakaiLTIProviderUtil.class); public static String getProviderLaunchUrl(String toolRegistration) diff --git a/basiclti/basiclti-common/src/java/org/sakaiproject/linktool/LinkToolUtil.java b/basiclti/basiclti-common/src/java/org/sakaiproject/linktool/LinkToolUtil.java index 39975521d027..db1d64bce1bc 100644 --- a/basiclti/basiclti-common/src/java/org/sakaiproject/linktool/LinkToolUtil.java +++ b/basiclti/basiclti-common/src/java/org/sakaiproject/linktool/LinkToolUtil.java @@ -27,8 +27,8 @@ import org.sakaiproject.component.cover.ServerConfigurationService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.security.*; import javax.crypto.*; @@ -40,7 +40,7 @@ public class LinkToolUtil { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(LinkToolUtil.class); + private static Logger M_log = LoggerFactory.getLogger(LinkToolUtil.class); private static final String privkeyname = "sakai.rutgers.linktool.privkey"; private static final String saltname = "sakai.rutgers.linktool.salt"; diff --git a/basiclti/basiclti-impl/src/java/org/sakaiproject/basiclti/impl/BasicLTIArchiveBean.java b/basiclti/basiclti-impl/src/java/org/sakaiproject/basiclti/impl/BasicLTIArchiveBean.java index 2158d4a9af6a..c3e796f3038e 100644 --- a/basiclti/basiclti-impl/src/java/org/sakaiproject/basiclti/impl/BasicLTIArchiveBean.java +++ b/basiclti/basiclti-impl/src/java/org/sakaiproject/basiclti/impl/BasicLTIArchiveBean.java @@ -2,8 +2,8 @@ import java.util.Properties; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.w3c.dom.Attr; import org.w3c.dom.Document; @@ -19,7 +19,7 @@ public class BasicLTIArchiveBean { public final static String TOOL_TITLE = "toolTitle"; public final static String SITE_TOOL_PROPERTIES = "siteToolProperties"; - private Log logger = LogFactory.getLog(BasicLTISecurityServiceImpl.class); + private Logger logger = LoggerFactory.getLogger(BasicLTISecurityServiceImpl.class); public BasicLTIArchiveBean() { diff --git a/basiclti/basiclti-impl/src/java/org/sakaiproject/basiclti/impl/BasicLTISecurityServiceImpl.java b/basiclti/basiclti-impl/src/java/org/sakaiproject/basiclti/impl/BasicLTISecurityServiceImpl.java index cc658422713f..9534f738a48c 100644 --- a/basiclti/basiclti-impl/src/java/org/sakaiproject/basiclti/impl/BasicLTISecurityServiceImpl.java +++ b/basiclti/basiclti-impl/src/java/org/sakaiproject/basiclti/impl/BasicLTISecurityServiceImpl.java @@ -36,8 +36,8 @@ import org.w3c.dom.Node; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.tsugi.basiclti.BasicLTIUtil; import org.sakaiproject.authz.cover.SecurityService; import org.sakaiproject.entity.api.Entity; @@ -99,7 +99,7 @@ public class BasicLTISecurityServiceImpl implements EntityProducer { *******************************************************************************/ /** Dependency: a logger component. */ - private Log logger = LogFactory.getLog(BasicLTISecurityServiceImpl.class); + private Logger logger = LoggerFactory.getLogger(BasicLTISecurityServiceImpl.class); /** * Check security for this entity. diff --git a/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/BaseLTIService.java b/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/BaseLTIService.java index 925bd34f01ac..3532a0e2a0fd 100644 --- a/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/BaseLTIService.java +++ b/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/BaseLTIService.java @@ -25,8 +25,8 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.SecurityService; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.event.api.EventTrackingService; @@ -55,7 +55,7 @@ */ public abstract class BaseLTIService implements LTIService { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(BaseLTIService.class); + private static Logger M_log = LoggerFactory.getLogger(BaseLTIService.class); /** Constants */ private final String ADMIN_SITE = "!admin"; diff --git a/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/DBLTIService.java b/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/DBLTIService.java index 5ffbac5921bd..f5c1c5d4b1bd 100644 --- a/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/DBLTIService.java +++ b/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/DBLTIService.java @@ -23,8 +23,8 @@ package org.sakaiproject.lti.impl; import org.apache.commons.configuration.PropertiesConfiguration; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.db.api.SqlService; import org.sakaiproject.lti.api.LTIService; @@ -56,7 +56,7 @@ */ public class DBLTIService extends BaseLTIService implements LTIService { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(DBLTIService.class); + private static Logger M_log = LoggerFactory.getLogger(DBLTIService.class); /** * diff --git a/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/LTIReportingJob.java b/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/LTIReportingJob.java index 306e2831c5d5..4685501f902a 100644 --- a/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/LTIReportingJob.java +++ b/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/LTIReportingJob.java @@ -1,7 +1,7 @@ package org.sakaiproject.lti.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; @@ -23,7 +23,7 @@ */ public class LTIReportingJob implements Job { - private final Log log = LogFactory.getLog(LTIReportingJob.class); + private final Logger log = LoggerFactory.getLogger(LTIReportingJob.class); protected final ResourceLoader rb = new ResourceLoader("email"); diff --git a/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/LTIRoleMapperImpl.java b/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/LTIRoleMapperImpl.java index e3b58bc9fae7..8fc67469d0fc 100644 --- a/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/LTIRoleMapperImpl.java +++ b/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/LTIRoleMapperImpl.java @@ -4,8 +4,8 @@ import java.util.AbstractMap; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.tsugi.basiclti.BasicLTIConstants; import org.tsugi.basiclti.BasicLTIUtil; @@ -25,7 +25,7 @@ */ public class LTIRoleMapperImpl implements LTIRoleMapper { - private static Log M_log = LogFactory.getLog(LTIRoleMapperImpl.class); + private static Logger M_log = LoggerFactory.getLogger(LTIRoleMapperImpl.class); /** * Injected from Spring, see components.xml diff --git a/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/SiteEmailPreferenceSetterImpl.java b/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/SiteEmailPreferenceSetterImpl.java index 247a56a9d86d..e35eb5379f6e 100644 --- a/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/SiteEmailPreferenceSetterImpl.java +++ b/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/SiteEmailPreferenceSetterImpl.java @@ -18,8 +18,8 @@ import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.entity.api.ResourcePropertiesEdit; import org.sakaiproject.event.api.NotificationService; @@ -35,7 +35,7 @@ */ public class SiteEmailPreferenceSetterImpl implements SiteEmailPreferenceSetter { - private static Log M_log = LogFactory.getLog(SiteEmailPreferenceSetterImpl.class); + private static Logger M_log = LoggerFactory.getLogger(SiteEmailPreferenceSetterImpl.class); private PreferencesService preferencesService = null; public void setPreferencesService(PreferencesService preferencesService) { diff --git a/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/SiteMembershipUpdaterImpl.java b/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/SiteMembershipUpdaterImpl.java index 61acb822318a..7b33500e0eec 100644 --- a/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/SiteMembershipUpdaterImpl.java +++ b/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/SiteMembershipUpdaterImpl.java @@ -22,8 +22,8 @@ import java.io.IOException; import java.util.*; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.Role; import org.sakaiproject.authz.api.SecurityAdvisor; @@ -40,7 +40,7 @@ */ public class SiteMembershipUpdaterImpl implements SiteMembershipUpdater { - private static Log M_log = LogFactory.getLog(SiteMembershipUpdaterImpl .class); + private static Logger M_log = LoggerFactory.getLogger(SiteMembershipUpdaterImpl .class); /** * Injected from Spring, see components.xml diff --git a/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/SiteMembershipsSynchroniserImpl.java b/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/SiteMembershipsSynchroniserImpl.java index 222b08bf9756..7ad3e59a5ab1 100644 --- a/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/SiteMembershipsSynchroniserImpl.java +++ b/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/SiteMembershipsSynchroniserImpl.java @@ -38,12 +38,12 @@ import java.io.InputStreamReader; import java.io.OutputStreamWriter; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class SiteMembershipsSynchroniserImpl implements SiteMembershipsSynchroniser { - private static Log M_log = LogFactory.getLog(SiteMembershipsSynchroniserImpl.class); + private static Logger M_log = LoggerFactory.getLogger(SiteMembershipsSynchroniserImpl.class); private UserFinderOrCreator userFinderOrCreator = null; public void setUserFinderOrCreator(UserFinderOrCreator userFinderOrCreator) { diff --git a/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/UserFinderOrCreatorImpl.java b/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/UserFinderOrCreatorImpl.java index d5c80a881562..c705e5b8fc3a 100644 --- a/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/UserFinderOrCreatorImpl.java +++ b/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/UserFinderOrCreatorImpl.java @@ -19,8 +19,8 @@ import java.util.Collection; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.tsugi.basiclti.BasicLTIConstants; import org.tsugi.basiclti.BasicLTIUtil; @@ -37,7 +37,7 @@ */ public class UserFinderOrCreatorImpl implements UserFinderOrCreator { - private static Log M_log = LogFactory.getLog(UserFinderOrCreatorImpl.class); + private static Logger M_log = LoggerFactory.getLogger(UserFinderOrCreatorImpl.class); private UserDirectoryService userDirectoryService = null; public void setUserDirectoryService(UserDirectoryService userDirectoryService) { diff --git a/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/UserLocaleSetterImpl.java b/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/UserLocaleSetterImpl.java index 82b3a049799d..dae9f2323be3 100644 --- a/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/UserLocaleSetterImpl.java +++ b/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/UserLocaleSetterImpl.java @@ -18,8 +18,8 @@ import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.tsugi.basiclti.BasicLTIConstants; @@ -36,7 +36,7 @@ */ public class UserLocaleSetterImpl implements UserLocaleSetter { - private static Log M_log = LogFactory.getLog(UserFinderOrCreatorImpl.class); + private static Logger M_log = LoggerFactory.getLogger(UserFinderOrCreatorImpl.class); private PreferencesService preferencesService = null; public void setPreferencesService(PreferencesService preferencesService) { diff --git a/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/UserPictureSetterImpl.java b/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/UserPictureSetterImpl.java index bb14134f5284..76c0a33a1976 100644 --- a/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/UserPictureSetterImpl.java +++ b/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/UserPictureSetterImpl.java @@ -18,8 +18,8 @@ import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.tsugi.basiclti.BasicLTIConstants; @@ -34,7 +34,7 @@ */ public class UserPictureSetterImpl implements UserPictureSetter { - private static Log M_log = LogFactory.getLog(UserPictureSetterImpl.class); + private static Logger M_log = LoggerFactory.getLogger(UserPictureSetterImpl.class); private ProfileImageLogic profileImageLogic = null; public void setProfileImageLogic(ProfileImageLogic profileImageLogic) { diff --git a/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/jobs/SiteMembershipsSyncJob.java b/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/jobs/SiteMembershipsSyncJob.java index d7290094a4c8..e4bb55129593 100644 --- a/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/jobs/SiteMembershipsSyncJob.java +++ b/basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/jobs/SiteMembershipsSyncJob.java @@ -1,7 +1,7 @@ package org.sakaiproject.lti.impl.jobs; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.tsugi.basiclti.BasicLTIProviderUtil; import java.util.List; @@ -16,7 +16,7 @@ public class SiteMembershipsSyncJob implements StatefulJob { - private static Log M_log = LogFactory.getLog(SiteMembershipsSyncJob.class); + private static Logger M_log = LoggerFactory.getLogger(SiteMembershipsSyncJob.class); private LTIService ltiService = null; public void setLtiService(LTIService ltiService) { diff --git a/basiclti/basiclti-impl/src/java/org/sakaiproject/util/foorm/Foorm.java b/basiclti/basiclti-impl/src/java/org/sakaiproject/util/foorm/Foorm.java index b8496dca2643..1b3508661c2a 100644 --- a/basiclti/basiclti-impl/src/java/org/sakaiproject/util/foorm/Foorm.java +++ b/basiclti/basiclti-impl/src/java/org/sakaiproject/util/foorm/Foorm.java @@ -66,7 +66,7 @@ public Properties parseFormString(String str) { } else if (kv.length == 1 && i < positional.length) { op.setProperty(positional[i++], kv[0]); } else { - // TODO : Log something here + // TODO : Logger something here } } return op; @@ -215,7 +215,7 @@ public void setField(Object row, String key, Object value) { ((java.util.Map) row).put(key, value); } if (row instanceof java.sql.ResultSet) { - // TODO: Log message + // TODO: Logger message } } diff --git a/basiclti/basiclti-impl/src/java/org/sakaiproject/util/foorm/SakaiFoorm.java b/basiclti/basiclti-impl/src/java/org/sakaiproject/util/foorm/SakaiFoorm.java index 0fbac4a3adff..4676b1544603 100644 --- a/basiclti/basiclti-impl/src/java/org/sakaiproject/util/foorm/SakaiFoorm.java +++ b/basiclti/basiclti-impl/src/java/org/sakaiproject/util/foorm/SakaiFoorm.java @@ -17,7 +17,7 @@ import org.sakaiproject.util.FormattedText; import org.sakaiproject.db.api.SqlService; -import org.apache.commons.logging.Log; +import org.slf4j.Logger; public class SakaiFoorm extends Foorm { @@ -42,7 +42,7 @@ public String loadI18N(String str, Object loader) } public void autoDDL(String table, String[] model, SqlService m_sql, boolean m_autoDdl, - boolean doReset, Log M_log) + boolean doReset, Logger M_log) { // Use very carefully - for testing table creation if (doReset) diff --git a/basiclti/basiclti-portlet/src/java/org/sakaiproject/blti/ProviderServlet.java b/basiclti/basiclti-portlet/src/java/org/sakaiproject/blti/ProviderServlet.java index b3b2255fcb92..420b5d6e6098 100644 --- a/basiclti/basiclti-portlet/src/java/org/sakaiproject/blti/ProviderServlet.java +++ b/basiclti/basiclti-portlet/src/java/org/sakaiproject/blti/ProviderServlet.java @@ -40,8 +40,8 @@ import net.oauth.server.OAuthServlet; import net.oauth.signature.OAuthSignatureMethod; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.json.simple.JSONObject; import org.json.simple.JSONArray; @@ -119,7 +119,7 @@ public class ProviderServlet extends HttpServlet { private static final long serialVersionUID = 1L; - private static Log M_log = LogFactory.getLog(ProviderServlet.class); + private static Logger M_log = LoggerFactory.getLogger(ProviderServlet.class); private static ResourceLoader rb = new ResourceLoader("basiclti"); private static final String BASICLTI_RESOURCE_LINK = "blti:resource_link_id"; private static final String LTI_CONTEXT_ID = "lti_context_id"; diff --git a/basiclti/basiclti-portlet/src/java/org/sakaiproject/portlets/IMSBLTIPortlet.java b/basiclti/basiclti-portlet/src/java/org/sakaiproject/portlets/IMSBLTIPortlet.java index ae46573e373f..bf253ceec9f0 100644 --- a/basiclti/basiclti-portlet/src/java/org/sakaiproject/portlets/IMSBLTIPortlet.java +++ b/basiclti/basiclti-portlet/src/java/org/sakaiproject/portlets/IMSBLTIPortlet.java @@ -54,8 +54,8 @@ import javax.servlet.ServletRequest; import org.sakaiproject.thread_local.cover.ThreadLocalManager; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.portlet.util.PortletHelper; @@ -103,7 +103,7 @@ public class IMSBLTIPortlet extends GenericPortlet { private ArrayList fieldList = new ArrayList(); /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(IMSBLTIPortlet.class); + private static Logger M_log = LoggerFactory.getLogger(IMSBLTIPortlet.class); public static final String EVENT_BASICLTI_CONFIG = "basiclti.config"; diff --git a/basiclti/basiclti-tool/src/java/org/sakaiproject/blti/tool/LTIAdminTool.java b/basiclti/basiclti-tool/src/java/org/sakaiproject/blti/tool/LTIAdminTool.java index 45a92c91022b..0f68fe3cc723 100644 --- a/basiclti/basiclti-tool/src/java/org/sakaiproject/blti/tool/LTIAdminTool.java +++ b/basiclti/basiclti-tool/src/java/org/sakaiproject/blti/tool/LTIAdminTool.java @@ -34,8 +34,8 @@ import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.tsugi.basiclti.BasicLTIUtil; import org.tsugi.basiclti.BasicLTIConstants; import org.tsugi.lti2.LTI2Config; @@ -85,7 +85,7 @@ */ public class LTIAdminTool extends VelocityPortletPaneledAction { - private static Log M_log = LogFactory.getLog(LTIAdminTool.class); + private static Logger M_log = LoggerFactory.getLogger(LTIAdminTool.class); /** Resource bundle using current language locale */ protected static ResourceLoader rb = new ResourceLoader("ltitool"); diff --git a/basiclti/portlet-util/src/java/org/sakaiproject/portlet/util/PortletHelper.java b/basiclti/portlet-util/src/java/org/sakaiproject/portlet/util/PortletHelper.java index 9ab02fc5a63c..8af4750a2e11 100644 --- a/basiclti/portlet-util/src/java/org/sakaiproject/portlet/util/PortletHelper.java +++ b/basiclti/portlet-util/src/java/org/sakaiproject/portlet/util/PortletHelper.java @@ -25,8 +25,8 @@ import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.portlet.PortletRequest; import javax.portlet.PortletPreferences; diff --git a/basiclti/tsugi-util/src/java/org/tsugi/basiclti/BasicLTIProviderUtil.java b/basiclti/tsugi-util/src/java/org/tsugi/basiclti/BasicLTIProviderUtil.java index 220ebfea219d..df90f5f8b53a 100644 --- a/basiclti/tsugi-util/src/java/org/tsugi/basiclti/BasicLTIProviderUtil.java +++ b/basiclti/tsugi-util/src/java/org/tsugi/basiclti/BasicLTIProviderUtil.java @@ -22,13 +22,13 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.component.cover.ComponentManager; public class BasicLTIProviderUtil { - private static Log M_log = LogFactory.getLog(BasicLTIProviderUtil.class); + private static Logger M_log = LoggerFactory.getLogger(BasicLTIProviderUtil.class); public static final String EMAIL_TRUSTED_CONSUMER = "basiclti.provider.email.trusted.consumers"; public static final String HIGHLY_TRUSTED_CONSUMER = "basiclti.provider.highly.trusted.consumers"; diff --git a/basiclti/tsugi-util/src/java/org/tsugi/json/IMSJSONRequest.java b/basiclti/tsugi-util/src/java/org/tsugi/json/IMSJSONRequest.java index 16dd27686e3d..fb5abb6fe9d2 100644 --- a/basiclti/tsugi-util/src/java/org/tsugi/json/IMSJSONRequest.java +++ b/basiclti/tsugi-util/src/java/org/tsugi/json/IMSJSONRequest.java @@ -8,7 +8,6 @@ import java.util.LinkedHashMap; import java.util.Map; import java.util.TreeMap; -import java.util.logging.Logger; import javax.servlet.ServletInputStream; import javax.servlet.http.HttpServletRequest; @@ -22,12 +21,14 @@ import net.oauth.server.OAuthServlet; import net.oauth.signature.OAuthSignatureMethod; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.tsugi.basiclti.Base64; import org.json.simple.JSONValue; public class IMSJSONRequest { - private final static Logger Log = Logger.getLogger(IMSJSONRequest.class .getName()); + private final static Logger logger = LoggerFactory.getLogger(IMSJSONRequest.class); public final static String STATUS = "status"; public final static String STATUS_CODE = "code"; @@ -109,7 +110,7 @@ public void loadFromRequest(HttpServletRequest request) if ( oauth_body_hash == null ) { errorMessage = "Did not find oauth_body_hash"; - Log.info(errorMessage+"\n"+header); + logger.info(errorMessage+"\n"+header); return; } @@ -320,7 +321,7 @@ public static void runTest() { Properties props = new Properties(); props.setProperty("fred","zap"); props.setProperty("sam",IMSPOXRequest.MINOR_IDALLOC); - System.out.println("---- Generate Log Error ----"); + System.out.println("---- Generate logger Error ----"); output = pox.getResponseFailure(desc,props); System.out.println("---- Failure ----"); System.out.println(output); diff --git a/basiclti/tsugi-util/src/java/org/tsugi/lti2/LTI2Servlet.java b/basiclti/tsugi-util/src/java/org/tsugi/lti2/LTI2Servlet.java index 002180a1727c..b4bc5c9689ac 100644 --- a/basiclti/tsugi-util/src/java/org/tsugi/lti2/LTI2Servlet.java +++ b/basiclti/tsugi-util/src/java/org/tsugi/lti2/LTI2Servlet.java @@ -33,8 +33,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.tsugi.basiclti.BasicLTIConstants; import org.tsugi.basiclti.BasicLTIUtil; import org.tsugi.json.IMSJSONRequest; @@ -80,7 +80,7 @@ public class LTI2Servlet extends HttpServlet { private static final long serialVersionUID = 1L; - private static Log M_log = LogFactory.getLog(LTI2Servlet.class); + private static Logger M_log = LoggerFactory.getLogger(LTI2Servlet.class); protected Service_offered LTI2ResultItem = null; protected Service_offered LTI2LtiLinkSettings = null; diff --git a/basiclti/tsugi-util/src/java/org/tsugi/pox/IMSPOXRequest.java b/basiclti/tsugi-util/src/java/org/tsugi/pox/IMSPOXRequest.java index 137ba9a6f29b..b85b4670bb2e 100644 --- a/basiclti/tsugi-util/src/java/org/tsugi/pox/IMSPOXRequest.java +++ b/basiclti/tsugi-util/src/java/org/tsugi/pox/IMSPOXRequest.java @@ -10,7 +10,6 @@ import java.util.Map; import java.util.Properties; import java.util.TreeMap; -import java.util.logging.Logger; import javax.servlet.http.HttpServletRequest; import javax.xml.parsers.DocumentBuilder; @@ -29,6 +28,8 @@ import net.oauth.signature.OAuthSignatureMethod; import org.apache.commons.lang.StringEscapeUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.tsugi.basiclti.Base64; import org.tsugi.basiclti.XMLMap; import org.w3c.dom.Document; @@ -37,7 +38,7 @@ public class IMSPOXRequest { - private final static Logger Log = Logger.getLogger(IMSPOXRequest.class .getName()); + private final static Logger logger = LoggerFactory.getLogger(IMSPOXRequest.class); public final static String MAJOR_SUCCESS = "success"; public final static String MAJOR_FAILURE = "failure"; @@ -175,7 +176,7 @@ public void loadFromRequest(HttpServletRequest request) String contentType = request.getContentType(); if ( ! "application/xml".equals(contentType) ) { errorMessage = "Content Type must be application/xml"; - Log.info(errorMessage+"\n"+contentType); + logger.info(errorMessage+"\n"+contentType); return; } @@ -199,7 +200,7 @@ public void loadFromRequest(HttpServletRequest request) if ( oauth_body_hash == null ) { errorMessage = "Did not find oauth_body_hash"; - Log.info(errorMessage+"\n"+header); + logger.info(errorMessage+"\n"+header); return; } @@ -321,7 +322,7 @@ public static String fetchTag(org.w3c.dom.Element element, String tag) } } } catch (Throwable t) { - Log.warning(t.getMessage()); + logger.warn(t.getMessage()); // t.printStackTrace(); } return null; @@ -458,7 +459,7 @@ public String getResponse(String description, String major, String severity, if ( internalError.length() > 0 ) { description = description + " (Internal error: " + internalError.toString() + ")"; - Log.warning(internalError.toString()); + logger.warn(internalError.toString()); } if ( bodyString == null ) bodyString = ""; @@ -529,7 +530,7 @@ public static void runTest() { Properties props = new Properties(); props.setProperty("fred","zap"); props.setProperty("sam",IMSPOXRequest.MINOR_IDALLOC); - System.out.println("---- Generate Log Error ----"); + System.out.println("---- Generate logger Error ----"); output = pox.getResponseFailure(desc,props); System.out.println("---- Failure ----"); System.out.println(output); diff --git a/basiclti/web-ifp/src/java/org/sakaiproject/portlet/util/VelocityHelper.java b/basiclti/web-ifp/src/java/org/sakaiproject/portlet/util/VelocityHelper.java index d589615a041f..667a2b1be475 100644 --- a/basiclti/web-ifp/src/java/org/sakaiproject/portlet/util/VelocityHelper.java +++ b/basiclti/web-ifp/src/java/org/sakaiproject/portlet/util/VelocityHelper.java @@ -16,8 +16,8 @@ import org.apache.velocity.runtime.RuntimeConstants; import org.apache.velocity.app.VelocityEngine; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * a simple VelocityHelper Utility @@ -25,7 +25,7 @@ public class VelocityHelper { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(VelocityHelper.class); + private static Logger M_log = LoggerFactory.getLogger(VelocityHelper.class); public static VelocityEngine makeEngine(PortletContext pContext) throws java.io.IOException,org.apache.velocity.exception.ResourceNotFoundException, diff --git a/basiclti/web-ifp/src/java/org/sakaiproject/portlets/SakaiIFrame.java b/basiclti/web-ifp/src/java/org/sakaiproject/portlets/SakaiIFrame.java index 49948a28b45d..15e7c8410748 100644 --- a/basiclti/web-ifp/src/java/org/sakaiproject/portlets/SakaiIFrame.java +++ b/basiclti/web-ifp/src/java/org/sakaiproject/portlets/SakaiIFrame.java @@ -34,8 +34,8 @@ import java.util.List; import java.util.Enumeration; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.portlet.GenericPortlet; import javax.portlet.RenderRequest; @@ -54,8 +54,8 @@ import javax.portlet.ReadOnlyException; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.portlet.util.VelocityHelper; import org.sakaiproject.portlet.util.JSPHelper; @@ -93,7 +93,7 @@ */ public class SakaiIFrame extends GenericPortlet { - private static final Log M_log = LogFactory.getLog(SakaiIFrame.class); + private static final Logger M_log = LoggerFactory.getLogger(SakaiIFrame.class); private LTIService m_ltiService = (LTIService) ComponentManager.get("org.sakaiproject.lti.api.LTIService"); diff --git a/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/BaseCalendarService.java b/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/BaseCalendarService.java index c7d87683f569..e54a19090144 100644 --- a/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/BaseCalendarService.java +++ b/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/BaseCalendarService.java @@ -32,8 +32,8 @@ import org.apache.avalon.framework.logger.ConsoleLogger; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.fop.apps.Driver; import org.apache.fop.apps.FOPException; import org.apache.fop.apps.Options; @@ -109,7 +109,7 @@ public abstract class BaseCalendarService implements CalendarService, DoubleStorageUser, ContextObserver, EntityTransferrer, SAXEntityReader, EntityTransferrerRefMigrator { /** Our logger. */ - private static Log M_log = LogFactory.getLog(BaseCalendarService.class); + private static Logger M_log = LoggerFactory.getLogger(BaseCalendarService.class); /** The initial portion of a relative access point URL. */ protected String m_relativeAccessPoint = null; diff --git a/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/BaseExternalCalendarSubscriptionService.java b/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/BaseExternalCalendarSubscriptionService.java index 0a6a28fb16de..ff658b08b512 100644 --- a/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/BaseExternalCalendarSubscriptionService.java +++ b/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/BaseExternalCalendarSubscriptionService.java @@ -23,8 +23,8 @@ import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.SecurityService; import org.sakaiproject.calendar.api.Calendar; import org.sakaiproject.calendar.api.*; @@ -66,7 +66,7 @@ public class BaseExternalCalendarSubscriptionService implements ExternalCalendarSubscriptionService { /** Logging */ - private static Log m_log = LogFactory.getLog(BaseExternalCalendarSubscriptionService.class); + private static Logger m_log = LoggerFactory.getLogger(BaseExternalCalendarSubscriptionService.class); /** Schedule tool ID */ private final static String SCHEDULE_TOOL_ID = "sakai.schedule"; diff --git a/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/DbCalendarService.java b/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/DbCalendarService.java index 7a45e53d5929..0ca6b831016e 100644 --- a/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/DbCalendarService.java +++ b/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/DbCalendarService.java @@ -26,8 +26,8 @@ import java.util.GregorianCalendar; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.calendar.api.Calendar; import org.sakaiproject.calendar.api.CalendarEdit; import org.sakaiproject.calendar.api.CalendarEvent; @@ -45,7 +45,7 @@ public class DbCalendarService extends BaseCalendarService { /** Our logger. */ - private static Log M_log = LogFactory.getLog(DbCalendarService.class); + private static Logger M_log = LoggerFactory.getLogger(DbCalendarService.class); /** The name of the db table holding calendar calendars. */ protected String m_cTableName = "CALENDAR_CALENDAR"; diff --git a/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/ExclusionRecurrenceRule.java b/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/ExclusionRecurrenceRule.java index 62695b03761f..f0227a10134b 100644 --- a/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/ExclusionRecurrenceRule.java +++ b/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/ExclusionRecurrenceRule.java @@ -28,8 +28,8 @@ import java.util.TimeZone; import java.util.Vector; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.calendar.api.RecurrenceRule; import org.sakaiproject.time.api.Time; import org.sakaiproject.time.api.TimeRange; @@ -50,7 +50,7 @@ public class ExclusionRecurrenceRule implements RecurrenceRule { /** Our logger. */ - private static Log M_log = LogFactory.getLog(ExclusionRecurrenceRule.class); + private static Logger M_log = LoggerFactory.getLogger(ExclusionRecurrenceRule.class); /** The list of TimeRange values to exclude. */ protected List m_ranges = null; diff --git a/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/ExclusionSeqRecurrenceRule.java b/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/ExclusionSeqRecurrenceRule.java index 67a878a5ed19..dc73d1f9324d 100644 --- a/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/ExclusionSeqRecurrenceRule.java +++ b/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/ExclusionSeqRecurrenceRule.java @@ -28,8 +28,8 @@ import java.util.TimeZone; import java.util.Vector; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.calendar.api.RecurrenceRule; import org.sakaiproject.time.api.Time; import org.sakaiproject.time.api.TimeRange; @@ -49,7 +49,7 @@ public class ExclusionSeqRecurrenceRule implements RecurrenceRule { /** Our logger. */ - private static Log M_log = LogFactory.getLog(ExclusionSeqRecurrenceRule.class); + private static Logger M_log = LoggerFactory.getLogger(ExclusionSeqRecurrenceRule.class); /** The list of sequence number (Integer) values to exclude. */ protected List m_exclusions = null; diff --git a/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/GenericCalendarImporter.java b/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/GenericCalendarImporter.java index 770cb2038ec7..a2f4cfc42b4c 100644 --- a/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/GenericCalendarImporter.java +++ b/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/GenericCalendarImporter.java @@ -35,8 +35,8 @@ import java.util.Stack; import java.util.Vector; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.calendar.api.Calendar; import org.sakaiproject.calendar.api.CalendarEvent; import org.sakaiproject.calendar.api.CalendarEventEdit; @@ -67,7 +67,7 @@ public class GenericCalendarImporter implements CalendarImporterService { /** Our logger. */ - private static Log M_log = LogFactory.getLog(GenericCalendarImporter.class); + private static Logger M_log = LoggerFactory.getLogger(GenericCalendarImporter.class); public static final String LOCATION_PROPERTY_NAME = "Location"; diff --git a/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/OpaqueUrlDaoHbm.java b/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/OpaqueUrlDaoHbm.java index aa966be9fea2..0083abc57dc5 100644 --- a/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/OpaqueUrlDaoHbm.java +++ b/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/OpaqueUrlDaoHbm.java @@ -5,8 +5,8 @@ import java.util.List; import java.util.UUID; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.HibernateException; import org.hibernate.Session; import org.sakaiproject.calendar.api.OpaqueUrl; @@ -17,7 +17,7 @@ public class OpaqueUrlDaoHbm extends HibernateDaoSupport implements OpaqueUrlDao { - private static Log log = LogFactory.getLog(OpaqueUrlDaoHbm.class); + private static Logger log = LoggerFactory.getLogger(OpaqueUrlDaoHbm.class); public OpaqueUrl newOpaqueUrl(String userUUID, String calendarRef) { final OpaqueUrlHbm opaqueUrl = new OpaqueUrlHbm(userUUID, calendarRef, UUID.randomUUID().toString()); diff --git a/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/RecurrenceRuleBase.java b/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/RecurrenceRuleBase.java index 02b85cf547d3..89f5ee3d93bd 100644 --- a/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/RecurrenceRuleBase.java +++ b/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/RecurrenceRuleBase.java @@ -27,8 +27,8 @@ import java.util.TimeZone; import java.util.Vector; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.calendar.api.RecurrenceRule; import org.sakaiproject.time.api.Time; import org.sakaiproject.time.api.TimeBreakdown; @@ -47,7 +47,7 @@ */ public abstract class RecurrenceRuleBase implements RecurrenceRule { - protected static final Log M_log = LogFactory.getLog(RecurrenceRuleBase.class); + protected static final Logger M_log = LoggerFactory.getLogger(RecurrenceRuleBase.class); /** Every this many number of units: 1 would be daily/monthly/annually. */ private int interval = 1; diff --git a/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/SAK11204Fix.java b/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/SAK11204Fix.java index cf1a008fceeb..9796e37e81b5 100644 --- a/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/SAK11204Fix.java +++ b/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/SAK11204Fix.java @@ -28,8 +28,8 @@ import java.util.Iterator; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.calendar.api.Calendar; import org.sakaiproject.calendar.impl.BaseCalendarService.BaseCalendarEventEdit; import org.sakaiproject.component.api.ServerConfigurationService; @@ -40,7 +40,7 @@ */ public class SAK11204Fix { - private static final Log log = LogFactory.getLog(SAK11204Fix.class); + private static final Logger log = LoggerFactory.getLogger(SAK11204Fix.class); private static final int MIGRATE = 1; @@ -84,35 +84,25 @@ public void apply(boolean autoDDL) sqlService.ddl(this.getClass().getClassLoader(), "SAK-11204"); if (checkSAK11204ForUpgrade() == UPGRADE_SCHEMA) { - log - .fatal("SAK-11204: ============================================================================="); - log - .fatal("SAK-11204: Database Upgrade for SAK-11204 Failed, you must investigate and fix before"); - log - .fatal("SAK-11204: continuuing. I attempted to upgrade the schema but this appears to hav failed. You must"); - log - .fatal("SAK-11204: ensure that the columns RANGE_START(BIGINT) and RANGE_END(BIGINT) are present in CALENDAR_EVENT"); - log.fatal("SAK-11204: and there are indexes on both of the columns."); - log.fatal("SAK-11204: Thank you "); - log - .fatal("SAK-11204: ============================================================================="); + log.error("SAK-11204: ============================================================================="); + log.error("SAK-11204: Database Upgrade for SAK-11204 Failed, you must investigate and fix before"); + log.error("SAK-11204: continuuing. I attempted to upgrade the schema but this appears to hav failed. You must"); + log.error("SAK-11204: ensure that the columns RANGE_START(BIGINT) and RANGE_END(BIGINT) are present in CALENDAR_EVENT"); + log.error("SAK-11204: and there are indexes on both of the columns."); + log.error("SAK-11204: Thank you "); + log.error("SAK-11204: ============================================================================="); System.exit(-10); } } else { - log - .fatal("SAK-11204: ============================================================================="); - log - .fatal("SAK-11204: Database Upgrade for SAK-11204 Failed, you must investigate and fix before"); - log - .fatal("SAK-11204: continuuing. AutoDDL was OFF, so I could not change the database schema. You must"); - log - .fatal("SAK-11204: ensure that the columns RANGE_START(BIGINT) and RANGE_END(BIGINT) are present in CALENDAR_EVENT"); - log.fatal("SAK-11204: and there are indexes on both of the columns."); - log.fatal("SAK-11204: Thank you "); - log - .fatal("SAK-11204: ============================================================================="); + log.error("SAK-11204: ============================================================================="); + log.error("SAK-11204: Database Upgrade for SAK-11204 Failed, you must investigate and fix before"); + log.error("SAK-11204: continuuing. AutoDDL was OFF, so I could not change the database schema. You must"); + log.error("SAK-11204: ensure that the columns RANGE_START(BIGINT) and RANGE_END(BIGINT) are present in CALENDAR_EVENT"); + log.error("SAK-11204: and there are indexes on both of the columns."); + log.error("SAK-11204: Thank you "); + log.error("SAK-11204: ============================================================================="); System.exit(-10); } @@ -131,8 +121,7 @@ public void apply(boolean autoDDL) for (Iterator icalendars = calendars.iterator(); icalendars .hasNext();) { - log.info("SAK-11204: Converting Calendar " + i + " of " - + calendars.size()); + log.info("SAK-11204: Converting Calendar {} of {}", i, calendars.size()); i++; Calendar calendar = icalendars.next(); List levents = storage.getEvents(calendar); @@ -145,19 +134,14 @@ public void apply(boolean autoDDL) } } } - log.info("SAK-11204: Calendar Conversion Complete "); + log.info("SAK-11204: Calendar Conversion Complete"); if (forceUpgrade) { - log - .warn("SAK-11204: ========================================================================================================= "); - log - .warn("SAK-11204: This Conversion was forced, please ensure that you remove sak11204.forceupgrade from sakai.properties "); - log - .warn("SAK-11204: If you do not remove sak11204.forceupgrade from sakai.properties this conversion will be performed "); - log - .warn("SAK-11204: every time you start this instance of sakai, and it will take the same ammount of time "); - log - .warn("SAK-11204: ========================================================================================================= "); + log.warn("SAK-11204: ========================================================================================================= "); + log.warn("SAK-11204: This Conversion was forced, please ensure that you remove sak11204.forceupgrade from sakai.properties "); + log.warn("SAK-11204: If you do not remove sak11204.forceupgrade from sakai.properties this conversion will be performed "); + log.warn("SAK-11204: every time you start this instance of sakai, and it will take the same ammount of time "); + log.warn("SAK-11204: ========================================================================================================= "); } } @@ -183,22 +167,21 @@ private int checkSAK11204ForUpgrade() { long ntodo = rs.getLong(1); if ( ntodo == 0 ) { - log.debug("SAK-11204: Database has been migrated "); + log.debug("SAK-11204: Database has been migrated"); return OK; } else { - log.info("SAK-11204: Migration check, there are null range fields "); + log.info("SAK-11204: Migration check, there are null range fields"); return MIGRATE; } } else { - log.warn("SAK-11204: Could not count null range fields, assuming migrate "); + log.warn("SAK-11204: Could not count null range fields, assuming migrate"); return MIGRATE; } } catch (SQLException ex) { - log - .info("SAK-11204: Migration check, CALENDAR_EVENT schema not uptodate, test query said: " - + ex.getMessage()); + log.info("SAK-11204: Migration check, CALENDAR_EVENT schema not uptodate, test query said: {}", + ex.getMessage()); return UPGRADE_SCHEMA; } finally diff --git a/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/readers/ICalRecurrence.java b/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/readers/ICalRecurrence.java index 66623f9732df..d79f257b9b2d 100644 --- a/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/readers/ICalRecurrence.java +++ b/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/readers/ICalRecurrence.java @@ -14,8 +14,8 @@ import net.fortuna.ical4j.model.property.DateProperty; import net.fortuna.ical4j.model.property.RRule; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.calendar.impl.DailyRecurrenceRule; import org.sakaiproject.calendar.impl.MWFRecurrenceRule; import org.sakaiproject.calendar.impl.MonthlyRecurrenceRule; @@ -27,7 +27,7 @@ public class ICalRecurrence { - private static Log M_log = LogFactory.getLog(ICalRecurrence.class); + private static Logger M_log = LoggerFactory.getLogger(ICalRecurrence.class); private String rrule_text = ""; private RRule rrule = null; private Recur recur = null; diff --git a/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/readers/IcalendarReader.java b/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/readers/IcalendarReader.java index e0b76ccdf8dc..145ef60c4e24 100644 --- a/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/readers/IcalendarReader.java +++ b/calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/readers/IcalendarReader.java @@ -37,8 +37,8 @@ import net.fortuna.ical4j.model.property.DateProperty; import net.fortuna.ical4j.util.CompatibilityHints; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.calendar.impl.GenericCalendarImporter; import org.sakaiproject.exception.ImportException; import org.sakaiproject.time.api.TimeBreakdown; @@ -50,7 +50,7 @@ public class IcalendarReader extends Reader { private ResourceLoader rb = new ResourceLoader("calendar"); - private static Log M_log = LogFactory.getLog(IcalendarReader.class); + private static Logger M_log = LoggerFactory.getLogger(IcalendarReader.class); private Map defaultHeaderMap = getDefaultColumnMap(); private static final String CONTACT_SECTION_HEADER = "Contacts"; diff --git a/calendar/calendar-impl/impl/src/test/org/sakaiproject/calendar/impl/DbCalendarServiceSerializationTest.java b/calendar/calendar-impl/impl/src/test/org/sakaiproject/calendar/impl/DbCalendarServiceSerializationTest.java index 6e673a22059e..5498a6d900a0 100644 --- a/calendar/calendar-impl/impl/src/test/org/sakaiproject/calendar/impl/DbCalendarServiceSerializationTest.java +++ b/calendar/calendar-impl/impl/src/test/org/sakaiproject/calendar/impl/DbCalendarServiceSerializationTest.java @@ -36,8 +36,8 @@ import junit.framework.TestCase; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.calendar.impl.DbCalendarService.DbStorage; import org.sakaiproject.db.api.SqlReader; import org.sakaiproject.db.api.SqlService; @@ -58,7 +58,7 @@ public class DbCalendarServiceSerializationTest extends TestCase { - private static final Log log = LogFactory.getLog(DbCalendarServiceSerializationTest.class); + private static final Logger log = LoggerFactory.getLogger(DbCalendarServiceSerializationTest.class); private SqlService sqlService; private Entity container; private EntityManager entityManager; diff --git a/calendar/calendar-summary-tool/tool/src/java/org/sakaiproject/tool/summarycalendar/ui/CalendarBean.java b/calendar/calendar-summary-tool/tool/src/java/org/sakaiproject/tool/summarycalendar/ui/CalendarBean.java index 6d5478a3d07d..d3cf0057ba23 100644 --- a/calendar/calendar-summary-tool/tool/src/java/org/sakaiproject/tool/summarycalendar/ui/CalendarBean.java +++ b/calendar/calendar-summary-tool/tool/src/java/org/sakaiproject/tool/summarycalendar/ui/CalendarBean.java @@ -40,8 +40,8 @@ import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; import org.sakaiproject.authz.api.SecurityService; @@ -90,7 +90,7 @@ public class CalendarBean { private static final String MERGED_CALENDARS_PROP = "mergedCalendarReferences"; /** Our log (commons). */ - private static Log LOG = LogFactory.getLog(CalendarBean.class); + private static Logger LOG = LoggerFactory.getLogger(CalendarBean.class); /** Resource bundle */ private transient ResourceLoader msgs = new ResourceLoader("calendar"); diff --git a/calendar/calendar-summary-tool/tool/src/java/org/sakaiproject/tool/summarycalendar/ui/EventSummary.java b/calendar/calendar-summary-tool/tool/src/java/org/sakaiproject/tool/summarycalendar/ui/EventSummary.java index 77a2a48017d8..3d60176f994b 100644 --- a/calendar/calendar-summary-tool/tool/src/java/org/sakaiproject/tool/summarycalendar/ui/EventSummary.java +++ b/calendar/calendar-summary-tool/tool/src/java/org/sakaiproject/tool/summarycalendar/ui/EventSummary.java @@ -32,8 +32,8 @@ import javax.faces.convert.DateTimeConverter; import javax.print.attribute.standard.DateTimeAtCompleted; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.joda.time.DateTime; import org.joda.time.DateTimeComparator; import org.joda.time.DateTimeZone; @@ -74,7 +74,7 @@ public class EventSummary implements Serializable { private boolean openDateError = false; - private static Log LOG = LogFactory.getLog(EventSummary.class); + private static Logger LOG = LoggerFactory.getLogger(EventSummary.class); public String getDisplayName() { return displayName; diff --git a/calendar/calendar-summary-tool/tool/src/java/org/sakaiproject/tool/summarycalendar/ui/PrefsBean.java b/calendar/calendar-summary-tool/tool/src/java/org/sakaiproject/tool/summarycalendar/ui/PrefsBean.java index 02261aa47a95..3ccda29e874e 100644 --- a/calendar/calendar-summary-tool/tool/src/java/org/sakaiproject/tool/summarycalendar/ui/PrefsBean.java +++ b/calendar/calendar-summary-tool/tool/src/java/org/sakaiproject/tool/summarycalendar/ui/PrefsBean.java @@ -42,8 +42,8 @@ import javax.faces.el.ValueBinding; import javax.faces.model.SelectItem; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.entity.api.ResourceProperties; @@ -73,7 +73,7 @@ public class PrefsBean { public static String SAKPROP_BASE = "calendarSummary."; /** Our log (commons). */ - private static Log LOG = LogFactory.getLog(PrefsBean.class); + private static Logger LOG = LoggerFactory.getLogger(PrefsBean.class); /** Resource bundle */ private transient ResourceLoader msgs = new ResourceLoader("calendar"); diff --git a/calendar/calendar-tool/tool/src/java/org/sakaiproject/calendar/tool/CalendarAction.java b/calendar/calendar-tool/tool/src/java/org/sakaiproject/calendar/tool/CalendarAction.java index cd624c17e675..24bcb1f9fae4 100644 --- a/calendar/calendar-tool/tool/src/java/org/sakaiproject/calendar/tool/CalendarAction.java +++ b/calendar/calendar-tool/tool/src/java/org/sakaiproject/calendar/tool/CalendarAction.java @@ -46,8 +46,8 @@ import java.util.Map.Entry; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.alias.api.Alias; import org.sakaiproject.alias.api.AliasService; import org.sakaiproject.authz.api.PermissionsHelper; @@ -122,7 +122,7 @@ public class CalendarAction private static final long serialVersionUID = -8571818334710261359L; /** Our logger. */ - private static Log M_log = LogFactory.getLog(CalendarAction.class); + private static Logger M_log = LoggerFactory.getLogger(CalendarAction.class); /** Resource bundle using current language locale */ private static ResourceLoader rb = new ResourceLoader("calendar"); diff --git a/calendar/calendar-tool/tool/src/java/org/sakaiproject/calendar/tool/CalendarActionState.java b/calendar/calendar-tool/tool/src/java/org/sakaiproject/calendar/tool/CalendarActionState.java index f249c6a8e9bb..7ff66e55049e 100644 --- a/calendar/calendar-tool/tool/src/java/org/sakaiproject/calendar/tool/CalendarActionState.java +++ b/calendar/calendar-tool/tool/src/java/org/sakaiproject/calendar/tool/CalendarActionState.java @@ -27,8 +27,8 @@ import java.util.Map; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.calendar.api.CalendarEventEdit; import org.sakaiproject.cheftool.ControllerState; import org.sakaiproject.entity.cover.EntityManager; @@ -46,7 +46,7 @@ public class CalendarActionState implements SessionBindingListener { /** Our logger. */ - private static Log M_log = LogFactory.getLog(CalendarActionState.class); + private static Logger M_log = LoggerFactory.getLogger(CalendarActionState.class); private List wizardImportedEvents; diff --git a/calendar/calendar-util/util/src/java/org/sakaiproject/util/CalendarUtil.java b/calendar/calendar-util/util/src/java/org/sakaiproject/util/CalendarUtil.java index 1d762f3e2542..4fef28fd3010 100644 --- a/calendar/calendar-util/util/src/java/org/sakaiproject/util/CalendarUtil.java +++ b/calendar/calendar-util/util/src/java/org/sakaiproject/util/CalendarUtil.java @@ -27,8 +27,8 @@ import java.util.Date; import java.util.Locale; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.joda.time.DateTime; import org.joda.time.format.DateTimeFormatter; import org.joda.time.format.DateTimeFormatterBuilder; @@ -39,7 +39,7 @@ public class CalendarUtil { /** Our logger. */ - private static Log M_log = LogFactory.getLog(CalendarUtil.class); + private static Logger M_log = LoggerFactory.getLogger(CalendarUtil.class); /** The calendar object this is based upon. */ Calendar m_calendar = null; diff --git a/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatChannelEntityProvider.java b/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatChannelEntityProvider.java index 659f991d5213..558ecd714c3d 100644 --- a/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatChannelEntityProvider.java +++ b/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatChannelEntityProvider.java @@ -26,8 +26,8 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.chat2.model.ChatChannel; import org.sakaiproject.chat2.model.ChatManager; import org.sakaiproject.courier.api.CourierService; @@ -55,7 +55,7 @@ public class ChatChannelEntityProvider implements CoreEntityProvider, AutoRegist public final static String ENTITY_PREFIX = "chat-channel"; - protected final Log LOG = LogFactory.getLog(getClass()); + protected final Logger LOG = LoggerFactory.getLogger(getClass()); public class SimpleChatChannel { diff --git a/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatContentProducer.java b/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatContentProducer.java index 3a76eefcaaf9..53f0aa27ce51 100644 --- a/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatContentProducer.java +++ b/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatContentProducer.java @@ -32,8 +32,8 @@ import java.util.Map; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.chat2.model.ChatChannel; import org.sakaiproject.chat2.model.ChatManager; import org.sakaiproject.chat2.model.ChatMessage; @@ -62,7 +62,7 @@ */ public class ChatContentProducer implements EntityContentProducer { - protected final Log logger = LogFactory.getLog(getClass()); + protected final Logger logger = LoggerFactory.getLogger(getClass()); private SearchService searchService = null; private SearchIndexBuilder searchIndexBuilder = null; private EntityManager entityManager = null; @@ -235,7 +235,7 @@ protected String getMessageOwnerDisplayName(String user, String context) try { sender = UserDirectoryService.getUser(user); } catch(UserNotDefinedException e) { - logger.error(e); + logger.error(e.getMessage()); return user; } if (contextualUserDisplayService == null) { diff --git a/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatDataMigration.java b/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatDataMigration.java index 0f466d4a2792..567e1ba76292 100644 --- a/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatDataMigration.java +++ b/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatDataMigration.java @@ -30,8 +30,8 @@ import java.sql.Statement; import java.util.Date; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.chat2.model.ChatManager; import org.sakaiproject.db.api.SqlService; import org.sakaiproject.util.ResourceLoader; @@ -46,7 +46,7 @@ * */ public class ChatDataMigration { - protected final transient Log logger = LogFactory.getLog(getClass()); + protected final transient Logger logger = LoggerFactory.getLogger(getClass()); private boolean debug = false; diff --git a/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatEntityProducer.java b/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatEntityProducer.java index 0d957a1fd1a3..b499778eb0dc 100644 --- a/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatEntityProducer.java +++ b/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatEntityProducer.java @@ -38,8 +38,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.chat2.model.ChatChannel; import org.sakaiproject.chat2.model.ChatManager; import org.sakaiproject.chat2.model.ChatMessage; @@ -74,7 +74,7 @@ */ public class ChatEntityProducer implements EntityProducer, EntityTransferrer { - protected final Log logger = LogFactory.getLog(getClass()); + protected final Logger logger = LoggerFactory.getLogger(getClass()); private EntityManager entityManager; private ChatManager chatManager; diff --git a/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatManagerImpl.java b/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatManagerImpl.java index 3dfe6760a27d..296e464036db 100644 --- a/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatManagerImpl.java +++ b/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatManagerImpl.java @@ -36,8 +36,8 @@ import java.util.Observer; import org.apache.commons.lang.time.DateUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.Criteria; import org.hibernate.Session; import org.hibernate.criterion.Expression; @@ -81,7 +81,7 @@ public class ChatManagerImpl extends HibernateDaoSupport implements ChatManager, private int messagesMax = 100; - protected final transient Log logger = LogFactory.getLog(getClass()); + protected final transient Logger logger = LoggerFactory.getLogger(getClass()); /** the clients listening to the various rooms */ protected Map> roomListeners = new HashMap>(); @@ -962,9 +962,7 @@ protected void resetPlacementDefaultChannel(String context, String placement) { statement.close(); } catch (Exception e) { - if (logger.isDebugEnabled()) { - logger.debug(e); - } + logger.debug(e.getMessage()); } } try{ diff --git a/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatMessageEntityProvider.java b/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatMessageEntityProvider.java index c0669d553c72..fbd106db0741 100644 --- a/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatMessageEntityProvider.java +++ b/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatMessageEntityProvider.java @@ -26,8 +26,8 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.chat2.model.ChatChannel; import org.sakaiproject.chat2.model.ChatManager; import org.sakaiproject.chat2.model.ChatMessage; @@ -58,7 +58,7 @@ public class ChatMessageEntityProvider implements CoreEntityProvider, public final static String ENTITY_PREFIX = "chat-message"; - protected final Log LOG = LogFactory.getLog(getClass()); + protected final Logger LOG = LoggerFactory.getLogger(getClass()); // We use a custom object here to avoid side-effects of EB setting the body value for new messages, // and avoid returning unwanted fields for getting messages. diff --git a/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatRestDelivery.java b/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatRestDelivery.java index 49dc618c7770..56d575dca85d 100644 --- a/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatRestDelivery.java +++ b/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatRestDelivery.java @@ -21,8 +21,8 @@ package org.sakaiproject.chat2.model.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.chat2.model.ChatMessage; import org.sakaiproject.chat2.model.ChatManager; import org.sakaiproject.time.api.Time; @@ -45,7 +45,7 @@ public class ChatRestDelivery extends BaseDelivery { /** Our logger. */ - private static Log logger = LogFactory.getLog(ChatRestDelivery.class); + private static Logger logger = LoggerFactory.getLogger(ChatRestDelivery.class); /** The message. it could be a string id or the actual message. */ protected Object m_message = null; @@ -110,7 +110,7 @@ public String compose() try { sender = UserDirectoryService.getUser(message.getOwner()); } catch(UserNotDefinedException e) { - logger.error(e); + logger.error(e.getMessage()); } User myself = UserDirectoryService.getCurrentUser(); diff --git a/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatRestListener.java b/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatRestListener.java index 803274edf0ef..c3c8225b63d8 100644 --- a/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatRestListener.java +++ b/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatRestListener.java @@ -1,7 +1,7 @@ package org.sakaiproject.chat2.model.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.chat2.model.ChatChannel; import org.sakaiproject.chat2.model.ChatManager; import org.sakaiproject.chat2.model.PresenceObserver; @@ -15,7 +15,7 @@ public class ChatRestListener implements RoomObserver, PresenceObserver { private static final String IFRAME_ROOM_USERS = "Presence"; /** Our logger. */ - private static Log LOG = LogFactory.getLog(ChatRestListener.class); + private static Logger LOG = LoggerFactory.getLogger(ChatRestListener.class); /** The work-horse of chat */ private ChatManager chatManager; diff --git a/chat/chat-tool/tool/src/java/org/sakaiproject/chat2/tool/AlertDelivery.java b/chat/chat-tool/tool/src/java/org/sakaiproject/chat2/tool/AlertDelivery.java index 740919c3144f..85c747d839ce 100644 --- a/chat/chat-tool/tool/src/java/org/sakaiproject/chat2/tool/AlertDelivery.java +++ b/chat/chat-tool/tool/src/java/org/sakaiproject/chat2/tool/AlertDelivery.java @@ -21,8 +21,8 @@ package org.sakaiproject.chat2.tool; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.chat2.model.ChatMessage; import org.sakaiproject.time.api.Time; import org.sakaiproject.time.cover.TimeService; diff --git a/chat/chat-tool/tool/src/java/org/sakaiproject/chat2/tool/ChatDelivery.java b/chat/chat-tool/tool/src/java/org/sakaiproject/chat2/tool/ChatDelivery.java index d579d9ea2ac7..0346bdb93ff6 100644 --- a/chat/chat-tool/tool/src/java/org/sakaiproject/chat2/tool/ChatDelivery.java +++ b/chat/chat-tool/tool/src/java/org/sakaiproject/chat2/tool/ChatDelivery.java @@ -21,8 +21,8 @@ package org.sakaiproject.chat2.tool; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.chat2.model.ChatMessage; import org.sakaiproject.chat2.model.ChatManager; import org.sakaiproject.time.api.Time; @@ -47,7 +47,7 @@ public class ChatDelivery extends BaseDelivery implements Expirable { /** Our logger. */ - private static Log logger = LogFactory.getLog(ChatDelivery.class); + private static Logger logger = LoggerFactory.getLogger(ChatDelivery.class); /** The message. it could be a string id or the actual message. */ protected Object m_message = null; @@ -113,7 +113,7 @@ public String compose() } else { return ""; } - if (logger.isDebugEnabled()) logger.debug("compose() element: " + m_elementId + ", message: " + message.getId()); + logger.debug("compose() element: {}, message: {}", m_elementId, message.getId()); // generate a string of JavaScript commands to update the message log @@ -121,7 +121,7 @@ public String compose() try { sender = UserDirectoryService.getUser(message.getOwner()); } catch(UserNotDefinedException e) { - logger.error(e); + logger.error(e.getMessage()); } User myself = UserDirectoryService.getCurrentUser(); diff --git a/chat/chat-tool/tool/src/java/org/sakaiproject/chat2/tool/ChatTool.java b/chat/chat-tool/tool/src/java/org/sakaiproject/chat2/tool/ChatTool.java index fcfb8d19a04d..126ffab75b83 100644 --- a/chat/chat-tool/tool/src/java/org/sakaiproject/chat2/tool/ChatTool.java +++ b/chat/chat-tool/tool/src/java/org/sakaiproject/chat2/tool/ChatTool.java @@ -44,8 +44,8 @@ import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang.time.DateUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.PermissionsHelper; import org.sakaiproject.chat2.model.ChatMessage; import org.sakaiproject.chat2.model.ChatChannel; @@ -143,7 +143,7 @@ public class ChatTool implements RoomObserver, PresenceObserver { /** Our logger. */ - private static Log logger = LogFactory.getLog(ChatTool.class); + private static Logger logger = LoggerFactory.getLogger(ChatTool.class); /* */ private static final String IFRAME_ROOM_USERS = "Presence"; diff --git a/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/BaseCitationService.java b/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/BaseCitationService.java index 252777cbdabf..6eaad2dc7f76 100644 --- a/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/BaseCitationService.java +++ b/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/BaseCitationService.java @@ -32,8 +32,8 @@ import javax.servlet.http.HttpServletRequest; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.osid.repository.Asset; import org.osid.repository.Part; import org.osid.repository.PartIterator; @@ -1542,7 +1542,7 @@ public void importFromRis(InputStream ris) throws IOException */ public boolean importFromRisList(List risImportList) { - Log logger = LogFactory.getLog(BasicCitation.class); + Logger logger = LoggerFactory.getLogger(BasicCitation.class); String currentLine = null; // The active line being parsed from the list (e.g. "TY - BOOK") String RIScode = null; // The RIS Code (e.g. "TY" for "TY - BOOK") String RISvalue = null; // The RIS Value (e.g. "BOOK" for "TY - BOOK") @@ -4001,7 +4001,7 @@ public void setAddPrefix(boolean addPrefix) public static ResourceLoader rb; /** Our logger. */ - private static Log M_log = LogFactory.getLog(BaseCitationService.class); + private static Logger M_log = LoggerFactory.getLogger(BaseCitationService.class); protected static final String PROPERTY_DEFAULTVALUE = "sakai:defaultValue"; diff --git a/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/BaseConfigurationService.java b/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/BaseConfigurationService.java index cb39d0f4a8ed..23fae41d8e28 100644 --- a/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/BaseConfigurationService.java +++ b/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/BaseConfigurationService.java @@ -46,8 +46,8 @@ import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.SecurityAdvisor; import org.sakaiproject.authz.cover.SecurityService; import org.sakaiproject.citation.api.ConfigurationService; @@ -88,7 +88,7 @@ public class BaseConfigurationService implements ConfigurationService, Observer { - private static Log m_log = LogFactory.getLog(BaseConfigurationService.class); + private static Logger m_log = LoggerFactory.getLogger(BaseConfigurationService.class); /** * Locale that will be used if user's locale is not available. diff --git a/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/BaseSearchManager.java b/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/BaseSearchManager.java index 992c8cd35807..d7efed598b66 100644 --- a/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/BaseSearchManager.java +++ b/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/BaseSearchManager.java @@ -42,8 +42,8 @@ import java.util.TreeSet; import java.util.Vector; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.osid.OsidContext; import org.osid.OsidException; import org.osid.repository.Asset; @@ -1844,7 +1844,7 @@ public boolean isConfigured() { } // public class BasicSearchDatabaseHierarchy /** Our logger. */ - private static Log m_log = LogFactory.getLog(BaseSearchManager.class); + private static Logger m_log = LoggerFactory.getLogger(BaseSearchManager.class); // our ConfigurationService (gets set in BaseSearchDatabaseHierarchy) diff --git a/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/CitationListAccessServlet.java b/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/CitationListAccessServlet.java index e4e4203a66dd..668e4821df55 100644 --- a/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/CitationListAccessServlet.java +++ b/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/CitationListAccessServlet.java @@ -30,8 +30,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.citation.api.Citation; import org.sakaiproject.citation.api.CitationCollection; import org.sakaiproject.citation.api.CitationCollectionOrder; @@ -64,7 +64,7 @@ public class CitationListAccessServlet implements HttpAccess protected static ResourceLoader rb = new ResourceLoader("citations"); /** Our logger. */ - private static Log m_log = LogFactory.getLog(CitationListAccessServlet.class); + private static Logger m_log = LoggerFactory.getLogger(CitationListAccessServlet.class); private static final Collection specialKeys = new HashSet(); static { diff --git a/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/DbCitationService.java b/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/DbCitationService.java index 58807c5c0753..3fb5706bf54c 100644 --- a/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/DbCitationService.java +++ b/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/DbCitationService.java @@ -28,8 +28,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.citation.api.*; import org.sakaiproject.citation.api.Schema.Field; import org.sakaiproject.db.api.SqlReader; @@ -1800,7 +1800,7 @@ public Object readSqlResultRecord(ResultSet result) /* Connection management: Original auto-commit state (unknown, on, off) */ private static final int AUTO_UNKNOWN = 1; /** Our logger. */ - private static Log M_log = LogFactory.getLog(DbCitationService.class); + private static Logger M_log = LoggerFactory.getLogger(DbCitationService.class); protected static final Pattern MULTIVALUED_PATTERN = Pattern.compile("^(.*)\\t(\\d+)$"); protected static final String PROP_SORT_ORDER = "sakai:sort_order"; diff --git a/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/SakaiOsidLoader.java b/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/SakaiOsidLoader.java index 15a7350d4e1a..66f7e6a00876 100644 --- a/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/SakaiOsidLoader.java +++ b/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/SakaiOsidLoader.java @@ -21,8 +21,8 @@ package org.sakaiproject.citation.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * OsidLoader loads a specific implementation of an Open Service Interface @@ -89,7 +89,7 @@ */ public class SakaiOsidLoader implements java.io.Serializable { - private static Log M_log = LogFactory.getLog(SakaiOsidLoader.class); + private static Logger M_log = LoggerFactory.getLogger(SakaiOsidLoader.class); /** * Get an InputStream for a particular file name - first check the sakai.home area and then diff --git a/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/SampleSiteOsidConfiguration.java b/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/SampleSiteOsidConfiguration.java index 0b5f4f192f0f..f6bdf12cd084 100644 --- a/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/SampleSiteOsidConfiguration.java +++ b/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/SampleSiteOsidConfiguration.java @@ -1,8 +1,8 @@ -/******************************************************************************* - * $URL: - * $Id: - * ********************************************************************************** - * +/******************************************************************************* + * $URL: + * $Id: + * ********************************************************************************** + * * Copyright (c) 2006, 2007, 2008 The Sakai Foundation * * Licensed under the Educational Community License, Version 2.0 (the "License"); @@ -16,100 +16,100 @@ * 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.sakaiproject.citation.impl; - -import java.util.List; -import java.util.ArrayList; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.sakaiproject.citation.util.api.OsidConfigurationException; -import org.sakaiproject.citation.api.SiteOsidConfiguration; - -/** - * Sample Repository OSID configuration - */ -public class SampleSiteOsidConfiguration implements SiteOsidConfiguration -{ - private static Log _log = LogFactory.getLog(SampleSiteOsidConfiguration.class); - - /* - * Citation Helper XML database and configuration file names - * - * Set to null to force the use of values from components.xml - */ - public static final String CATEGORIES_XML = "categories.xml"; - public static final String CONFIGURATION_XML = "config.xml"; - - /* - * Group membership - */ - public static final String FULL_ACCESS_GROUP = "all"; - public static final String GUEST_ACCESS_GROUP = "free"; - - /** - * Simple public constructor - */ - public SampleSiteOsidConfiguration() - { - } - - /* - * Interface methods - */ - - /** - * Initialization - do whatever is appropriate here - */ - public void init() throws OsidConfigurationException - { - } - - /** - * Fetch the appropriate XML configuration document for this user. Typically, - * this will be a path relative to the root folder for citations configurations - * ( e.g. samples/config.xml) - *

- * Return null to force the use of the siteConfigXml property from - * components.xml - * - * @return Configuration XML (eg config.xml or samples/config.xml) - */ - public String getConfigurationXml() throws OsidConfigurationException - { - return CONFIGURATION_XML; - } - - /** - /** - * Fetch the appropriate XML database document for this user. Typically, - * this will be a path relative to the root folder for citations configurations - * ( e.g. samples/categories.xml) - *

- * Return null to force the use of the databaseXml property from - * components.xml - * - * @return Hierarchy XML (eg categories.xml or samples/categories.xml) - */ - public String getDatabaseHierarchyXml() throws OsidConfigurationException - { - return CATEGORIES_XML; - } - - /** - * Fetch this user's group affiliations (ALL in this example) - * @return A list of group ID strings (empty if no IDs exist) - */ - public List getGroupIds() throws OsidConfigurationException - { - ArrayList groupList = new ArrayList(); - - groupList.add(FULL_ACCESS_GROUP); - groupList.add(GUEST_ACCESS_GROUP); - - return groupList; - } -} \ No newline at end of file + * + ******************************************************************************/ +package org.sakaiproject.citation.impl; + +import java.util.List; +import java.util.ArrayList; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.sakaiproject.citation.util.api.OsidConfigurationException; +import org.sakaiproject.citation.api.SiteOsidConfiguration; + +/** + * Sample Repository OSID configuration + */ +public class SampleSiteOsidConfiguration implements SiteOsidConfiguration +{ + private static Logger _log = LoggerFactory.getLogger(SampleSiteOsidConfiguration.class); + + /* + * Citation Helper XML database and configuration file names + * + * Set to null to force the use of values from components.xml + */ + public static final String CATEGORIES_XML = "categories.xml"; + public static final String CONFIGURATION_XML = "config.xml"; + + /* + * Group membership + */ + public static final String FULL_ACCESS_GROUP = "all"; + public static final String GUEST_ACCESS_GROUP = "free"; + + /** + * Simple public constructor + */ + public SampleSiteOsidConfiguration() + { + } + + /* + * Interface methods + */ + + /** + * Initialization - do whatever is appropriate here + */ + public void init() throws OsidConfigurationException + { + } + + /** + * Fetch the appropriate XML configuration document for this user. Typically, + * this will be a path relative to the root folder for citations configurations + * ( e.g. samples/config.xml) + *

+ * Return null to force the use of the siteConfigXml property from + * components.xml + * + * @return Configuration XML (eg config.xml or samples/config.xml) + */ + public String getConfigurationXml() throws OsidConfigurationException + { + return CONFIGURATION_XML; + } + + /** + /** + * Fetch the appropriate XML database document for this user. Typically, + * this will be a path relative to the root folder for citations configurations + * ( e.g. samples/categories.xml) + *

+ * Return null to force the use of the databaseXml property from + * components.xml + * + * @return Hierarchy XML (eg categories.xml or samples/categories.xml) + */ + public String getDatabaseHierarchyXml() throws OsidConfigurationException + { + return CATEGORIES_XML; + } + + /** + * Fetch this user's group affiliations (ALL in this example) + * @return A list of group ID strings (empty if no IDs exist) + */ + public List getGroupIds() throws OsidConfigurationException + { + ArrayList groupList = new ArrayList(); + + groupList.add(FULL_ACCESS_GROUP); + groupList.add(GUEST_ACCESS_GROUP); + + return groupList; + } +} diff --git a/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/openurl/BookConverter.java b/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/openurl/BookConverter.java index 4f5bce155158..f94eeee35d4b 100644 --- a/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/openurl/BookConverter.java +++ b/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/openurl/BookConverter.java @@ -5,8 +5,8 @@ import org.apache.commons.collections.BidiMap; import org.apache.commons.collections.bidimap.TreeBidiMap; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.citation.api.Citation; import org.sakaiproject.citation.api.CitationService; @@ -17,7 +17,7 @@ */ public class BookConverter extends AbstractConverter implements Converter { - final static Log log = LogFactory.getLog(BookConverter.class); + final static Logger log = LoggerFactory.getLogger(BookConverter.class); public final static String ID = "info:ofi/fmt:kev:mtx:book"; diff --git a/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/openurl/JournalConverter.java b/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/openurl/JournalConverter.java index 0aed79e240f1..dccfdf72be29 100644 --- a/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/openurl/JournalConverter.java +++ b/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/openurl/JournalConverter.java @@ -6,8 +6,8 @@ import org.apache.commons.collections.BidiMap; import org.apache.commons.collections.bidimap.TreeBidiMap; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.citation.api.Citation; import org.sakaiproject.citation.api.CitationService; @@ -18,7 +18,7 @@ */ public class JournalConverter extends AbstractConverter { - private final static Log log = LogFactory.getLog(JournalConverter.class); + private final static Logger log = LoggerFactory.getLogger(JournalConverter.class); public final static String ID = "info:ofi/fmt:kev:mtx:journal"; diff --git a/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/openurl/KEVFormat.java b/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/openurl/KEVFormat.java index 79b2172de6d6..f48b419592b2 100644 --- a/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/openurl/KEVFormat.java +++ b/citations/citations-impl/impl/src/java/org/sakaiproject/citation/impl/openurl/KEVFormat.java @@ -7,8 +7,8 @@ import java.util.Map; import java.util.Map.Entry; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.citation.impl.openurl.ContextObject.Entity; /** @@ -17,7 +17,7 @@ */ public class KEVFormat implements Format { - private static final Log log = LogFactory.getLog(KEVFormat.class); + private static final Logger log = LoggerFactory.getLogger(KEVFormat.class); private static List entityFormatters = new ArrayList(); public static String FORMAT_ID = "info:ofi/fmt:kev:mtx:ctx"; diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/loader/OsidLoader.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/loader/OsidLoader.java index 17451feee832..04104c7df6fa 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/loader/OsidLoader.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/loader/OsidLoader.java @@ -63,8 +63,6 @@ *

*/ public class OsidLoader implements java.io.Serializable { - -private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(OsidLoader.class); /** * Returns an instance of the org.osid.OsidManager of the OSID specified by the OSID * package org.osid.OsidManager interface name and the implementation package name. diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/Asset.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/Asset.java index 8fbcc124b7dc..258f8ce73bfe 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/Asset.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/Asset.java @@ -20,14 +20,16 @@ * limitations under the License. * **********************************************************************************/ + +import lombok.extern.slf4j.Slf4j; + /** * @author Massachusetts Institute of Techbology, Sakai Software Development Team * @version */ +@Slf4j public class Asset extends edu.indiana.lib.osid.base.repository.Asset { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(Asset.class); - private org.osid.shared.Type assetType = new Type("mit.edu", "asset", "library_content"); private org.osid.shared.Type recordStructureType = new Type("mit.edu", "recordStructure", "library_content"); private org.osid.shared.Type dcRecordStructureType = new Type("mit.edu", "recordStructure", "dublinCore"); @@ -61,7 +63,7 @@ protected Asset(String displayName } catch (Throwable t) { - _log.error(t.getMessage()); + log.error(t.getMessage()); } } @@ -133,7 +135,7 @@ public org.osid.repository.Record createRecord(org.osid.shared.Id recordStructur } catch (Throwable t) { - _log.error(t.getMessage()); + log.error(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } @@ -160,7 +162,7 @@ public void deleteRecord(org.osid.shared.Id recordId) } catch (Throwable t) { - _log.error(t.getMessage()); + log.error(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } @@ -184,7 +186,7 @@ public org.osid.repository.RecordIterator getRecordsByRecordStructure(org.osid.s } catch (Throwable t) { - _log.error(t.getMessage()); + log.error(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } @@ -230,7 +232,7 @@ public org.osid.repository.Record getRecord(org.osid.shared.Id recordId) } catch (Throwable t) { - _log.error(t.getMessage()); + log.error(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } @@ -261,7 +263,7 @@ public org.osid.repository.Part getPart(org.osid.shared.Id partId) } catch (Throwable t) { - _log.error(t.getMessage()); + log.error(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } @@ -300,7 +302,7 @@ public org.osid.repository.PartIterator getPartByPart(org.osid.shared.Id partStr } catch (Throwable t) { - _log.error(t.getMessage()); + log.error(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } @@ -320,7 +322,7 @@ public org.osid.shared.ObjectIterator getPartValueByPart(org.osid.shared.Id part } catch (Throwable t) { - _log.error(t.getMessage()); + log.error(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } @@ -345,7 +347,7 @@ public org.osid.shared.ObjectIterator getPartValuesByPartStructure(org.osid.shar } catch (Throwable t) { - _log.error(t.getMessage()); + log.error(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } @@ -378,7 +380,7 @@ public org.osid.repository.PartIterator getPartsByPartStructure(org.osid.shared. } catch (Throwable t) { - _log.error(t.getMessage()); + log.error(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/AssetIterator.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/AssetIterator.java index b57ff5fad586..26b2d19d3c36 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/AssetIterator.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/AssetIterator.java @@ -3,6 +3,7 @@ import edu.indiana.lib.twinpeaks.net.*; import edu.indiana.lib.twinpeaks.search.*; import edu.indiana.lib.twinpeaks.util.*; +import lombok.extern.slf4j.Slf4j; import java.io.*; import java.net.*; @@ -33,10 +34,9 @@ * @author Massachusetts Institute of Techbology, Sakai Software Development Team * @version */ +@Slf4j public class AssetIterator extends edu.indiana.lib.osid.base.repository.AssetIterator { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(AssetIterator.class); - private org.osid.shared.Properties searchProperties; private org.osid.shared.Id repositoryId; /* @@ -96,7 +96,7 @@ protected AssetIterator(String database, } catch (Throwable throwable) { - _log.error("AssetIterator() " + throwable); + log.error("AssetIterator() ", throwable); throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.OPERATION_FAILED); } } @@ -120,11 +120,11 @@ protected void initialize(org.osid.shared.Properties searchProperties) throws or this.searchProperties = searchProperties; - _log.debug("AssetIterator max = " + getMaximumRecords() + ", page = " + pageSize + ", start = " + startRecord); + log.debug("AssetIterator max = " + getMaximumRecords() + ", page = " + pageSize + ", start = " + startRecord); } catch (Throwable throwable) { - _log.error("initialize() " + throwable); + log.error("initialize() " + throwable); throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.OPERATION_FAILED); } } @@ -140,7 +140,7 @@ public boolean hasNextAsset() { boolean moreRecords; - _log.debug("hasNextAsset: index=" + index + log.debug("hasNextAsset: index=" + index + ", maximum records=" + getMaximumRecords() + ", async init=" + StatusUtils.doingAsyncInit(sessionContext)); /* @@ -154,7 +154,7 @@ public boolean hasNextAsset() * Normal use, are there any more assets? */ moreRecords = (index < getMaximumRecords()); - _log.debug("AssetIterator.hasNext() = " + moreRecords); + log.debug("AssetIterator.hasNext() = " + moreRecords); if (!moreRecords) { @@ -164,7 +164,7 @@ public boolean hasNextAsset() } catch (Throwable throwable) { - _log.error("hasNextAsset() " + throwable); + log.error("hasNextAsset() " + throwable); throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.OPERATION_FAILED); } } @@ -192,7 +192,7 @@ public org.osid.repository.Asset nextAsset() /* * Additional assets should be available from the server */ - _log.debug("nextAsset: index=" + index + log.debug("nextAsset: index=" + index + ", populated=" + populated + ", async init=" + StatusUtils.doingAsyncInit(sessionContext)); @@ -218,7 +218,7 @@ public org.osid.repository.Asset nextAsset() } catch (SessionTimeoutException sessionTimeoutException) { - _log.error("nextAsset() session timeout: " + sessionTimeoutException); + log.error("nextAsset() session timeout: " + sessionTimeoutException); throw new MetasearchException(MetasearchException.SESSION_TIMED_OUT); } catch (SearchException searchException) @@ -232,12 +232,12 @@ public org.osid.repository.Asset nextAsset() /* * Unexpected error */ - _log.error("nextAsset() search exception: " + searchException); + log.error("nextAsset() search exception: " + searchException); throw new MetasearchException(MetasearchException.METASEARCH_ERROR); } catch (Throwable throwable) { - _log.error("nextAsset() general: ", throwable); + log.error("nextAsset() general: ", throwable); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } @@ -245,7 +245,7 @@ public org.osid.repository.Asset nextAsset() * Finally, return the next Asset from the queue */ asset = getAsset(); - _log.debug("AssetIterator.nextAsset() returns asset at index " + index + ", vector size = " + assetVectorSize()); + log.debug("AssetIterator.nextAsset() returns asset at index " + index + ", vector size = " + assetVectorSize()); return asset; } @@ -390,7 +390,7 @@ record = asset.createRecord(RecordStructure.getInstance().getId()); addAsset(asset); assetsAdded++; -// _log.debug("populate() Added " + asset +// log.debug("populate() Added " + asset // + ", vector size = " + assetVectorSize() // + ", populated = " + populated); diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/ContributorPartStructure.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/ContributorPartStructure.java index 08b03e9e524f..413565307c87 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/ContributorPartStructure.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/ContributorPartStructure.java @@ -25,13 +25,10 @@ * @version */ - + public class ContributorPartStructure extends edu.indiana.lib.osid.base.repository.PartStructure { - - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(ContributorPartStructure.class); - private org.osid.shared.Id CONTRIBUTOR_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type("mit.edu","partStructure","contributor","Contributor"); private String displayName = "Contributor"; diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/CoveragePartStructure.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/CoveragePartStructure.java index 59e5c4441d5c..d1f59ccbd2cc 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/CoveragePartStructure.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/CoveragePartStructure.java @@ -26,8 +26,6 @@ */ public class CoveragePartStructure extends edu.indiana.lib.osid.base.repository.PartStructure { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(CoveragePartStructure.class); - private org.osid.shared.Id COVERAGE_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type("mit.edu","partStructure","coverage","Coverage"); private String displayName = "Coverage"; diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/CreatorPartStructure.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/CreatorPartStructure.java index 2e94a5ee9ab3..88f2a7e30540 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/CreatorPartStructure.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/CreatorPartStructure.java @@ -26,8 +26,6 @@ */ public class CreatorPartStructure extends edu.indiana.lib.osid.base.repository.PartStructure { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(CreatorPartStructure.class); - private org.osid.shared.Id CREATOR_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type("mit.edu","partStructure","creator","creator"); private String displayName = "Creator"; diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/DOIPartStructure.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/DOIPartStructure.java index 96762390ed6f..f353de2b0ec0 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/DOIPartStructure.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/DOIPartStructure.java @@ -19,8 +19,6 @@ public class DOIPartStructure implements org.osid.repository.PartStructure { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(DOIPartStructure.class); - private org.osid.shared.Id DOI_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "sakaibrary", "partStructure", "doi", "Digital Object Identifier" ); diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/DatePartStructure.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/DatePartStructure.java index 5ff5f7ab198c..3350d9560351 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/DatePartStructure.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/DatePartStructure.java @@ -26,9 +26,6 @@ */ public class DatePartStructure extends edu.indiana.lib.osid.base.repository.PartStructure { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(DatePartStructure.class); - - private org.osid.shared.Id DATE_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type("mit.edu","partStructure","date","Date"); private String displayName = "Date"; diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/DateRetrievedPartStructure.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/DateRetrievedPartStructure.java index ab5064fd4a6a..f7caaf82b6a5 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/DateRetrievedPartStructure.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/DateRetrievedPartStructure.java @@ -3,10 +3,6 @@ public class DateRetrievedPartStructure implements org.osid.repository.PartStructure { - - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(DateRetrievedPartStructure.class); - - private org.osid.shared.Id DATE_RETRIEVED_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "sakaibrary", "partStructure", "dateRetrieved", "Date Retrieved" ); diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/EditionPartStructure.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/EditionPartStructure.java index 94ef76ee19f6..5203783ca92a 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/EditionPartStructure.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/EditionPartStructure.java @@ -1,10 +1,10 @@ package edu.indiana.lib.osid.base.repository.http; +import lombok.extern.slf4j.Slf4j; + +@Slf4j public class EditionPartStructure implements org.osid.repository.PartStructure { - - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(EditionPartStructure.class); - private org.osid.shared.Id EDITION_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "sakaibrary", "partStructure", "edition", "Edition of resource container (i.e. book, 2nd edition)" ); diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/EndPagePartStructure.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/EndPagePartStructure.java index 2d0e9fabac58..69ed5e3f95cb 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/EndPagePartStructure.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/EndPagePartStructure.java @@ -19,8 +19,6 @@ public class EndPagePartStructure implements org.osid.repository.PartStructure { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(EndPagePartStructure.class); - private org.osid.shared.Id END_PAGE_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "sakaibrary", "partStructure", "endPage", "Page number that the resource content ends on" ); diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/FormatPartStructure.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/FormatPartStructure.java index 47574fd454b7..1cabbf8a7dff 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/FormatPartStructure.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/FormatPartStructure.java @@ -26,8 +26,6 @@ */ public class FormatPartStructure extends edu.indiana.lib.osid.base.repository.PartStructure { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(FormatPartStructure.class); - private org.osid.shared.Id FORMAT_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type("mit.edu","partStructure","format"); private String displayName = "Format"; diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/InLineCitationPartStructure.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/InLineCitationPartStructure.java index 5a8cf01de3fe..2baa1fd7f8ab 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/InLineCitationPartStructure.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/InLineCitationPartStructure.java @@ -3,8 +3,6 @@ public class InLineCitationPartStructure implements org.osid.repository.PartStructure { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(InLineCitationPartStructure.class); - private org.osid.shared.Id INLINE_CITATION_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "sakaibrary", "partStructure", "inLineCitation", "In-line Citation from resource metadata" ); diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/IsnIdentifierPartStructure.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/IsnIdentifierPartStructure.java index 5bf2689756bc..b2202e1be753 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/IsnIdentifierPartStructure.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/IsnIdentifierPartStructure.java @@ -20,8 +20,6 @@ public class IsnIdentifierPartStructure implements org.osid.repository.PartStructure { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(IsnIdentifierPartStructure.class); - private org.osid.shared.Id ISN_IDENTIFIER_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "sakaibrary", "partStructure", "isnIdentifier", "International Standard Number" ); diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/IssuePartStructure.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/IssuePartStructure.java index 4a72c555f566..e3223374e53b 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/IssuePartStructure.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/IssuePartStructure.java @@ -19,8 +19,6 @@ public class IssuePartStructure implements org.osid.repository.PartStructure { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(IssuePartStructure.class); - private org.osid.shared.Id ISSUE_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "sakaibrary", "partStructure", "issue", "Issue of resource container (i.e. Journal title, issue " + diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/LanguagePartStructure.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/LanguagePartStructure.java index 2312d6c34ddc..e1771ad56d30 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/LanguagePartStructure.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/LanguagePartStructure.java @@ -26,8 +26,6 @@ */ public class LanguagePartStructure extends edu.indiana.lib.osid.base.repository.PartStructure { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(LanguagePartStructure.class); - private org.osid.shared.Id LANGUAGE_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type("mit.edu","partStructure","language","Language"); private String displayName = "Language"; diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/Logger.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/Logger.java index fdcea17f8463..967f2f00c0de 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/Logger.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/Logger.java @@ -36,7 +36,7 @@ public void initialize(org.osid.logging.WritableLog log) } /** - * Log a message + * Logger a message */ public void log(String entry) throws org.osid.repository.RepositoryException diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/LongValueIterator.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/LongValueIterator.java index e52ce91230b4..402a1e788765 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/LongValueIterator.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/LongValueIterator.java @@ -26,8 +26,6 @@ */ public class LongValueIterator extends edu.indiana.lib.osid.base.repository.LongValueIterator { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(LongValueIterator.class); - private java.util.Vector vector = new java.util.Vector(); private int i = 0; diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/Managers.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/Managers.java index f112afd3d681..e60c8194b4fd 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/Managers.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/Managers.java @@ -27,8 +27,6 @@ public class Managers extends edu.indiana.lib.osid.base.repository.Managers { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(Managers.class); - private static Managers managers = new Managers(); private static org.osid.id.IdManager idManager = null; diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/MetasearchException.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/MetasearchException.java index bde5cc9028f7..c2ad90c8d87e 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/MetasearchException.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/MetasearchException.java @@ -2,8 +2,6 @@ public class MetasearchException extends org.osid.repository.RepositoryException { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(MetasearchException.class); - public static final String SESSION_TIMED_OUT = "Metasearch session has " + "timed out. Please restart your search session."; public static final String METASEARCH_ERROR = "Metasearch error has occured. Please contact your site's support team."; diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/NotePartStructure.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/NotePartStructure.java index 6b18b08c0646..d9fadc204656 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/NotePartStructure.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/NotePartStructure.java @@ -2,7 +2,6 @@ public class NotePartStructure implements org.osid.repository.PartStructure { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(NotePartStructure.class); private org.osid.shared.Id NOTE_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "sakaibrary", "partStructure", "note", "Note attached to resource metadata" ); diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/ObjectIterator.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/ObjectIterator.java index c768813a8067..0a053c9c382b 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/ObjectIterator.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/ObjectIterator.java @@ -26,8 +26,6 @@ */ public class ObjectIterator extends edu.indiana.lib.osid.base.repository.ObjectIterator { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(ObjectIterator.class); - private java.util.Vector vector = new java.util.Vector(); private int i = 0; diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/OpenUrlPartStructure.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/OpenUrlPartStructure.java index 4fccd6ecefb7..b65ea1300751 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/OpenUrlPartStructure.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/OpenUrlPartStructure.java @@ -19,8 +19,6 @@ public class OpenUrlPartStructure implements org.osid.repository.PartStructure { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(OpenUrlPartStructure.class); - private org.osid.shared.Id OPENURL_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "sakaibrary", "partStructure", "openUrl", "OpenURL" ); diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/PagesPartStructure.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/PagesPartStructure.java index d7f9c62db2e2..9905a9ff5a61 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/PagesPartStructure.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/PagesPartStructure.java @@ -2,8 +2,6 @@ public class PagesPartStructure implements org.osid.repository.PartStructure { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(PagesPartStructure.class); - private org.osid.shared.Id PAGES_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "sakaibrary", "partStructure", "pages", "Pages" ); diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/Part.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/Part.java index 8cc542f8d8f1..72ee9570541a 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/Part.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/Part.java @@ -20,14 +20,16 @@ * limitations under the License. * **********************************************************************************/ + +import lombok.extern.slf4j.Slf4j; + /** * @author Massachusetts Institute of Techbology, Sakai Software Development Team * @version */ +@Slf4j public class Part extends edu.indiana.lib.osid.base.repository.Part { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(Part.class); - private org.osid.repository.PartStructure partStructure = null; private org.osid.shared.Id partStructureId = null; private java.io.Serializable value = null; @@ -153,7 +155,7 @@ protected Part(org.osid.shared.Id partStructureId } catch (Throwable t) { - _log.error(t.getMessage()); + log.error(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.repository.RepositoryException.OPERATION_FAILED); } } diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/PartIterator.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/PartIterator.java index f11100c596b4..c968e8b37dff 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/PartIterator.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/PartIterator.java @@ -26,8 +26,6 @@ */ public class PartIterator extends edu.indiana.lib.osid.base.repository.PartIterator { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(PartIterator.class); - private java.util.Vector vector = new java.util.Vector(); private int i = 0; diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/PartStructureIterator.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/PartStructureIterator.java index f3193056fec9..a9175c2d7aff 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/PartStructureIterator.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/PartStructureIterator.java @@ -27,8 +27,6 @@ public class PartStructureIterator implements org.osid.repository.PartStructureIterator { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(PartStructureIterator.class); - private java.util.Vector vector = new java.util.Vector(); private int i = 0; diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/PreferredUrlPartStructure.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/PreferredUrlPartStructure.java index f0bb65fbf9fd..c3ef1017ef12 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/PreferredUrlPartStructure.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/PreferredUrlPartStructure.java @@ -19,8 +19,6 @@ public class PreferredUrlPartStructure implements org.osid.repository.PartStructure { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(PreferredUrlPartStructure.class); - private org.osid.shared.Id PREFERREDURL_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "sakaibrary", "partStructure", diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/Properties.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/Properties.java index 5ccf12db6e2b..df8579894ca9 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/Properties.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/Properties.java @@ -26,8 +26,6 @@ */ public class Properties extends edu.indiana.lib.osid.base.repository.Properties { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(Properties.class); - public org.osid.shared.ObjectIterator getKeys() throws org.osid.shared.SharedException { diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/PropertiesIterator.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/PropertiesIterator.java index 2f4e9d12a0a3..e80895e1ff46 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/PropertiesIterator.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/PropertiesIterator.java @@ -26,8 +26,6 @@ */ public class PropertiesIterator extends edu.indiana.lib.osid.base.repository.PropertiesIterator { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(PropertiesIterator.class); - private java.util.Vector vector = new java.util.Vector(); private int i = 0; diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/PublicationLocationPartStructure.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/PublicationLocationPartStructure.java index de3b967a3fe3..248644d25e2d 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/PublicationLocationPartStructure.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/PublicationLocationPartStructure.java @@ -3,8 +3,6 @@ public class PublicationLocationPartStructure implements org.osid.repository.PartStructure { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(PublicationLocationPartStructure.class); - private org.osid.shared.Id PUBLICATION_LOCATION_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "sakaibrary", "partStructure", "publicationLocation", "Publication Location" ); diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/PublisherPartStructure.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/PublisherPartStructure.java index 202f75f22306..5be3b5fb5bc6 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/PublisherPartStructure.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/PublisherPartStructure.java @@ -26,8 +26,6 @@ */ public class PublisherPartStructure extends edu.indiana.lib.osid.base.repository.PartStructure { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(PublisherPartStructure.class); - private org.osid.shared.Id PUBLISHER_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type("mit.edu","partStructure","publisher","Publisher"); private String displayName = "Publisher"; diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/Record.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/Record.java index aff34f3d560f..0defdbea4ff3 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/Record.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/Record.java @@ -20,14 +20,16 @@ * limitations under the License. * **********************************************************************************/ + +import lombok.extern.slf4j.Slf4j; + /** * @author Massachusetts Institute of Techbology, Sakai Software Development Team * @version */ +@Slf4j public class Record extends edu.indiana.lib.osid.base.repository.Record { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(Record.class); - private java.util.Vector partVector = new java.util.Vector(); private org.osid.id.IdManager idManager = null; private org.osid.shared.Id recordStructureId = null; @@ -59,7 +61,7 @@ protected Record(org.osid.shared.Id recordStructureId } catch (Throwable t) { - _log.error(t.getMessage()); + log.error(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } @@ -76,7 +78,7 @@ public org.osid.repository.Part createPart(org.osid.shared.Id partStructureId } catch (Throwable t) { - _log.error(t.getMessage()); + log.error(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } @@ -99,7 +101,7 @@ public void deletePart(org.osid.shared.Id partId) } catch (Throwable t) { - _log.error(t.getMessage()); + log.error(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } @@ -126,7 +128,7 @@ public org.osid.repository.RecordStructure getRecordStructure() } catch (Throwable t) { - _log.error(t.getMessage()); + log.error(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/RecordIterator.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/RecordIterator.java index 36e07286c693..33725c3ecccf 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/RecordIterator.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/RecordIterator.java @@ -27,8 +27,6 @@ */ public class RecordIterator extends edu.indiana.lib.osid.base.repository.RecordIterator { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(RecordIterator.class); - private java.util.Vector vector = new java.util.Vector(); private int i = 0; diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/RecordStructure.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/RecordStructure.java index a8c41d423566..5092a466fdfc 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/RecordStructure.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/RecordStructure.java @@ -20,14 +20,16 @@ * limitations under the License. * **********************************************************************************/ + +import lombok.extern.slf4j.Slf4j; + /** * @author Massachusetts Institute of Techbology, Sakai Software Development Team * @version */ +@Slf4j public class RecordStructure extends edu.indiana.lib.osid.base.repository.RecordStructure { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(RecordStructure.class); - private String idString = "af106d4f201080006d751920168000100"; private String displayName = "Library Content"; private String description = "Holds metadata for an asset of no particular kind"; @@ -51,7 +53,7 @@ protected RecordStructure() } catch (Throwable t) { - _log.warn(t.getMessage()); + log.warn(t.getMessage()); } } diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/RecordStructureIterator.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/RecordStructureIterator.java index ad69eb873fc1..3ef52a92b235 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/RecordStructureIterator.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/RecordStructureIterator.java @@ -20,14 +20,16 @@ * limitations under the License. * **********************************************************************************/ + +import lombok.extern.slf4j.Slf4j; + /** * @author Massachusetts Institute of Techbology, Sakai Software Development Team * @version */ +@Slf4j public class RecordStructureIterator extends edu.indiana.lib.osid.base.repository.RecordStructureIterator { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(RecordStructureIterator.class); - private java.util.Vector vector = new java.util.Vector(); private int i = 0; diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/RelationPartStructure.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/RelationPartStructure.java index 6c1388549119..7b76e32c1541 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/RelationPartStructure.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/RelationPartStructure.java @@ -26,8 +26,6 @@ */ public class RelationPartStructure extends edu.indiana.lib.osid.base.repository.PartStructure { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(RelationPartStructure.class); - private org.osid.shared.Id RELATION_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type("mit.edu","partStructure","relation","Relation"); private String displayName = "Relation"; diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/Repository.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/Repository.java index 65bee56085ae..24e5587fcdf3 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/Repository.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/Repository.java @@ -13,15 +13,14 @@ import javax.xml.parsers.*; +import lombok.extern.slf4j.Slf4j; import org.w3c.dom.*; import org.w3c.dom.html.*; import org.xml.sax.*; - +@Slf4j public class Repository extends edu.indiana.lib.osid.base.repository.Repository { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(Repository.class); - private java.util.Vector assetVector = new java.util.Vector(); private org.osid.id.IdManager idManager = null; @@ -75,20 +74,20 @@ protected Repository(String displayName, } catch (Throwable t) { - _log.error(t.getMessage()); + log.error(t.getMessage()); } if (this.id == null) { - _log.debug("Could not set HTTP Repository() " + displayName); + log.debug("Could not set HTTP Repository() " + displayName); return; } - _log.debug("new HTTP Repository(): " + displayName + ", id: " + this.id); + log.debug("new HTTP Repository(): " + displayName + ", id: " + this.id); try { - _log.debug(" HTTP Repository(): " + this.id.getIdString() + ", is equal? " + this.id.isEqual(idManager.getId(this.idString))); + log.debug(" HTTP Repository(): " + this.id.getIdString() + ", is equal? " + this.id.isEqual(idManager.getId(this.idString))); } catch (Throwable ignore) { } } @@ -128,7 +127,7 @@ public org.osid.shared.TypeIterator getAssetTypes() } catch (Throwable t) { - _log.error(t.getMessage()); + log.error(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } @@ -167,7 +166,7 @@ public org.osid.shared.TypeIterator getSearchTypes() } catch (Throwable t) { - _log.error(t.getMessage()); + log.error(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } @@ -183,7 +182,7 @@ public org.osid.shared.TypeIterator getStatusTypes() } catch (Throwable t) { - _log.error(t.getMessage()); + log.error(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } @@ -281,7 +280,7 @@ public boolean validateAsset(org.osid.shared.Id assetId) catch (Throwable throwable) { throwable.printStackTrace(); - _log.error(throwable.getMessage()); + log.error(throwable.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } @@ -325,7 +324,7 @@ public org.osid.shared.PropertiesIterator getProperties() } catch (Throwable throwable) { - _log.error(throwable.getMessage()); + log.error(throwable.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } @@ -373,7 +372,7 @@ public org.osid.shared.TypeIterator getPropertyTypes() } catch (Throwable t) { - _log.error(t.getMessage()); + log.error(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } @@ -452,7 +451,7 @@ private org.osid.shared.Properties getStatusProperties(String sessionId) statusMap.put(entry.getKey(), singleMap); } - _log.debug(this.getDisplayName() + ": " + active + " searches active"); + log.debug(this.getDisplayName() + ": " + active + " searches active"); statusMap.put("databaseNames", dbList); @@ -469,7 +468,7 @@ private org.osid.shared.Properties getStatusProperties(String sessionId) } catch (Throwable throwable) { - _log.error(throwable.getMessage()); + log.error(throwable.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/RepositoryIterator.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/RepositoryIterator.java index cc4f1a0707ea..694491114276 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/RepositoryIterator.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/RepositoryIterator.java @@ -26,8 +26,6 @@ */ public class RepositoryIterator extends edu.indiana.lib.osid.base.repository.RepositoryIterator { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(RepositoryIterator.class); - private java.util.Vector vector = new java.util.Vector(); private int i = 0; diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/RepositoryManager.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/RepositoryManager.java index cf9a7d1ac96c..7964ff270d1e 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/RepositoryManager.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/RepositoryManager.java @@ -5,6 +5,7 @@ import edu.indiana.lib.twinpeaks.search.*; import edu.indiana.lib.twinpeaks.util.*; +import lombok.extern.slf4j.Slf4j; /********************************************************************************** @@ -31,10 +32,9 @@ * @author Massachusetts Institute of Techbology, Sakai Software Development Team * @version */ +@Slf4j public class RepositoryManager extends edu.indiana.lib.osid.base.repository.RepositoryManager { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(RepositoryManager.class); - private org.osid.repository.Repository repository = null; private org.osid.id.IdManager idManager = null; private org.osid.OsidContext context = null; @@ -85,7 +85,7 @@ public void assignConfiguration(java.util.Properties configuration) } catch (Throwable t) { - _log.error(t.getMessage()); + log.error(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } finally @@ -133,15 +133,15 @@ public void assignConfiguration(java.util.Properties configuration) continue; } - _log.debug("name = " + ss.getName()); - _log.debug("description = " + ss.getDescription()); - _log.debug("id = " + ss.getId()); - _log.debug("authority = " + ss.getAuthority()); - _log.debug("domain = " + ss.getDomain()); - _log.debug("searchType = " + ss.getSearchType()); - _log.debug("query handler = " + ss.getQueryHandlerClassName()); - _log.debug("result handler = " + ss.getSearchResultHandlerClassName()); - _log.debug("osid context = " + this.context); + log.debug("name = " + ss.getName()); + log.debug("description = " + ss.getDescription()); + log.debug("id = " + ss.getId()); + log.debug("authority = " + ss.getAuthority()); + log.debug("domain = " + ss.getDomain()); + log.debug("searchType = " + ss.getSearchType()); + log.debug("query handler = " + ss.getQueryHandlerClassName()); + log.debug("result handler = " + ss.getSearchResultHandlerClassName()); + log.debug("osid context = " + this.context); /* * Set up the search-type and add the new Repository */ @@ -158,7 +158,7 @@ public void assignConfiguration(java.util.Properties configuration) } catch (Throwable t) { - _log.error(t.getMessage()); + log.error(t.getMessage()); if (t instanceof org.osid.repository.RepositoryException) { @@ -222,7 +222,7 @@ public org.osid.repository.Repository getRepository(org.osid.shared.Id repositor } catch (Throwable t) { - _log.error(t.getMessage()); + log.error(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } @@ -250,7 +250,7 @@ public org.osid.repository.Asset getAsset(org.osid.shared.Id assetId) } catch (Throwable t) { - _log.error(t.getMessage()); + log.error(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.UNKNOWN_ID); @@ -280,7 +280,7 @@ public org.osid.repository.Asset getAssetByDate(org.osid.shared.Id assetId } catch (Throwable t) { - _log.error(t.getMessage()); + log.error(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.UNKNOWN_ID); @@ -310,7 +310,7 @@ public org.osid.shared.LongValueIterator getAssetDates(org.osid.shared.Id assetI } catch (Throwable t) { - _log.error(t.getMessage()); + log.error(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } @@ -343,14 +343,14 @@ public org.osid.repository.AssetIterator getAssetsBySearch(org.osid.repository.R } catch (Throwable t) { - _log.warn(t.getMessage()); + log.warn(t.getMessage()); } } return new AssetIterator(results); } catch (Throwable t) { - _log.error(t.getMessage()); + log.error(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } @@ -377,7 +377,7 @@ public org.osid.shared.TypeIterator getRepositoryTypes() } catch (Throwable t) { - _log.error(t.getMessage()); + log.error(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/RightsPartStructure.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/RightsPartStructure.java index ccf1dc772e8e..0f0668db3909 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/RightsPartStructure.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/RightsPartStructure.java @@ -18,9 +18,6 @@ *******************************************************************************/ public class RightsPartStructure implements org.osid.repository.PartStructure { - - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(RightsPartStructure.class); - private org.osid.shared.Id RIGHTS_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "mit.edu", "partStructure", "rights", "Rights" ); diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/SharedProperties.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/SharedProperties.java index 69986047288e..3036d2951321 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/SharedProperties.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/SharedProperties.java @@ -3,8 +3,6 @@ public class SharedProperties implements org.osid.shared.Properties { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(SharedProperties.class); - private java.util.Map map = new java.util.HashMap(); private org.osid.shared.Type type = new Type("edu.mit","shared","empty"); diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/SourcePartStructure.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/SourcePartStructure.java index d7e82066fe4b..9757459f231c 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/SourcePartStructure.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/SourcePartStructure.java @@ -26,8 +26,6 @@ */ public class SourcePartStructure extends edu.indiana.lib.osid.base.repository.PartStructure { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(SourcePartStructure.class); - private org.osid.shared.Id SOURCE_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type("mit.edu","partStructure","source"); private String displayName = "Source"; diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/SourceTitlePartStructure.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/SourceTitlePartStructure.java index fd03b9ebcea9..dfd9b74a6846 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/SourceTitlePartStructure.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/SourceTitlePartStructure.java @@ -20,8 +20,6 @@ public class SourceTitlePartStructure implements org.osid.repository.PartStructure { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(SourceTitlePartStructure.class); - private org.osid.shared.Id SOURCE_TITLE_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type("sakaibrary", "partStructure", "sourceTitle", "Source Title" ); diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/StartPagePartStructure.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/StartPagePartStructure.java index 1056a4702406..944f993d94fd 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/StartPagePartStructure.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/StartPagePartStructure.java @@ -19,8 +19,6 @@ public class StartPagePartStructure implements org.osid.repository.PartStructure { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(StartPagePartStructure.class); - private org.osid.shared.Id START_PAGE_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "sakaibrary", "partStructure", "startPage", "Page number that resource content begins on" ); diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/SubjectPartStructure.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/SubjectPartStructure.java index e45107652da5..19094dfe54aa 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/SubjectPartStructure.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/SubjectPartStructure.java @@ -26,8 +26,6 @@ */ public class SubjectPartStructure extends edu.indiana.lib.osid.base.repository.PartStructure { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(SubjectPartStructure.class); - private org.osid.shared.Id SUBJECT_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type("mit.edu","partStructure","subject","Subject"); private String displayName = "Subject"; diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/Type.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/Type.java index dc373c1614e7..e55e1dd4d55d 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/Type.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/Type.java @@ -26,8 +26,6 @@ */ public class Type extends edu.indiana.lib.osid.base.repository.Type { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(Type.class); - protected Type(String authority , String domain , String keyword diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/TypeIterator.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/TypeIterator.java index 967d06623774..ecbe6cbf8059 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/TypeIterator.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/TypeIterator.java @@ -26,8 +26,6 @@ */ public class TypeIterator extends edu.indiana.lib.osid.base.repository.TypeIterator { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(TypeIterator.class); - private java.util.Vector vector = new java.util.Vector(); private int i = 0; diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/TypePartStructure.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/TypePartStructure.java index ddcd5fb3190b..ec8ae45d522e 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/TypePartStructure.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/TypePartStructure.java @@ -26,8 +26,6 @@ */ public class TypePartStructure extends edu.indiana.lib.osid.base.repository.PartStructure { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(TypePartStructure.class); - private org.osid.shared.Id TYPE_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type("mit.edu","partStructure","type","Type"); private String displayName = "Type"; diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/URLPartStructure.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/URLPartStructure.java index e3611bd463ea..f0984e9b1d0d 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/URLPartStructure.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/URLPartStructure.java @@ -3,8 +3,6 @@ public class URLPartStructure implements org.osid.repository.PartStructure { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(URLPartStructure.class); - private org.osid.shared.Id URL_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "mit.edu", "partStructure", "url", "URL associated with resource" ); diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/VolumePartStructure.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/VolumePartStructure.java index 128d76adf189..6fa13a2d9737 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/VolumePartStructure.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/VolumePartStructure.java @@ -2,8 +2,6 @@ public class VolumePartStructure implements org.osid.repository.PartStructure { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(VolumePartStructure.class); - private org.osid.shared.Id VOLUME_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "sakaibrary", "partStructure", "volume", "Volume number of source" ); diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/YearPartStructure.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/YearPartStructure.java index 3b8c7b0b69e8..2d994e0f147b 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/YearPartStructure.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/YearPartStructure.java @@ -2,8 +2,6 @@ public class YearPartStructure implements org.osid.repository.PartStructure { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(YearPartStructure.class); - private org.osid.shared.Id YEAR_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "sakaibrary", "partStructure", "year", "Year resource was created" ); diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/component/id/Id.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/component/id/Id.java index 7b7b5612f42e..6fcc651cdf7a 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/component/id/Id.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/component/id/Id.java @@ -21,15 +21,16 @@ package edu.indiana.lib.osid.component.id; +import lombok.extern.slf4j.Slf4j; + import java.util.Random; /** * @inheritDoc */ +@Slf4j public class Id implements org.osid.shared.Id { - private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils.getLog(Id.class); - private static long idBase = System.currentTimeMillis(); private String idString = null; @@ -41,7 +42,7 @@ private synchronized long getIdBase() private void log(String entry) throws org.osid.shared.SharedException { - _log.debug("Id: " + entry); + log.debug("Id: " + entry); } protected Id() throws org.osid.shared.SharedException diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/net/HttpAuthenticator.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/net/HttpAuthenticator.java index 926c508731c0..956638ce0031 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/net/HttpAuthenticator.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/net/HttpAuthenticator.java @@ -18,6 +18,7 @@ package edu.indiana.lib.twinpeaks.net; import edu.indiana.lib.twinpeaks.util.*; +import lombok.extern.slf4j.Slf4j; import java.io.*; import java.net.*; @@ -36,10 +37,9 @@ * This only occurs until we successfully "log in" - after that, we are * not invoked again for the site in question. */ +@Slf4j public class HttpAuthenticator extends java.net.Authenticator { -private static org.apache.commons.logging.Log _log = LogUtils.getLog(HttpAuthenticator.class); - private HashMap credentialMap = new HashMap(); /** @@ -61,7 +61,7 @@ protected synchronized PasswordAuthentication getPasswordAuthentication() { Credentials credential; int attempts; - _log.debug("Authorization requested for \"" + log.debug("Authorization requested for \"" + getRequestingPrompt() + "\", scheme: \"" + getRequestingScheme() @@ -71,7 +71,7 @@ protected synchronized PasswordAuthentication getPasswordAuthentication() { credential = (Credentials) credentialMap.get(getRequestingPrompt()); if (credential == null) { - _log.warn("No credentials configured"); + log.warn("No credentials configured"); return null; } @@ -87,10 +87,10 @@ protected synchronized PasswordAuthentication getPasswordAuthentication() { if ((attempts % 3) == 0) { credential.setAuthorizationAttempts(0); } - _log.warn("Authorization refused"); + log.warn("Authorization refused"); return null; } - _log.warn("Returning credentials for authorization"); + log.warn("Returning credentials for authorization"); return new PasswordAuthentication(credential.getUsername(), credential.getPassword()); } diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/net/HttpTransaction.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/net/HttpTransaction.java index f5b09cf35574..b7b0923fd750 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/net/HttpTransaction.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/net/HttpTransaction.java @@ -18,16 +18,12 @@ package edu.indiana.lib.twinpeaks.net; import edu.indiana.lib.twinpeaks.util.*; +import lombok.extern.slf4j.Slf4j; import java.io.*; import java.net.*; import java.util.*; -import javax.xml.parsers.*; - -import org.w3c.dom.*; -import org.xml.sax.*; - /** * Handle HTTP based search operations. Send (POST or GET) a query to the * server, read up the response. @@ -35,10 +31,8 @@ * The response text and HTTP details (status, character set, etc) are made * available to caller. */ +@Slf4j public class HttpTransaction { - -private static org.apache.commons.logging.Log _log = LogUtils.getLog(HttpTransaction.class); - /** * Agent identification, HTTP form submission types */ @@ -316,12 +310,12 @@ private String getResponseCharacterSet(boolean verify) { } contentType = connection.getContentType(); - _log.debug("ContentType = " + contentType); + log.debug("ContentType = " + contentType); index = (contentType == null) ? -1 : contentType.toLowerCase().indexOf(CHARSETEQ); if (index == -1) { - _log.debug("return default character set: " + log.debug("return default character set: " + getDefaultCharacterSet()); return getDefaultCharacterSet(); } @@ -340,7 +334,7 @@ private String getResponseCharacterSet(boolean verify) { break; } } - _log.debug("character set = " + log.debug("character set = " + ((buffer.length() == 0) ? getDefaultCharacterSet() : buffer.toString())); return (buffer.length() == 0) ? getDefaultCharacterSet() : buffer.toString(); @@ -573,7 +567,7 @@ public int doTransaction() throws IOException, DomException { /* * Get connection, set transaction characteristics */ - _log.debug("*** CONNECTING to URL: " + this.url.toString()); + log.debug("*** CONNECTING to URL: " + this.url.toString()); reset(); connection = getConnection(); @@ -586,7 +580,7 @@ public int doTransaction() throws IOException, DomException { */ clientCookie = setRequestCookies(); if (clientCookie.length() > 0) { - _log.debug("Cookie: " + clientCookie); + log.debug("Cookie: " + clientCookie); connection.setRequestProperty("Cookie", clientCookie); } /* diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/HttpTransactionQueryBase.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/HttpTransactionQueryBase.java index 1939367d673c..d5b06371b9fb 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/HttpTransactionQueryBase.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/HttpTransactionQueryBase.java @@ -20,26 +20,19 @@ import edu.indiana.lib.twinpeaks.net.*; import edu.indiana.lib.twinpeaks.util.*; -import java.io.*; import java.net.*; import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import javax.xml.parsers.*; - +import lombok.extern.slf4j.Slf4j; import org.w3c.dom.*; -import org.xml.sax.*; /** * Base class for HTTP search activities */ +@Slf4j public abstract class HttpTransactionQueryBase extends QueryBase implements HttpTransactionQueryInterface { - - private static org.apache.commons.logging.Log _log = LogUtils.getLog(HttpTransactionQueryBase.class); - /** * Name of the cookie List (stored with session context) */ @@ -434,7 +427,7 @@ public int submit() throws SearchException { return status; } catch (Exception exception) { - _log.error("Exception seen, the current URL is \"" + getUrl() + "\""); + log.error("Exception seen, the current URL is \"" + getUrl() + "\""); exception.printStackTrace(System.out); throw new SearchException(exception.toString()); } diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/MatchItem.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/MatchItem.java index 9dfb62f0c32e..88cc04d03099 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/MatchItem.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/MatchItem.java @@ -22,6 +22,7 @@ import java.io.*; import java.util.*; +import lombok.extern.slf4j.Slf4j; import org.osid.repository.Asset; import org.osid.repository.AssetIterator; import org.osid.repository.Record; @@ -33,11 +34,9 @@ /** * Encapsulate one matching search item */ +@Slf4j public class MatchItem { - -private static org.apache.commons.logging.Log _log = LogUtils.getLog(MatchItem.class); - private String _database; private String _displayName; private String _description; diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/PreferredUrlHandler.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/PreferredUrlHandler.java index 5328c652df13..58f87c1acb3d 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/PreferredUrlHandler.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/PreferredUrlHandler.java @@ -39,7 +39,6 @@ */ public class PreferredUrlHandler { - private static org.apache.commons.logging.Log _log = LogUtils.getLog(PreferredUrlHandler.class); /** * American Social History Online */ diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/QueryBase.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/QueryBase.java index ed239c338b80..70bb839ca934 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/QueryBase.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/QueryBase.java @@ -23,6 +23,7 @@ import javax.servlet.*; import javax.servlet.http.*; +import lombok.extern.slf4j.Slf4j; import org.w3c.dom.*; /** @@ -33,9 +34,8 @@ * and implement appropriate methods. See HttpTransactionQueryBase.java * for an example. */ +@Slf4j public abstract class QueryBase implements QueryInterface { - - private static org.apache.commons.logging.Log _log = LogUtils.getLog(QueryBase.class); /* * Request parameters */ diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/SearchResultBase.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/SearchResultBase.java index 996e92879387..dabbc9bc953b 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/SearchResultBase.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/SearchResultBase.java @@ -19,25 +19,20 @@ import edu.indiana.lib.twinpeaks.util.*; +import lombok.extern.slf4j.Slf4j; import org.osid.repository.AssetIterator; -import java.io.*; import java.net.*; import java.util.*; -import javax.xml.parsers.*; - import org.w3c.dom.*; -import org.w3c.dom.html.*; -import org.xml.sax.*; /** * Result rendering - base class and helpers */ +@Slf4j public abstract class SearchResultBase implements SearchResultInterface { - private static org.apache.commons.logging.Log _log = LogUtils.getLog(SearchResultBase.class); - /** * Parse the search engine response and expose pertinent results */ @@ -128,7 +123,7 @@ public void setSearchStart(String start) { try { _start = Integer.parseInt(start); } catch (NumberFormatException exception) { - _log.warn("Invalid number format: " + start); + log.warn("Invalid number format: " + start); return; } } @@ -286,7 +281,7 @@ public String getFullUrl(String urlFragment) { public String prependProxy(String url, String proxy) { StringBuilder fullUrl; - _log.debug("prependProxy: proxy [" + proxy + "] vs. [" + url + "]"); + log.debug("prependProxy: proxy [" + proxy + "] vs. [" + url + "]"); if (StringUtils.isNull(proxy)) { return url; @@ -322,7 +317,7 @@ public boolean expectedNodeCount(NodeList nodeList, int expected) { tag = nodeList.item(0).getNodeName(); } - _log.debug("Unexpected " + log.debug("Unexpected " + tag + " count: " + length diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/SearchSource.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/SearchSource.java index 1884a52a57b4..8f4f4c33bb5a 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/SearchSource.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/SearchSource.java @@ -17,21 +17,16 @@ **********************************************************************************/ package edu.indiana.lib.twinpeaks.search; -import edu.indiana.lib.twinpeaks.search.*; import edu.indiana.lib.twinpeaks.util.*; import java.io.*; -import java.net.*; import java.util.*; -import java.text.*; +import lombok.extern.slf4j.Slf4j; import org.w3c.dom.*; - +@Slf4j public class SearchSource { - - private static org.apache.commons.logging.Log _log = LogUtils.getLog(SearchSource.class); - /** * This source is enabled (available for use) */ @@ -110,7 +105,7 @@ private SearchSource(String name, _parameterMap = parameterMap; _flags = flags; - _log.debug("*************** name + parameters = " + _parameterMap); + log.debug("*************** name + parameters = {}", _parameterMap); } /** @@ -373,28 +368,28 @@ public static void populate(InputStream xmlStream) throws DomException, SearchEx /* * Only set the configuration once */ - _log.debug("SearchSource.populate() starts --------------------------"); + log.debug("SearchSource.populate() starts --------------------------"); synchronized (_sourceSync) { if (_sourceList != null) { - _log.debug("No action required"); + log.debug("No action required"); return; } _sourceList = new ArrayList(); - _log.debug("Populating configuration"); + log.debug("Populating configuration"); /* * Parse the configuration file */ try { document = DomUtils.parseXmlStream(xmlStream); - _log.info(DomUtils.serialize(document)); + log.info(DomUtils.serialize(document)); } catch (Exception exception) { - _log.error("DOM parse exception"); + log.error("DOM parse exception"); exception.printStackTrace(); throw new RuntimeException("DOM error"); } @@ -424,53 +419,53 @@ public static void populate(InputStream xmlStream) throws DomException, SearchEx sourceName = sourceElement.getAttribute("name"); if (StringUtils.isNull(sourceName)) { - _log.warn("Skipping un-named element"); + log.warn("Skipping un-named element"); continue; } /* * Search source (Repository) description and **unique** ID */ if ((description = parseHandler(sourceElement, "description")) == null) { - _log.warn("Missing in source \"" + sourceName + "\""); + log.warn("Missing in source \"" + sourceName + "\""); continue; } if ((id = parseHandler(sourceElement, "id")) == null) { - _log.warn("Missing in source \"" + sourceName + "\""); + log.warn("Missing in source \"" + sourceName + "\""); continue; } /* * Query and result handler names */ if ((queryHandler = parseHandler(sourceElement, "queryhandler")) == null) { - _log.warn("Missing in source \"" + sourceName + "\""); + log.warn("Missing in source \"" + sourceName + "\""); continue; } if ((searchResultHandler = parseHandler(sourceElement, "responsehandler")) == null) { - _log.warn("Missing in source \"" + sourceName + "\""); + log.warn("Missing in source \"" + sourceName + "\""); continue; } /* * Authority, domain, sarch type & description, URL */ if ((authority = parseHandler(sourceElement, "authority")) == null) { - _log.warn("Missing in source \"" + sourceName + "\""); + log.warn("Missing in source \"" + sourceName + "\""); continue; } if ((domain = parseHandler(sourceElement, "domain")) == null) { - _log.warn("Missing in source \"" + sourceName + "\""); + log.warn("Missing in source \"" + sourceName + "\""); continue; } if ((searchType = parseHandler(sourceElement, "searchtype")) == null) { - _log.warn("Missing in source \"" + sourceName + "\""); + log.warn("Missing in source \"" + sourceName + "\""); continue; } if ((typeDescription = parseHandler(sourceElement, "searchdescription")) == null) { - _log.warn("Missing in source \"" + sourceName + "\""); + log.warn("Missing in source \"" + sourceName + "\""); continue; } /* @@ -531,7 +526,7 @@ public static void populate(InputStream xmlStream) throws DomException, SearchEx } } - _log.debug("SearchSource.populate() ends --------------------------"); + log.debug("SearchSource.populate() ends --------------------------"); if (_sourceList.size() == 0) { diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/singlesearch/CqlParser.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/singlesearch/CqlParser.java index dd99c44f7f42..8a7d2538389b 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/singlesearch/CqlParser.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/singlesearch/CqlParser.java @@ -4,15 +4,14 @@ import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; +import lombok.extern.slf4j.Slf4j; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import edu.indiana.lib.twinpeaks.util.*; - +@Slf4j public class CqlParser extends org.xml.sax.helpers.DefaultHandler { - -private static org.apache.commons.logging.Log _log = LogUtils.getLog(CqlParser.class); // // Index mappings (CQL -> Sirsi) // @@ -71,11 +70,11 @@ public CqlParser() } catch (org.xml.sax.SAXException e) { - _log.error("SAX exception: " + e); + log.error("SAX exception: " + e); } catch (ParserConfigurationException e) { - _log.error("Parse failed: " + e); + log.error("Parse failed: " + e); } } @@ -105,11 +104,11 @@ public String doCQL2MetasearchCommand( String cqlSearchQuery ) } catch( java.io.IOException ioe ) { - _log.error("CQL parse exception: " + ioe); + log.error("CQL parse exception: " + ioe); } catch( org.z3950.zing.cql.CQLParseException e ) { - _log.error("CQL parse exception: " + e); + log.error("CQL parse exception: " + e); } if (root == null) @@ -119,8 +118,8 @@ public String doCQL2MetasearchCommand( String cqlSearchQuery ) String cqlXml = root.toXCQL( 0 ); - _log.debug("CQL XML:"); - _log.debug(cqlXml); + log.debug("CQL XML:"); + log.debug(cqlXml); // get cqlXml as a stream java.io.ByteArrayInputStream byteInputStream = null; @@ -131,7 +130,7 @@ public String doCQL2MetasearchCommand( String cqlSearchQuery ) } catch( java.io.UnsupportedEncodingException uee ) { - _log.error("Encoding exception: " + uee); + log.error("Encoding exception: " + uee); } if (byteInputStream == null) @@ -150,11 +149,11 @@ public String doCQL2MetasearchCommand( String cqlSearchQuery ) } catch( java.io.IOException ioe ) { - _log.error("IO exception: " + ioe); + log.error("IO exception: " + ioe); } catch( org.xml.sax.SAXException spe ) { - _log.error("SAX exception: " + spe); + log.error("SAX exception: " + spe); } String cqlResult = ( String ) cqlStack.pop(); @@ -326,7 +325,7 @@ private String translateIndex(String cqlIndex) if (sirsiIndex == null || sirsiIndex.equals( "" )) { - _log.error("translateIndex(): bad index, using KEYWORD"); + log.error("translateIndex(): bad index, using KEYWORD"); sirsiIndex = (String) INDEX_MAP.get("keyword"); } @@ -344,7 +343,7 @@ private String translateBooleanRelation(String booleanRelation) if (sirsiBoolean == null || sirsiBoolean.equals( "" )) { - _log.error("translateBooleanRelation(): bad boolean relation, using AND" ); + log.error("translateBooleanRelation(): bad boolean relation, using AND" ); sirsiBoolean = (String) BOOL_RELATION_MAP.get("and"); } return sirsiBoolean; diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/singlesearch/musepeer/Query.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/singlesearch/musepeer/Query.java index 8861ceff842e..a176918c5e0f 100755 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/singlesearch/musepeer/Query.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/singlesearch/musepeer/Query.java @@ -17,29 +17,21 @@ **********************************************************************************/ package edu.indiana.lib.twinpeaks.search.singlesearch.musepeer; -import edu.indiana.lib.twinpeaks.net.*; import edu.indiana.lib.twinpeaks.search.*; import edu.indiana.lib.twinpeaks.search.singlesearch.CqlParser; import edu.indiana.lib.twinpeaks.util.*; -import java.io.*; -import java.net.*; import java.util.*; -import javax.xml.parsers.*; -import javax.xml.transform.*; -import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.stream.StreamSource; - +import lombok.extern.slf4j.Slf4j; import org.w3c.dom.*; -import org.xml.sax.*; /** * Send a query to the Musepeer interface */ +@Slf4j public class Query extends HttpTransactionQueryBase { - private static org.apache.commons.logging.Log _log = LogUtils.getLog(Query.class); /** * DEBUG only: Display server response data? */ @@ -104,7 +96,7 @@ public void parseRequest(Map parameterMap) } action = getRequestParameter("action"); - _log.debug("*** Beginning action: " + action); + log.debug("*** Beginning action: " + action); if ("startsearch".equalsIgnoreCase(action)) { @@ -245,7 +237,7 @@ private void doLogonCommand() throws SearchException username = getRequestParameter("username"); password = getRequestParameter("password"); - _log.debug("Logging in as \"" + username + "\""); + log.debug("Logging in as \"" + username + "\""); setParameter("action", "logon"); @@ -280,7 +272,7 @@ private void doSearchCommand() throws SearchException * Set search criteria */ searchCriteria = getSearchString(); - _log.debug("Search criteria: " + searchCriteria); + log.debug("Search criteria: " + searchCriteria); /* * Generate the search command */ @@ -300,7 +292,7 @@ private void doSearchCommand() throws SearchException setParameter("dbList", target); - _log.debug("SEARCH: added DB " + target); + log.debug("SEARCH: added DB " + target); } /* * Start an asynchronous query (no results are returned) to set things up @@ -339,7 +331,7 @@ private void doPaginationCommand(String page, int firstRecord, int pageSize) String start = Integer.toString(firstRecord); String total = Integer.toString(firstRecord - 1); - _log.debug("Using result set name \"" + getResultSetName() + "\""); + log.debug("Using result set name \"" + getResultSetName() + "\""); /* * Action, identification */ @@ -356,7 +348,7 @@ private void doPaginationCommand(String page, int firstRecord, int pageSize) /* * Record, page, host requirements */ - _log.debug("PAGE: start = " + start + log.debug("PAGE: start = " + start + ", first = " + start + ", total = " + total + ", pageSize = " + pageSize); @@ -383,8 +375,8 @@ private void doMoreCommand(int firstRecord, int pageSize, int totalRemaining) String total = Integer.toString(firstRecord - 1); String limit = Integer.toString(Math.min(pageSize, totalRemaining)); - _log.debug("MORE: using result set name \"" + getResultSetName() + "\""); - _log.debug("MORE: queryStatement = " + getSearchString()); + log.debug("MORE: using result set name \"" + getResultSetName() + "\""); + log.debug("MORE: queryStatement = " + getSearchString()); /* * Action, identification @@ -405,7 +397,7 @@ private void doMoreCommand(int firstRecord, int pageSize, int totalRemaining) /* * Record, page, host requirements */ - _log.debug("MORE: start = " + start + log.debug("MORE: start = " + start + ", first = " + first + ", total = " + total + ", pageSize = " + pageSize @@ -432,7 +424,7 @@ private void doResultsCommand() throws SearchException int totalRemaining = StatusUtils.getAllRemainingHits(getSessionContext()); - _log.debug(pageSize + " VS " + totalRemaining); + log.debug(pageSize + " VS " + totalRemaining); /* * The first page of results? */ @@ -500,7 +492,7 @@ private void setDbList() count++; } } - _log.debug(count + " active database(s)"); + log.debug(count + " active database(s)"); } /** @@ -518,7 +510,7 @@ private void validateResponse(String action) throws SearchException Element element; String message, errorText; - _log.debug("VALIDATE: " + action); + log.debug("VALIDATE: " + action); /* * Verify this response corresponds to anticipated server activity */ @@ -540,7 +532,7 @@ private void validateResponse(String action) throws SearchException sessionId = DomUtils.getText(element); setSessionId(sessionId); - _log.debug("Saved Muse session ID \"" + sessionId + "\""); + log.debug("Saved Muse session ID \"" + sessionId + "\""); return; } @@ -556,7 +548,7 @@ private void validateResponse(String action) throws SearchException id = DomUtils.getText(element); setReferenceId(id); - _log.debug("Saved search reference ID \"" + getReferenceId() + "\""); + log.debug("Saved search reference ID \"" + getReferenceId() + "\""); /* * For the initial search, save the result set name as well. */ @@ -566,14 +558,14 @@ private void validateResponse(String action) throws SearchException id = DomUtils.getText(element); setResultSetName(id); - _log.debug("Saved result set name \"" + getResultSetName() + "\""); + log.debug("Saved result set name \"" + getResultSetName() + "\""); } return; } /* * No cleanup activities for this action */ - _log.debug("No \"cleanup\" activities implemented for " + action); + log.debug("No \"cleanup\" activities implemented for " + action); return; } /* @@ -589,7 +581,7 @@ private void validateResponse(String action) throws SearchException { errorText = action + ": Unexpected document format"; - LogUtils.displayXml(_log, errorText, document); + LogUtils.displayXml(log, errorText, document); StatusUtils.setGlobalError(getSessionContext(), errorText); throw new SearchException(errorText); @@ -602,7 +594,7 @@ private void validateResponse(String action) throws SearchException + " error: " + (StringUtils.isNull(message) ? "*unknown*" : message); - LogUtils.displayXml(_log, errorText, document); + LogUtils.displayXml(log, errorText, document); /* * Session timeout is a special case * @@ -744,7 +736,7 @@ private boolean setSearchStatus(Document document) throws SearchException complete++; } - _log.debug("****** Target: " + log.debug("****** Target: " + target + ", status = " + status @@ -901,12 +893,12 @@ private String parseCql(String cql) throws IllegalArgumentException CqlParser parser; String result; - _log.debug( "Initial CQL Criteria: " + cql ); + log.debug( "Initial CQL Criteria: " + cql ); parser = new CqlParser(); result = parser.doCQL2MetasearchCommand(cql); - _log.debug("Processed Result: " + result); + log.debug("Processed Result: " + result); return result; } @@ -955,7 +947,7 @@ private void displayXml(String text, Object xmlObject) { if (DISPLAY_XML) { - LogUtils.displayXml(_log, text, xmlObject); + LogUtils.displayXml(log, text, xmlObject); } } } \ No newline at end of file diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/singlesearch/musepeer/Response.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/singlesearch/musepeer/Response.java index 0f9b81d946f5..f1e45d23c7a7 100755 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/singlesearch/musepeer/Response.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/singlesearch/musepeer/Response.java @@ -21,6 +21,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +import lombok.extern.slf4j.Slf4j; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; @@ -57,10 +58,9 @@ /** * Parse the Musepeer XML response */ +@Slf4j public class Response extends SearchResultBase { - private static org.apache.commons.logging.Log _log = LogUtils.getLog(Response.class); - private SessionContext sessionContext; /** @@ -116,7 +116,7 @@ public void doParse() { String errorText = "Unexpected server response (no search result records provided)"; - LogUtils.displayXml(_log, errorText, responseDocument); + LogUtils.displayXml(log, errorText, responseDocument); StatusUtils.setGlobalError(sessionContext, errorText); throw new SearchException(errorText); @@ -150,7 +150,7 @@ public void doParse() * document */ if ((dataElement = DomUtils.getElement(recordElement, "DATA")) == null) { - _log.error("No DATA element present in server response"); + log.error("No DATA element present in server response"); displayXml(recordElement); throw new SearchException( "Missing mandatory element in server response"); @@ -158,13 +158,13 @@ public void doParse() title = getText(dataElement, "TITLE"); if (StringUtils.isNull(title)) { - _log.debug("No TITLE text in server response"); + log.debug("No TITLE text in server response"); title = ""; } description = getText(dataElement, "DESCRIPTION"); if (StringUtils.isNull(description)) { - _log.debug("No DESCRIPTION text in server response"); + log.debug("No DESCRIPTION text in server response"); description = ""; } /* @@ -174,7 +174,7 @@ public void doParse() /* * Title, abstract, record ID */ - _log.debug("Adding TITLE: " + title); + log.debug("Adding TITLE: " + title); item.setDisplayName(title); item.setDescription(description); @@ -430,7 +430,7 @@ private void doRegexParse(String database, MatchItem item) } } catch (org.osid.repository.RepositoryException e) { - _log.warn("doRegexParse() failed", e); + log.warn("doRegexParse() failed", e); } } @@ -459,7 +459,7 @@ else if (text.charAt(0) == ',') { // delete all non-digit chars (ie: p., pp., etc.) spage = spage.replaceAll("\\D", ""); - _log.debug("======================&&&& Start page: spage &&&================"); + log.debug("======================&&&& Start page: spage &&&================"); // create startPage part addPartStructure(item, @@ -473,7 +473,7 @@ else if (text.charAt(0) == ',') { .getId(), epage); } } catch (StringIndexOutOfBoundsException e) { - _log.warn("createPagesPart()", e); + log.warn("createPagesPart()", e); } } @@ -625,7 +625,7 @@ private static void displayXml(String errorText, Object xmlObject) { try { - LogUtils.displayXml(_log, errorText, xmlObject); + LogUtils.displayXml(log, errorText, xmlObject); } catch (Exception ignore) { } } @@ -640,7 +640,7 @@ private void displayXml(Object xmlObject) { try { - LogUtils.displayXml(_log, xmlObject); + LogUtils.displayXml(log, xmlObject); } catch (Exception ignore) { } } diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/singlesearch/web2/Web2Query.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/singlesearch/web2/Web2Query.java index 9e5ea2edc4d6..a2986737db3e 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/singlesearch/web2/Web2Query.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/singlesearch/web2/Web2Query.java @@ -17,29 +17,20 @@ **********************************************************************************/ package edu.indiana.lib.twinpeaks.search.singlesearch.web2; -import edu.indiana.lib.twinpeaks.net.*; import edu.indiana.lib.twinpeaks.search.*; import edu.indiana.lib.twinpeaks.search.singlesearch.CqlParser; import edu.indiana.lib.twinpeaks.util.*; -import java.io.*; -import java.net.*; import java.util.*; -import javax.xml.parsers.*; -import javax.xml.transform.*; -import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.stream.StreamSource; - +import lombok.extern.slf4j.Slf4j; import org.w3c.dom.*; -import org.xml.sax.*; /** * Send a query to the Muse Web2 interface */ +@Slf4j public class Web2Query extends HttpTransactionQueryBase { - - private static org.apache.commons.logging.Log _log = LogUtils.getLog(Web2Query.class); /** * Records displayed "per page" */ @@ -184,7 +175,7 @@ public void doQuery() try { - _log.debug(DomUtils.serialize(getResponseDocument())); + log.debug(DomUtils.serialize(getResponseDocument())); } catch (Exception ignore) { } /* @@ -207,8 +198,8 @@ public void doQuery() try { - _log.debug("Search response:"); - _log.debug(DomUtils.serialize(getResponseDocument())); + log.debug("Search response:"); + log.debug(DomUtils.serialize(getResponseDocument())); } catch (Exception ignore) { } @@ -345,16 +336,16 @@ private void doSearchCommand() throws SearchException { * Pick up the database(s) to examine, sort mode */ targets = getRequestParameter("targets"); - _log.debug("Targets for search source " + _database + ": " + targets); + log.debug("Targets for search source " + _database + ": " + targets); - _log.debug("SEARCH FOR: " + getSearchString()); + log.debug("SEARCH FOR: " + getSearchString()); sortBy = getRequestParameter("sortBy"); if (StringUtils.isNull(sortBy)) { sortBy = "ICERankingKeyRelevance"; } - _log.debug("RANKING_KEY: " + sortBy); + log.debug("RANKING_KEY: " + sortBy); /* * And generate the search command */ @@ -409,8 +400,8 @@ private void doFindCommand() throws SearchException { targets = getRequestParameter("targets"); targetCount = new StringTokenizer(targets).countTokens(); - _log.debug("Targets for search source " + _database + ", " + targetCount + " targets: " + targets); - _log.debug("Search for: " + searchCriteria); + log.debug("Targets for search source " + _database + ", " + targetCount + " targets: " + targets); + log.debug("Search for: " + searchCriteria); sortBy = getRequestParameter("sortBy"); if (StringUtils.isNull(sortBy)) @@ -418,10 +409,10 @@ private void doFindCommand() throws SearchException { sortBy = "ICERankingKeyRelevance"; } sortBy = ""; - _log.debug("RANKING_KEY: " + sortBy); + log.debug("RANKING_KEY: " + sortBy); pageSize = getIntegerRequestParameter("pageSize").toString(); - _log.debug("PAGE SIZE: " + pageSize); + log.debug("PAGE SIZE: " + pageSize); /* * And generate the FIND command @@ -485,8 +476,8 @@ private void doCombineCommand() throws SearchException { Element combineElement; - _log.debug("COMBINE find sets: " + getFindResultSetId()); - _log.debug("COMBINE output: " + getTransactionResultSetName()); + log.debug("COMBINE find sets: " + getFindResultSetId()); + log.debug("COMBINE output: " + getTransactionResultSetName()); try { @@ -519,8 +510,8 @@ private void doResultsCommand(String resultSetId) throws SearchException { _nextResult += Math.min(start, pageSize); - _log.debug("Results commmand: " + resultSetId); - _log.debug("Active = " + active + ", start record = " + _nextResult + ", page size = " + pageSize + ", per=target = " + perTarget); + log.debug("Results commmand: " + resultSetId); + log.debug("Active = " + active + ", start record = " + _nextResult + ", page size = " + pageSize + ", per=target = " + perTarget); try { @@ -573,12 +564,12 @@ private String parseCql(String cql) throws IllegalArgumentException CqlParser parser; String result; - _log.debug( "Initial CQL Criteria: " + cql ); + log.debug( "Initial CQL Criteria: " + cql ); parser = new CqlParser(); result = parser.doCQL2MetasearchCommand(cql); - _log.debug("Processed Result: " + result); + log.debug("Processed Result: " + result); return result; } @@ -705,7 +696,7 @@ private String getFindResultSetId() } active++; } - _log.debug(active + " result set ids: " + ids); + log.debug(active + " result set ids: " + ids); getSessionContext().putInt("active", active); return (ids.length() == 0) ? null : ids; } @@ -736,7 +727,7 @@ private synchronized String getTransactionResultSetName() { resultSetName = name.toString(); setSessionParameter(APPLICATION, "resultSetName", resultSetName); } - _log.debug("Transaction result set name: " + resultSetName); + log.debug("Transaction result set name: " + resultSetName); return resultSetName; } @@ -851,7 +842,7 @@ private void validateResponse(String action) throws SearchException + ", for activity " + action; - LogUtils.displayXml(_log, text, document); + LogUtils.displayXml(log, text, document); if (status.equals(NO_SESSION)) { /* @@ -888,7 +879,7 @@ private void validateResponse(String action) throws SearchException + ", found " + id; - LogUtils.displayXml(_log, text, document); + LogUtils.displayXml(log, text, document); StatusUtils.setGlobalError(getSessionContext(), "", text); throw new SearchException(text); diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/singlesearch/web2/Web2Response.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/singlesearch/web2/Web2Response.java index c8f2be61240f..10edd6059524 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/singlesearch/web2/Web2Response.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/singlesearch/web2/Web2Response.java @@ -21,6 +21,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +import lombok.extern.slf4j.Slf4j; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; @@ -60,9 +61,8 @@ /** * Parse the Web2 XML response */ +@Slf4j public class Web2Response extends SearchResultBase { - private static org.apache.commons.logging.Log _log = LogUtils - .getLog(Web2Response.class); private SessionContext sessionContext; @@ -153,7 +153,7 @@ public void doParse() { StatusUtils.setGlobalError(sessionContext, status, text); - _log.error("Error RECORD found"); + log.error("Error RECORD found"); displayXml(recordElement); throw new SearchException(status); @@ -161,7 +161,7 @@ public void doParse() { /* * Not an error, just note it and ignore */ - _log.debug("Skipping RECORD with non-null TYPE \"" + recordType + log.debug("Skipping RECORD with non-null TYPE \"" + recordType + "\""); continue; } @@ -181,7 +181,7 @@ public void doParse() { * document */ if ((dataElement = DomUtils.getElement(recordElement, "DATA")) == null) { - _log.error("No DATA element present in server response"); + log.error("No DATA element present in server response"); displayXml(recordElement); throw new SearchException( "Missing mandatory element in server response"); @@ -189,13 +189,13 @@ public void doParse() { title = getText(dataElement, "TITLE"); if (StringUtils.isNull(title)) { - _log.debug("No TITLE text in server response"); + log.debug("No TITLE text in server response"); title = ""; } description = getText(dataElement, "DESCRIPTION"); if (StringUtils.isNull(description)) { - _log.debug("No DESCRIPTION text in server response"); + log.debug("No DESCRIPTION text in server response"); description = ""; } /* @@ -205,7 +205,7 @@ public void doParse() { /* * Title, abstract, record ID */ - _log.debug("Adding TITLE: " + title); + log.debug("Adding TITLE: " + title); item.setDisplayName(title); item.setDescription(description); @@ -474,7 +474,7 @@ private void doRegexParse(String database, MatchItem item) } } catch (org.osid.repository.RepositoryException e) { - _log.warn("doRegexParse() failed", e); + log.warn("doRegexParse() failed", e); } } @@ -503,7 +503,7 @@ else if (text.charAt(0) == ',') { // delete all non-digit chars (ie: p., pp., etc.) spage = spage.replaceAll("\\D", ""); - _log.debug("======================&&&& Start page: spage &&&================"); + log.debug("======================&&&& Start page: spage &&&================"); // create startPage part addPartStructure(item, @@ -517,7 +517,7 @@ else if (text.charAt(0) == ',') { .getId(), epage); } } catch (StringIndexOutOfBoundsException e) { - _log.warn("createPagesPart()", e); + log.warn("createPagesPart()", e); } } @@ -703,7 +703,7 @@ private String getText(Element parent, String name) { private static void displayXml(String errorText, Object xmlObject) { try { - LogUtils.displayXml(_log, errorText, xmlObject); + LogUtils.displayXml(log, errorText, xmlObject); } catch (Exception ignore) { } } @@ -717,7 +717,7 @@ private static void displayXml(String errorText, Object xmlObject) { private void displayXml(Object xmlObject) { try { - LogUtils.displayXml(_log, xmlObject); + LogUtils.displayXml(log, xmlObject); } catch (Exception ignore) { } } diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/sru/CqlParser.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/sru/CqlParser.java index 957dbcb293bc..5aa740b98439 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/sru/CqlParser.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/sru/CqlParser.java @@ -4,15 +4,15 @@ import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; +import lombok.extern.slf4j.Slf4j; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import edu.indiana.lib.twinpeaks.util.*; - +@Slf4j public class CqlParser extends org.xml.sax.helpers.DefaultHandler { - private static org.apache.commons.logging.Log _log = LogUtils.getLog(CqlParser.class); // // Index mappings (CQL -> 360 Search) (this is pretty much CQL to CQL) // @@ -72,11 +72,11 @@ public CqlParser() } catch (org.xml.sax.SAXException e) { - _log.error("SAX exception: " + e); + log.error("SAX exception: " + e); } catch (ParserConfigurationException e) { - _log.error("Parse failed: " + e); + log.error("Parse failed: " + e); } } @@ -106,7 +106,7 @@ public String doCQL2MetasearchCommand( String cqlSearchQuery ) } catch (Exception exception) { - _log.error("Exception in CQL parse: " + exception); + log.error("Exception in CQL parse: " + exception); } if (root == null) @@ -116,8 +116,8 @@ public String doCQL2MetasearchCommand( String cqlSearchQuery ) String cqlXml = root.toXCQL( 0 ); - _log.debug("CQL XML:"); - _log.debug(cqlXml); + log.debug("CQL XML:"); + log.debug(cqlXml); // Open the CQL XML string as a stream java.io.ByteArrayInputStream byteInputStream = null; @@ -127,7 +127,7 @@ public String doCQL2MetasearchCommand( String cqlSearchQuery ) } catch (Exception exception) { - _log.error("Exception opening input stream: " + exception); + log.error("Exception opening input stream: " + exception); } if (byteInputStream == null) @@ -146,7 +146,7 @@ public String doCQL2MetasearchCommand( String cqlSearchQuery ) } catch (Exception exception) { - _log.error("Exception in parse: " + exception); + log.error("Exception in parse: " + exception); } String cqlResult = ( String ) cqlStack.pop(); @@ -320,7 +320,7 @@ private String translateIndex(String cqlIndex) if (s360Index == null || s360Index.equals( "" )) { - _log.error("translateIndex(): bad index, using KEYWORD"); + log.error("translateIndex(): bad index, using KEYWORD"); s360Index = (String) INDEX_MAP.get("keyword"); } @@ -338,7 +338,7 @@ private String translateBooleanRelation(String booleanRelation) if (s360Boolean == null || s360Boolean.equals( "" )) { - _log.error("translateBooleanRelation(): bad boolean relation, using AND" ); + log.error("translateBooleanRelation(): bad boolean relation, using AND" ); s360Boolean = (String) BOOL_RELATION_MAP.get("and"); } return s360Boolean; diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/sru/SruQueryBase.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/sru/SruQueryBase.java index 2317f6e1bf1f..b9410d90ab7f 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/sru/SruQueryBase.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/sru/SruQueryBase.java @@ -20,13 +20,14 @@ import edu.indiana.lib.twinpeaks.search.HttpTransactionQueryBase; import edu.indiana.lib.twinpeaks.util.LogUtils; import edu.indiana.lib.twinpeaks.util.StringUtils; +import lombok.extern.slf4j.Slf4j; /** * Basic SRU query functionality */ +@Slf4j public abstract class SruQueryBase extends HttpTransactionQueryBase { - private static org.apache.commons.logging.Log _log = LogUtils.getLog(SruQueryBase.class); /* * SRU common parameters */ diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/sru/ss360search/Query.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/sru/ss360search/Query.java index 8d143b7443fd..34191c574210 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/sru/ss360search/Query.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/sru/ss360search/Query.java @@ -17,8 +17,6 @@ **********************************************************************************/ package edu.indiana.lib.twinpeaks.search.sru.ss360search; -import edu.indiana.lib.twinpeaks.net.*; -import edu.indiana.lib.twinpeaks.search.*; import edu.indiana.lib.twinpeaks.search.sru.CqlParser; import edu.indiana.lib.twinpeaks.search.sru.SruQueryBase; import edu.indiana.lib.twinpeaks.util.*; @@ -27,20 +25,15 @@ import java.net.URLEncoder; import java.util.*; -import javax.xml.parsers.*; -import javax.xml.transform.*; -import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.stream.StreamSource; - +import lombok.extern.slf4j.Slf4j; import org.w3c.dom.*; -import org.xml.sax.*; /** * Send a query to the Serials Solutions 360 Search server */ +@Slf4j public class Query extends SruQueryBase implements Constants { - private static org.apache.commons.logging.Log _log = LogUtils.getLog(Query.class); /** * Display debug details (verbose) */ @@ -111,7 +104,7 @@ public void doQuery() Integer p = getIntegerRequestParameter("pageSize"); Integer r = getIntegerRequestParameter("startingRecord"); - _log.debug("PageSize: " + p + ", Starting Record: " + r); + log.debug("PageSize: " + p + ", Starting Record: " + r); /* @@ -124,7 +117,7 @@ public void doQuery() session = getSessionContext(); action = getRequestParameter("action"); - _log.debug("Requested ACTION: " + action); + log.debug("Requested ACTION: " + action); /* * Start a new search? */ @@ -177,7 +170,7 @@ public void doQuery() /* * Unexpected action: log it and continue */ - _log.warn("Unexpected ACTION requested: \"" + action + "\""); + log.warn("Unexpected ACTION requested: \"" + action + "\""); } /** @@ -294,7 +287,7 @@ protected void doNewPage() int startRecord = getSessionContext().getInt("startRecord"); int pageSize = getSessionContext().getInt("pageSize"); - _log.debug("New Page: starting record = " + startRecord + log.debug("New Page: starting record = " + startRecord + ", page size = " + pageSize); /* * Fix up the sort key @@ -341,7 +334,7 @@ protected void postNewPage() int startRecord = getSessionContext().getInt("startRecord"); int pageSize = getSessionContext().getInt("pageSize"); - _log.debug("New Page: starting record = " + startRecord + log.debug("New Page: starting record = " + startRecord + ", page size = " + pageSize); /* * Fix up the sort key @@ -410,7 +403,7 @@ private void validateResponse(Document responseDocument) StatusUtils.setGlobalError(sessionContext, message, details); - _log.error("Diagnotic record found"); + log.error("Diagnotic record found"); displayXml(element); throw new SearchException(message + ", " + details); @@ -453,7 +446,7 @@ protected void parseStatusRecord(Document responseDocument) { String message = "No database specified for provider in 360 Search response"; - _log.error(message); + log.error(message); displayXml(element); throw new SearchException(message); @@ -495,7 +488,7 @@ protected void parseStatusRecord(Document responseDocument) "type", "partial"); hits = Integer.parseInt(DomUtils.getText(element)); - _log.debug("*** Estimated hits: " + estimate + ", actual hits: " + hits); + log.debug("*** Estimated hits: " + estimate + ", actual hits: " + hits); /* * Set up the status map for the current provider. The provider is active * only when the estimated and actual hit counts are both available. @@ -511,7 +504,7 @@ protected void parseStatusRecord(Document responseDocument) map.put("STATUS", "ACTIVE"); active++; } - _log.debug("Database details: " + map); + log.debug("Database details: " + map); } /* * Save: @@ -542,7 +535,7 @@ protected String saveResultSetId(Document responseDocument) { String message = "No result set id in 360 Search response"; - _log.error(message); + log.error(message); throw new SearchException(message); } /* @@ -552,7 +545,7 @@ protected String saveResultSetId(Document responseDocument) if (!resultSetId.equals(previousId)) { - _log.debug("*** Result set ID changed. Was: " + log.debug("*** Result set ID changed. Was: " + previousId + ", now: " + resultSetId); @@ -585,7 +578,7 @@ private String encode(String value) } catch (UnsupportedEncodingException exception) { - _log.error("UTF-8: " + exception); + log.error("UTF-8: " + exception); return value; } @@ -684,12 +677,12 @@ private String parseCql(String cql) throws IllegalArgumentException CqlParser parser; String result; - _log.debug("Initial CQL Criteria: " + cql); + log.debug("Initial CQL Criteria: " + cql); parser = new CqlParser(); result = parser.doCQL2MetasearchCommand(cql); - _log.debug("Processed Result: " + result); + log.debug("Processed Result: " + result); return result; } @@ -703,7 +696,7 @@ private void displayXml(Object xmlObject) try { - LogUtils.displayXml(_log, xmlObject); + LogUtils.displayXml(log, xmlObject); } catch (Exception ignore) { } } diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/sru/ss360search/Response.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/sru/ss360search/Response.java index f26c4e721ef0..f2a20cedcc41 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/sru/ss360search/Response.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/sru/ss360search/Response.java @@ -17,30 +17,21 @@ **********************************************************************************/ package edu.indiana.lib.twinpeaks.search.sru.ss360search; -import java.util.Iterator; -import java.util.Map; - +import lombok.extern.slf4j.Slf4j; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; import edu.indiana.lib.osid.base.repository.http.CreatorPartStructure; -import edu.indiana.lib.osid.base.repository.http.DOIPartStructure; -import edu.indiana.lib.osid.base.repository.http.DataSource; import edu.indiana.lib.osid.base.repository.http.DatePartStructure; -import edu.indiana.lib.osid.base.repository.http.EditionPartStructure; -import edu.indiana.lib.osid.base.repository.http.EndPagePartStructure; import edu.indiana.lib.osid.base.repository.http.InLineCitationPartStructure; import edu.indiana.lib.osid.base.repository.http.IsnIdentifierPartStructure; import edu.indiana.lib.osid.base.repository.http.IssuePartStructure; -import edu.indiana.lib.osid.base.repository.http.LanguagePartStructure; import edu.indiana.lib.osid.base.repository.http.OpenUrlPartStructure; import edu.indiana.lib.osid.base.repository.http.PagesPartStructure; import edu.indiana.lib.osid.base.repository.http.PreferredUrlPartStructure; -import edu.indiana.lib.osid.base.repository.http.PublisherPartStructure; import edu.indiana.lib.osid.base.repository.http.SourceTitlePartStructure; import edu.indiana.lib.osid.base.repository.http.StartPagePartStructure; -import edu.indiana.lib.osid.base.repository.http.SubjectPartStructure; import edu.indiana.lib.osid.base.repository.http.TypePartStructure; import edu.indiana.lib.osid.base.repository.http.URLPartStructure; import edu.indiana.lib.osid.base.repository.http.VolumePartStructure; @@ -59,9 +50,9 @@ /** * Parse the 360 Search XML response */ +@Slf4j public class Response extends SearchResultBase implements Constants { - private static org.apache.commons.logging.Log _log = LogUtils.getLog(Response.class); /** * Session context */ @@ -146,7 +137,7 @@ public void doParse() if (citationElement == null) { - _log.error("No citation element in 360 Search response"); + log.error("No citation element in 360 Search response"); displayXml(recordElement); throw new SearchException("No citation element in 360 Search response"); @@ -157,7 +148,7 @@ public void doParse() target = DomUtils.getTextNS(NS_CS, citationElement, "databaseId"); if (StringUtils.isNull(target)) { - _log.warn("No database id in 360 Search response, ignoring"); + log.warn("No database id in 360 Search response, ignoring"); displayXml(citationElement); continue; @@ -296,7 +287,7 @@ public void doParse() */ NodeList urlList = DomUtils.getElementListNS(NS_CS, citationElement, "url"); - if (urlList.getLength() == 0) _log.warn("*** No URL element!"); + if (urlList.getLength() == 0) log.warn("*** No URL element!"); for (int urlIndex = 0; urlIndex < urlList.getLength(); urlIndex++) { @@ -306,7 +297,7 @@ public void doParse() type = element.getAttribute("type"); url = DomUtils.getText(element); - _log.debug("link resolver" + " VS " + type); + log.debug("link resolver" + " VS " + type); if (!StringUtils.isNull(url)) { @@ -549,7 +540,7 @@ private static void displayXml(String errorText, Object xmlObject) { try { - LogUtils.displayXml(_log, errorText, xmlObject); + LogUtils.displayXml(log, errorText, xmlObject); } catch (Exception ignore) { } } @@ -562,7 +553,7 @@ private void displayXml(Object xmlObject) { try { - LogUtils.displayXml(_log, xmlObject); + LogUtils.displayXml(log, xmlObject); } catch (Exception ignore) { } } } \ No newline at end of file diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/sru/ss360search/ResultUtils.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/sru/ss360search/ResultUtils.java index cbf8e476a142..c9d473699b11 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/sru/ss360search/ResultUtils.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/sru/ss360search/ResultUtils.java @@ -18,16 +18,15 @@ package edu.indiana.lib.twinpeaks.search.sru.ss360search; import edu.indiana.lib.twinpeaks.util.*; -import java.util.*; +import lombok.extern.slf4j.Slf4j; /** * Data normalization for 360 Search results */ +@Slf4j public class ResultUtils { - - private static org.apache.commons.logging.Log _log = LogUtils.getLog(ResultUtils.class); /* * Database names */ @@ -50,7 +49,7 @@ public static String normalize(String resultData, { String result = resultData.trim(); - _log.debug("normalize() called with " + result + log.debug("normalize() called with " + result + " -- " + partDataName + " -- " + database); /* diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/ByteUtils.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/ByteUtils.java index b664a8abd036..2cd9c2a2b63e 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/ByteUtils.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/ByteUtils.java @@ -17,16 +17,14 @@ **********************************************************************************/ package edu.indiana.lib.twinpeaks.util; -import java.io.*; -import java.util.*; +import lombok.extern.slf4j.Slf4j; /** * Byte utilities */ +@Slf4j public class ByteUtils { - -private static org.apache.commons.logging.Log _log = LogUtils.getLog(ByteUtils.class); /* * Byte manipulation utilities * @@ -197,8 +195,8 @@ public static void main(String[] args) throws Exception { index = indexOf(byteText, "XXX"); last = lastIndexOf(byteText, "XXX"); - _log.debug("Index = " + index); - _log.debug("Last = " + last); - _log.debug("equal = " + equals(byteText, "XXX".getBytes())); + log.debug("Index = " + index); + log.debug("Last = " + last); + log.debug("equal = " + equals(byteText, "XXX".getBytes())); } } diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/CaseBlindHashMap.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/CaseBlindHashMap.java index 2f9c16993aa2..91e5ff7c1472 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/CaseBlindHashMap.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/CaseBlindHashMap.java @@ -26,6 +26,8 @@ of this software and associated documentation files (the "Software"), to deal package edu.indiana.lib.twinpeaks.util; +import lombok.extern.slf4j.Slf4j; + import java.io.*; import java.util.*; @@ -38,10 +40,8 @@ of this software and associated documentation files (the "Software"), to deal * Two methods have been added to facilitate working with Sets of key strings. * See stringKeySet() and stringKeyIterator(). */ +@Slf4j public class CaseBlindHashMap extends HashMap { - -private static org.apache.commons.logging.Log _log = LogUtils.getLog(CaseBlindHashMap.class); - /** * Constructors */ diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/CookieData.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/CookieData.java index 08a62ec5d8ab..d203dc9e4e92 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/CookieData.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/CookieData.java @@ -17,6 +17,8 @@ **********************************************************************************/ package edu.indiana.lib.twinpeaks.util; +import lombok.extern.slf4j.Slf4j; + import java.io.*; import java.net.*; import java.util.*; @@ -24,9 +26,8 @@ /** * Represent a single cookie */ +@Slf4j public class CookieData { - -private static org.apache.commons.logging.Log _log = LogUtils.getLog(CookieData.class); /** * Null (unset) cookie age */ diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/CookieUtils.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/CookieUtils.java index 5c93a6684409..bacf398d45c3 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/CookieUtils.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/CookieUtils.java @@ -17,14 +17,14 @@ **********************************************************************************/ package edu.indiana.lib.twinpeaks.util; +import lombok.extern.slf4j.Slf4j; + import java.io.*; import java.net.*; import java.util.*; - +@Slf4j public class CookieUtils { -private static org.apache.commons.logging.Log _log = LogUtils.getLog(CookieUtils.class); - private CookieUtils() { } diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/DomUtils.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/DomUtils.java index a0474a30ee83..eeaaf6361cd8 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/DomUtils.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/DomUtils.java @@ -25,13 +25,13 @@ import javax.xml.transform.stream.StreamResult; import javax.xml.transform.*; +import lombok.extern.slf4j.Slf4j; import org.w3c.dom.*; -import org.w3c.dom.html.*; import org.xml.sax.*; +@Slf4j public class DomUtils { - private static org.apache.commons.logging.Log _log = LogUtils.getLog(DomUtils.class); /** * Default encoding (NekoHTML) */ @@ -627,7 +627,7 @@ public static DocumentBuilder getXmlDocumentBuilder(boolean namespaceAware) thro factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(namespaceAware); - _log.debug("DOM parse: namespace aware = " + namespaceAware); + log.debug("DOM parse: namespace aware = " + namespaceAware); return factory.newDocumentBuilder(); } diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/HttpTransactionUtils.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/HttpTransactionUtils.java index 9a80dcbff0ac..5c5e53123109 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/HttpTransactionUtils.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/HttpTransactionUtils.java @@ -17,19 +17,20 @@ **********************************************************************************/ package edu.indiana.lib.twinpeaks.util; +import lombok.extern.slf4j.Slf4j; + import java.io.*; import java.net.*; import java.util.*; -import javax.servlet.*; import javax.servlet.http.*; /** * HTTP utilites */ +@Slf4j public class HttpTransactionUtils { - private static org.apache.commons.logging.Log _log = LogUtils.getLog(HttpTransactionUtils.class); private HttpTransactionUtils() { } @@ -295,7 +296,7 @@ public static String urlEncodeFullUrl(String original) { params = getUrlComponent(original, PARAMETERS); } catch (MalformedURLException exception) { - _log.warn("Invalid URL provided: " + original); + log.warn("Invalid URL provided: " + original); return original; } diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/LogUtils.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/LogUtils.java index 7ced36a6cc9e..d414259fbbd7 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/LogUtils.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/LogUtils.java @@ -20,8 +20,8 @@ import java.lang.*; import java.util.*; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.servlet.http.*; import javax.xml.parsers.*; @@ -34,27 +34,27 @@ public class LogUtils { /** - * Get a Log instance + * Get a Logger instance * @param logClass Java Class being logged */ - public static Log getLog(Class logClass) { - return LogFactory.getLog(logClass); + public static Logger getLog(Class logClass) { + return LoggerFactory.getLogger(logClass); } /** - * Get a Log instance + * Get a Logger instance * @param logName Name being logged */ - public static Log getLog(String logName) { - return LogFactory.getLog(logName); + public static Logger getLog(String logName) { + return LoggerFactory.getLogger(logName); } /** * Serialize an XML object (Document or Element) to the log - * @param log Apache Log object - * @param recordElement The XML object to disolay (Document, Element) + * @param log Apache Logger object + * @param xmlObject The XML object to disolay (Document, Element) */ - public static void displayXml(org.apache.commons.logging.Log log, + public static void displayXml(Logger log, Object xmlObject) { displayXml(log, null, xmlObject); } @@ -62,11 +62,11 @@ public static void displayXml(org.apache.commons.logging.Log log, /** * Serialize an XML object (Document or Element) to the log (with an * optional warning header) - * @param log Apache Log object + * @param log Apache Logger object * @param errorText Error message (null for none) - * @param recordElement The XML object to disolay (Document, Element) + * @param xmlObject The XML object to disolay (Document, Element) */ - public static void displayXml(org.apache.commons.logging.Log log, + public static void displayXml(Logger log, String errorText, Object xmlObject) { @@ -95,11 +95,11 @@ public static void displayXml(org.apache.commons.logging.Log log, */ public static void main(String[] args) { - Log log = LogUtils.getLog(LogUtils.class); + Logger log = LogUtils.getLog(LogUtils.class); // log.debug("Debug"); // log.error("Error"); // log.warn("Warn"); // log.info("Info"); } -} \ No newline at end of file +} diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/ParameterMap.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/ParameterMap.java index 7d832276a316..4ad1f9257e19 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/ParameterMap.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/ParameterMap.java @@ -17,6 +17,8 @@ **********************************************************************************/ package edu.indiana.lib.twinpeaks.util; +import lombok.extern.slf4j.Slf4j; + import java.io.*; import java.net.*; import java.util.*; @@ -28,11 +30,9 @@ * xxx=value1&xxx=value2 * */ +@Slf4j public class ParameterMap { - -private static org.apache.commons.logging.Log _log = LogUtils.getLog(ParameterMap.class); - static private final int PREFIXSIZE = 4; static private final int MAXVALUE = (1 << PREFIXSIZE * 4) - 1; diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/SessionContext.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/SessionContext.java index e322c9edf71e..83460908580c 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/SessionContext.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/SessionContext.java @@ -17,14 +17,10 @@ **********************************************************************************/ package edu.indiana.lib.twinpeaks.util; -import edu.indiana.lib.twinpeaks.search.*; - -import java.io.*; -import java.net.*; import java.lang.*; -import java.sql.*; import java.util.*; +import lombok.extern.slf4j.Slf4j; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.memory.api.Cache; import org.sakaiproject.memory.api.MemoryService; @@ -33,11 +29,9 @@ /** * Expose the session context block */ +@Slf4j public class SessionContext { - - private static org.apache.commons.logging.Log _log = LogUtils.getLog(SessionContext.class); - /** * Cache name */ @@ -83,19 +77,19 @@ private SessionContext(String id) { if ( cache == null ) { cache = memoryService.getCache(CACHENAME); - _log.debug(CACHENAME + ":" + cache.toString()); + log.debug(CACHENAME + ":" + cache.toString()); } /* * Fetch the session cache (create a new one if necessary) */ hashmap = (HashMap) cache.get(id); - _log.debug("cache.get(" + id + ") finds " + hashmap); + log.debug("cache.get(" + id + ") finds " + hashmap); if (hashmap == null) { cache.put(id, new HashMap()); - _log.debug("HashMap() created for id " + id); + log.debug("HashMap() created for id " + id); } } diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/StatusUtils.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/StatusUtils.java index 0c3f09636819..6ee98011c138 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/StatusUtils.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/StatusUtils.java @@ -17,17 +17,14 @@ *******************************************************************************/ package edu.indiana.lib.twinpeaks.util; +import lombok.extern.slf4j.Slf4j; + import java.lang.*; import java.util.*; -import org.w3c.dom.*; -import org.xml.sax.*; - +@Slf4j public class StatusUtils { - -private static org.apache.commons.logging.Log _log = LogUtils.getLog(StatusUtils.class); - /** * Set up initial status information */ @@ -223,7 +220,7 @@ public static int updateHits(SessionContext sessionContext, { throw new SearchException("No status map found for target database " + target); } - _log.debug("Map for target " + target + ": " + targetMap); + log.debug("Map for target " + target + ": " + targetMap); /* * Update total hits from this search source */ diff --git a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/StringUtils.java b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/StringUtils.java index c655e51f2c5f..f0437d38b7a4 100644 --- a/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/StringUtils.java +++ b/citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/util/StringUtils.java @@ -17,13 +17,15 @@ **********************************************************************************/ package edu.indiana.lib.twinpeaks.util; +import lombok.extern.slf4j.Slf4j; + import java.io.*; import java.util.*; import java.util.regex.*; +@Slf4j public class StringUtils { -private static org.apache.commons.logging.Log _log = LogUtils.getLog(StringUtils.class); /** * Minimum length supported by truncateAtWhitespace() */ diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/loader/OsidLoader.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/loader/OsidLoader.java index 14e7b6e52c89..a2668d502760 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/loader/OsidLoader.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/loader/OsidLoader.java @@ -20,6 +20,9 @@ **********************************************************************************/ package org.sakaibrary.osid.loader; + +import lombok.extern.slf4j.Slf4j; + /** * OsidLoader loads a specific implementation of an Open Service Interface * Definition (OSID) with its getManager method. The getManager method loads @@ -83,14 +86,10 @@ * O.K.I. OSID Definition License}. *

*/ - +@Slf4j public class OsidLoader implements java.io.Serializable { private static final long serialVersionUID = 1L; - - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.loader.OsidLoader" ); /** * Returns an instance of the org.osid.OsidManager of the OSID specified by the OSID @@ -160,11 +159,11 @@ public static org.osid.OsidManager getManager( String managerClassName = makeFullyQualifiedClassName(implPackageName, className); - LOG.debug( "osid interface name: " + osidInterfaceName); + log.debug( "osid interface name: " + osidInterfaceName); Class osidInterface = Class.forName(osidInterfaceName); if (null != osidInterface) { - LOG.debug("osid manager class name: " + managerClassName); + log.debug("osid manager class name: " + managerClassName); Class managerClass = Class.forName(managerClassName); if (null != managerClass) { @@ -208,7 +207,7 @@ public static org.osid.OsidManager getManager( } manager.assignConfiguration( configuration ); - LOG.debug( "configuration has been assigned done." ); + log.debug( "configuration has been assigned done." ); return manager; } catch (Exception ex) { @@ -230,10 +229,10 @@ public static org.osid.OsidManager getManager( throw new org.osid.OsidException(org.osid.OsidException.NULL_ARGUMENT); } catch (org.osid.OsidException oex) { - LOG.error( oex.getMessage() ); + log.error( oex.getMessage() ); throw new org.osid.OsidException(oex.getMessage()); } catch (java.lang.Throwable ex) { - LOG.error( ex.getMessage() ); + log.error( ex.getMessage() ); throw new org.osid.OsidException(org.osid.OsidException.OPERATION_FAILED); } } @@ -345,9 +344,9 @@ private static java.util.Properties getConfiguration( properties.load(is); } - LOG.debug( "Read osid manager properties from: " + propertyName ); + log.debug( "Read osid manager properties from: " + propertyName ); } catch (Throwable ex) { - LOG.error( "Error reading " + propertyName + " property file --" + + log.error( "Error reading " + propertyName + " property file --" + ex.getMessage() ); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/Asset.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/Asset.java index 191fbe27f66b..cc2a515fdbee 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/Asset.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/Asset.java @@ -21,15 +21,14 @@ package org.sakaibrary.osid.repository.xserver; +import lombok.extern.slf4j.Slf4j; + +@Slf4j public class Asset implements org.osid.repository.Asset { - private static final long serialVersionUID = 1L; private org.osid.id.IdManager idManager = Managers.getIdManager(); - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.Asset" ); // Types private org.osid.shared.Type assetType = new Type( "sakaibrary", "asset", @@ -61,7 +60,7 @@ protected Asset(String displayName } catch (Throwable t) { - LOG.warn( t.getMessage() ); + log.warn( t.getMessage() ); } } @@ -158,7 +157,7 @@ public org.osid.repository.Record createRecord(org.osid.shared.Id recordStructur } catch (Throwable t) { - LOG.warn(t.getMessage()); + log.warn(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } @@ -199,7 +198,7 @@ public void deleteRecord(org.osid.shared.Id recordId) } catch (Throwable t) { - LOG.warn(t.getMessage()); + log.warn(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } @@ -223,7 +222,7 @@ public org.osid.repository.RecordIterator getRecordsByRecordStructure(org.osid.s } catch (Throwable t) { - LOG.warn(t.getMessage()); + log.warn(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } @@ -269,7 +268,7 @@ public org.osid.repository.Record getRecord(org.osid.shared.Id recordId) } catch (Throwable t) { - LOG.warn(t.getMessage()); + log.warn(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } @@ -300,7 +299,7 @@ public org.osid.repository.Part getPart(org.osid.shared.Id partId) } catch (Throwable t) { - LOG.warn(t.getMessage()); + log.warn(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } @@ -339,7 +338,7 @@ public org.osid.repository.PartIterator getPartByPart(org.osid.shared.Id partStr } catch (Throwable t) { - LOG.warn(t.getMessage()); + log.warn(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } @@ -359,7 +358,7 @@ public org.osid.shared.ObjectIterator getPartValueByPart(org.osid.shared.Id part } catch (Throwable t) { - LOG.warn(t.getMessage()); + log.warn(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } @@ -408,7 +407,7 @@ public org.osid.shared.ObjectIterator getPartValuesByPartStructure(org.osid.shar } catch (Throwable t) { - LOG.warn(t.getMessage()); + log.warn(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } @@ -441,7 +440,7 @@ public org.osid.repository.PartIterator getPartsByPartStructure(org.osid.shared. } catch (Throwable t) { - LOG.warn( t.getMessage() ); + log.warn( t.getMessage() ); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/AssetIterator.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/AssetIterator.java index 24b8f00ef11c..7a30d9584424 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/AssetIterator.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/AssetIterator.java @@ -27,6 +27,7 @@ import javax.xml.parsers.ParserConfigurationException; +import lombok.extern.slf4j.Slf4j; import org.sakaibrary.xserver.session.MetasearchSession; import org.sakaibrary.xserver.session.MetasearchSessionManager; import org.xml.sax.SAXException; @@ -36,6 +37,7 @@ * @author gbhatnag * @version */ +@Slf4j public class AssetIterator extends org.xml.sax.helpers.DefaultHandler implements org.osid.repository.AssetIterator { /* @@ -46,9 +48,6 @@ public class AssetIterator extends org.xml.sax.helpers.DefaultHandler private static final long serialVersionUID = 1L; private static final String REGULAR_EXPRESSION_FILE = "/data/citationRegex.txt"; - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.AssetIterator" ); private java.util.LinkedList assetQueue; private java.util.ArrayList regexArray; @@ -93,7 +92,7 @@ protected AssetIterator( String guid ) try { regexArray = loadCitationRegularExpressions( REGULAR_EXPRESSION_FILE ); } catch( java.io.IOException ioe ) { - LOG.warn( "AssetIterator() failed reading citation regular " + + log.warn( "AssetIterator() failed reading citation regular " + "expressions - regex file: " + REGULAR_EXPRESSION_FILE, ioe ); } } @@ -140,7 +139,7 @@ public boolean hasNextAsset() xserver.updateSearchStatusProperties(); statusProperties = xserver.getSearchStatusProperties(); } catch( org.sakaibrary.xserver.XServerException xse ) { - LOG.warn( "X-Server error: " + xse.getErrorCode() + + log.warn( "X-Server error: " + xse.getErrorCode() + " - " + xse.getErrorText() ); // throw exception now that status has been updated @@ -155,7 +154,7 @@ public boolean hasNextAsset() try { status = ( String ) statusProperties.getProperty( "status" ); } catch( org.osid.shared.SharedException se ) { - LOG.warn( "hasNextAsset() failed getting status " + + log.warn( "hasNextAsset() failed getting status " + "property", se ); } @@ -174,7 +173,7 @@ public boolean hasNextAsset() return false; } } else { - LOG.warn( "hasNextAsset() - status property is null" ); + log.warn( "hasNextAsset() - status property is null" ); } // get updated metasearchSession @@ -200,7 +199,7 @@ public boolean hasNextAsset() public org.osid.repository.Asset nextAsset() throws org.osid.repository.RepositoryException { - LOG.debug( "nextAsset() [entry] - returned: " + numRecordsReturned + "; total: " + + log.debug( "nextAsset() [entry] - returned: " + numRecordsReturned + "; total: " + totalRecordsCursor + "; in queue: " + assetQueue.size() ); // return Asset, if ready @@ -218,7 +217,7 @@ public org.osid.repository.Asset nextAsset() try { status = ( String ) statusProperties.getProperty( "status" ); } catch( org.osid.shared.SharedException se ) { - LOG.warn( "nextAsset() failed getting status property", se ); + log.warn( "nextAsset() failed getting status property", se ); } if( status == null || !status.equals( "ready" ) ) { @@ -236,12 +235,12 @@ public org.osid.repository.Asset nextAsset() org.sakaibrary.xserver.XServer xserver = new org.sakaibrary.xserver.XServer( guid ); - LOG.debug( "nextAsset() calling XServer.getRecordsXML() - assets in " + + log.debug( "nextAsset() calling XServer.getRecordsXML() - assets in " + "queue: " + assetQueue.size() ); createAssets( xserver.getRecordsXML( totalRecordsCursor ), repositoryId ); } catch( org.sakaibrary.xserver.XServerException xse ) { - LOG.warn( "X-Server error: " + xse.getErrorCode() + " - " + + log.warn( "X-Server error: " + xse.getErrorCode() + " - " + xse.getErrorText() ); // // Have all (or too many) records been merged? If so, indicate @@ -250,7 +249,7 @@ public org.osid.repository.Asset nextAsset() if ((xse.getErrorCodeIntValue() == XSERVER_ERROR_MERGE_LIMIT) || (xse.getErrorCodeIntValue() == XSERVER_ERROR_ALL_MERGED)) { - LOG.debug("nextAsset(), Xserver Error " + log.debug("nextAsset(), Xserver Error " + xse.getErrorCodeIntValue() + ", throwing NO_MORE_ITERATOR_ELEMENTS"); @@ -264,7 +263,7 @@ public org.osid.repository.Asset nextAsset() org.sakaibrary.osid.repository.xserver.MetasearchException. METASEARCH_ERROR ); } - LOG.debug( "nextAsset(), XServer.getRecordsXML() returns - assets in " + + log.debug( "nextAsset(), XServer.getRecordsXML() returns - assets in " + "queue: " + assetQueue.size() ); // // Make sure there really is an asset available - if not, signal "end-of-file" @@ -274,7 +273,7 @@ public org.osid.repository.Asset nextAsset() // if (assetQueue.size() == 0) { - LOG.debug("nextAsset(), An asset is expected, but the asset queue is enpty"); + log.debug("nextAsset(), An asset is expected, but the asset queue is enpty"); throw new org.osid.repository.RepositoryException( org.osid.shared.SharedException.NO_MORE_ITERATOR_ELEMENTS); @@ -332,7 +331,7 @@ private void createAssets( java.io.ByteArrayInputStream xml, } // Error generated by the parser - LOG.warn("createAssets() parsing exception: " + + log.warn("createAssets() parsing exception: " + spe.getMessage() + " - xml line " + spe.getLineNumber() + ", uri " + spe.getSystemId(), x ); } catch (SAXException sxe) { @@ -344,14 +343,14 @@ private void createAssets( java.io.ByteArrayInputStream xml, x = sxe.getException(); } - LOG.warn( "createAssets() SAX exception: " + sxe.getMessage(), x ); + log.warn( "createAssets() SAX exception: " + sxe.getMessage(), x ); } catch (ParserConfigurationException pce) { // Parser with specified options can't be built - LOG.warn( "createAssets() SAX parser cannot be built with " + + log.warn( "createAssets() SAX parser cannot be built with " + "specified options" ); } catch (IOException ioe) { // I/O error - LOG.warn( "createAssets() IO exception", ioe ); + log.warn( "createAssets() IO exception", ioe ); } } @@ -414,7 +413,7 @@ private void populateAssetFromText( String elementName ) { // create a new record record = asset.createRecord( recordStructureId ); } catch( org.osid.repository.RepositoryException re ) { - LOG.warn( "populateAssetFromText() failed to " + + log.warn( "populateAssetFromText() failed to " + "create new Asset/Record pair.", re ); } } else if( elementName.equals( "record" ) ) { @@ -432,7 +431,7 @@ record = asset.createRecord( recordStructureId ); doRegexParse( ( String )inLineCitation.getValue() ); } } catch( org.osid.repository.RepositoryException re ) { - LOG.warn( "populateAssetFromText() failed to " + + log.warn( "populateAssetFromText() failed to " + "gracefully process inLineCitation value.", re ); } @@ -444,7 +443,7 @@ record = asset.createRecord( recordStructureId ); if ((preferredUrlFormat != null) && !(preferredUrlFormat.equalsIgnoreCase("HTML"))) { - LOG.debug("Unexpected URL format: " + preferredUrlFormat); + log.debug("Unexpected URL format: " + preferredUrlFormat); } if ((preferredUrlFormat == null) || @@ -457,7 +456,7 @@ record = asset.createRecord( recordStructureId ); } catch( org.osid.repository.RepositoryException exception) { - LOG.warn("Failed to create preferred URL Part", exception); + log.warn("Failed to create preferred URL Part", exception); } finally { @@ -551,7 +550,7 @@ record = asset.createRecord( recordStructureId ); text ); } } catch( org.osid.repository.RepositoryException re ) { - LOG.warn( "populateAssetFromText() failed to " + + log.warn( "populateAssetFromText() failed to " + "create new Part.", re ); } @@ -582,7 +581,7 @@ private void setDateRetrieved() { record.createPart( DateRetrievedPartStructure.getInstance().getId(), dateRetrieved ); } catch( org.osid.repository.RepositoryException re ) { - LOG.warn( "setDateRetrieved() failed " + + log.warn( "setDateRetrieved() failed " + "creating new dateRetrieved Part.", re ); } } @@ -607,7 +606,7 @@ private org.osid.repository.Part recordHasPart( } } } catch( org.osid.repository.RepositoryException re ) { - LOG.warn( "recordHasPart() failed getting Parts.", re ); + log.warn( "recordHasPart() failed getting Parts.", re ); } // did not find the Part @@ -980,7 +979,7 @@ private void doRegexParse( String citation ) { } } } catch( org.osid.repository.RepositoryException re ) { - LOG.warn( "doRegexParse() failed getting " + + log.warn( "doRegexParse() failed getting " + "PartStructure Types.", re ); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/AssetPresentationBean.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/AssetPresentationBean.java index 82462103ef5f..24f78e9e988a 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/AssetPresentationBean.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/AssetPresentationBean.java @@ -21,6 +21,7 @@ package org.sakaibrary.osid.repository.xserver; +import lombok.extern.slf4j.Slf4j; import org.sakaibrary.osid.repository.xserver.CreatorPartStructure; import org.sakaibrary.osid.repository.xserver.DatePartStructure; import org.sakaibrary.osid.repository.xserver.PagesPartStructure; @@ -33,12 +34,10 @@ * * @author gbhatnag */ +@Slf4j public class AssetPresentationBean implements java.io.Serializable { private static final long serialVersionUID = 1L; - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.AssetPresentationBean" ); private org.osid.repository.Asset asset; private String assetId; @@ -70,7 +69,7 @@ public AssetPresentationBean( org.osid.repository.Asset asset ) { } } } catch( Throwable t ) { - LOG.warn( "AssetPresentationBean() failed to loop through Asset, " + + log.warn( "AssetPresentationBean() failed to loop through Asset, " + "Record, Parts: " + t.getMessage(), t ); } @@ -141,4 +140,4 @@ public String getUrl() throws org.osid.repository.RepositoryException, public java.util.ArrayList getParts() { return parts; } -} \ No newline at end of file +} diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/CreatorPartStructure.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/CreatorPartStructure.java index 09760e7ef35b..9352db8564db 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/CreatorPartStructure.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/CreatorPartStructure.java @@ -21,12 +21,11 @@ package org.sakaibrary.osid.repository.xserver; +import lombok.extern.slf4j.Slf4j; + +@Slf4j public class CreatorPartStructure implements org.osid.repository.PartStructure { - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.CreatorPartStructure" ); - private org.osid.shared.Id CREATOR_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "mit.edu", "partStructure", "creator", "Creator" ); @@ -46,7 +45,7 @@ private CreatorPartStructure() this.CREATOR_PART_STRUCTURE_ID = Managers.getIdManager().getId( "b197541f201080006d751920168000100"); } catch (Throwable t) { - LOG.warn( "CreatorPartStructure() failed to get partStructure id: " + log.warn( "CreatorPartStructure() failed to get partStructure id: " + t.getMessage() ); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/DOIPartStructure.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/DOIPartStructure.java index 44464c29b219..0fadb26e49f5 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/DOIPartStructure.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/DOIPartStructure.java @@ -21,10 +21,10 @@ package org.sakaibrary.osid.repository.xserver; +import lombok.extern.slf4j.Slf4j; + +@Slf4j public class DOIPartStructure implements org.osid.repository.PartStructure { - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.DOIPartStructure" ); private org.osid.shared.Id DOI_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "sakaibrary", "partStructure", @@ -43,7 +43,7 @@ private DOIPartStructure() this.DOI_PART_STRUCTURE_ID = Managers.getIdManager().getId( "8na2340898wna345f5467ks72hk0001ff"); } catch (Throwable t) { - LOG.warn( "DOIPartStructure() failed to get partStructure id: " + log.warn( "DOIPartStructure() failed to get partStructure id: " + t.getMessage() ); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/DatePartStructure.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/DatePartStructure.java index 93403b23a742..7d45c6436a7f 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/DatePartStructure.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/DatePartStructure.java @@ -21,12 +21,11 @@ package org.sakaibrary.osid.repository.xserver; +import lombok.extern.slf4j.Slf4j; + +@Slf4j public class DatePartStructure implements org.osid.repository.PartStructure { - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.DatePartStructure" ); - private org.osid.shared.Id DATE_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "mit.edu", "partStructure", "date", "Date" ); @@ -45,7 +44,7 @@ private DatePartStructure() this.DATE_PART_STRUCTURE_ID = Managers.getIdManager().getId( "983287r98y32lala02387923gf470appl"); } catch (Throwable t) { - LOG.warn( "DatePartStructure() failed to get partStructure id: " + log.warn( "DatePartStructure() failed to get partStructure id: " + t.getMessage() ); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/DateRetrievedPartStructure.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/DateRetrievedPartStructure.java index aaeca7b7a95a..cd41c1458ac6 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/DateRetrievedPartStructure.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/DateRetrievedPartStructure.java @@ -21,13 +21,12 @@ package org.sakaibrary.osid.repository.xserver; +import lombok.extern.slf4j.Slf4j; + +@Slf4j public class DateRetrievedPartStructure implements org.osid.repository.PartStructure { - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.DateRetrievedPartStructure" ); - private org.osid.shared.Id DATE_RETRIEVED_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "sakaibrary", "partStructure", "dateRetrieved", "Date Retrieved" ); @@ -46,7 +45,7 @@ private DateRetrievedPartStructure() this.DATE_RETRIEVED_PART_STRUCTURE_ID = Managers.getIdManager().getId( "b1asbd8f09s3450909751910168500100"); } catch (Throwable t) { - LOG.warn( "DateRetrievedPartStructure() failed to get partStructure id: " + log.warn( "DateRetrievedPartStructure() failed to get partStructure id: " + t.getMessage() ); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/EditionPartStructure.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/EditionPartStructure.java index cd573d1a181a..13830cf13274 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/EditionPartStructure.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/EditionPartStructure.java @@ -21,11 +21,11 @@ package org.sakaibrary.osid.repository.xserver; +import lombok.extern.slf4j.Slf4j; + +@Slf4j public class EditionPartStructure implements org.osid.repository.PartStructure { - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.EditionPartStructure" ); private org.osid.shared.Id EDITION_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "sakaibrary", "partStructure", @@ -45,7 +45,7 @@ private EditionPartStructure() this.EDITION_PART_STRUCTURE_ID = Managers.getIdManager().getId( "09dfgljk2398dfknj98ewh34268000100"); } catch (Throwable t) { - LOG.warn( "EditionPartStructure() failed to get partStructure id: " + log.warn( "EditionPartStructure() failed to get partStructure id: " + t.getMessage() ); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/EndPagePartStructure.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/EndPagePartStructure.java index affdabd9707a..4fa808a6e666 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/EndPagePartStructure.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/EndPagePartStructure.java @@ -21,12 +21,11 @@ package org.sakaibrary.osid.repository.xserver; +import lombok.extern.slf4j.Slf4j; + +@Slf4j public class EndPagePartStructure implements org.osid.repository.PartStructure { - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.EndPagePartStructure" ); - private org.osid.shared.Id END_PAGE_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "sakaibrary", "partStructure", "endPage", "Page number that the resource content ends on" ); @@ -44,7 +43,7 @@ private EndPagePartStructure() this.END_PAGE_PART_STRUCTURE_ID = Managers.getIdManager().getId( "x323sd84h8kr98239823h543tg0982340"); } catch (Throwable t) { - LOG.warn( "EndPagePartStructure() failed to get partStructure id: " + log.warn( "EndPagePartStructure() failed to get partStructure id: " + t.getMessage() ); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/InLineCitationPartStructure.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/InLineCitationPartStructure.java index ecd972926f0e..d2820786f5a7 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/InLineCitationPartStructure.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/InLineCitationPartStructure.java @@ -21,13 +21,12 @@ package org.sakaibrary.osid.repository.xserver; +import lombok.extern.slf4j.Slf4j; + +@Slf4j public class InLineCitationPartStructure implements org.osid.repository.PartStructure { - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.InLineCitationPartStructure" ); - private org.osid.shared.Id INLINE_CITATION_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "sakaibrary", "partStructure", "inLineCitation", "In-line Citation from resource metadata" ); @@ -48,7 +47,7 @@ private InLineCitationPartStructure() } catch (Throwable t) { - LOG.warn( "InLineCitationPartStructure() failed to get partStructure id: " + log.warn( "InLineCitationPartStructure() failed to get partStructure id: " + t.getMessage() ); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/IsnIdentifierPartStructure.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/IsnIdentifierPartStructure.java index bb3aa9d77630..29bf524b4070 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/IsnIdentifierPartStructure.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/IsnIdentifierPartStructure.java @@ -21,13 +21,12 @@ package org.sakaibrary.osid.repository.xserver; +import lombok.extern.slf4j.Slf4j; + +@Slf4j public class IsnIdentifierPartStructure implements org.osid.repository.PartStructure { - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.IsnIdentifierPartStructure" ); - private org.osid.shared.Id ISN_IDENTIFIER_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "sakaibrary", "partStructure", "isnIdentifier", "International Standard Number" ); @@ -49,7 +48,7 @@ private IsnIdentifierPartStructure() } catch (Throwable t) { - LOG.warn( "IsnIdentifierPartStructure() failed to get partStructure id: " + log.warn( "IsnIdentifierPartStructure() failed to get partStructure id: " + t.getMessage() ); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/IssuePartStructure.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/IssuePartStructure.java index b3083aaded54..66591fe7f407 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/IssuePartStructure.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/IssuePartStructure.java @@ -21,12 +21,11 @@ package org.sakaibrary.osid.repository.xserver; +import lombok.extern.slf4j.Slf4j; + +@Slf4j public class IssuePartStructure implements org.osid.repository.PartStructure { - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.IssuePartStructure" ); - private org.osid.shared.Id ISSUE_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "sakaibrary", "partStructure", "issue", "Issue of resource container (i.e. Journal title, issue " + @@ -49,7 +48,7 @@ private IssuePartStructure() } catch (Throwable t) { - LOG.warn( "IssuePartStructure() failed to get partStructure id: " + log.warn( "IssuePartStructure() failed to get partStructure id: " + t.getMessage() ); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/LanguagePartStructure.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/LanguagePartStructure.java index 7bfd5ca840c9..466d74b19235 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/LanguagePartStructure.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/LanguagePartStructure.java @@ -21,13 +21,12 @@ package org.sakaibrary.osid.repository.xserver; +import lombok.extern.slf4j.Slf4j; + +@Slf4j public class LanguagePartStructure implements org.osid.repository.PartStructure { - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.LanguagePartStructure" ); - private org.osid.shared.Id LANGUAGE_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type("mit.edu","partStructure","language","Language"); private String displayName = "Language"; @@ -46,7 +45,7 @@ private LanguagePartStructure() } catch (Throwable t) { - LOG.warn( "LanguagePartStructure() failed to get partStructure id: " + log.warn( "LanguagePartStructure() failed to get partStructure id: " + t.getMessage() ); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/LocIdentifierPartStructure.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/LocIdentifierPartStructure.java index 74249d7f4961..59709613d4f6 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/LocIdentifierPartStructure.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/LocIdentifierPartStructure.java @@ -21,13 +21,12 @@ package org.sakaibrary.osid.repository.xserver; +import lombok.extern.slf4j.Slf4j; + +@Slf4j public class LocIdentifierPartStructure implements org.osid.repository.PartStructure { - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.LocIdentifierPartStructure" ); - private org.osid.shared.Id LOC_IDENTIFIER_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "sakaibrary", "partStructure", "locIdentifier", "Library of Congress call number" ); @@ -48,7 +47,7 @@ private LocIdentifierPartStructure() } catch (Throwable t) { - LOG.warn( "LocIdentifierPartStructure() failed to get partStructure id: " + log.warn( "LocIdentifierPartStructure() failed to get partStructure id: " + t.getMessage() ); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/NotePartStructure.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/NotePartStructure.java index be858694c2e8..8fd868f9d45f 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/NotePartStructure.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/NotePartStructure.java @@ -21,12 +21,11 @@ package org.sakaibrary.osid.repository.xserver; +import lombok.extern.slf4j.Slf4j; + +@Slf4j public class NotePartStructure implements org.osid.repository.PartStructure { - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.NotePartStructure" ); - private org.osid.shared.Id NOTE_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "sakaibrary", "partStructure", "note", "Note attached to resource metadata" ); @@ -48,7 +47,7 @@ private NotePartStructure() } catch (Throwable t) { - LOG.warn( "NotePartStructure() failed to get partStructure id: " + log.warn( "NotePartStructure() failed to get partStructure id: " + t.getMessage() ); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/OpenUrlPartStructure.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/OpenUrlPartStructure.java index f3f0440ff065..c5ab4ad78e2f 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/OpenUrlPartStructure.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/OpenUrlPartStructure.java @@ -21,12 +21,11 @@ package org.sakaibrary.osid.repository.xserver; +import lombok.extern.slf4j.Slf4j; + +@Slf4j public class OpenUrlPartStructure implements org.osid.repository.PartStructure { - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.OpenUrlPartStructure" ); - private org.osid.shared.Id OPENURL_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "sakaibrary", "partStructure", "openUrl", "OpenURL" ); @@ -49,7 +48,7 @@ private OpenUrlPartStructure() } catch (Throwable t) { - LOG.warn( "OpenUrlPartStructure() failed to get partStructure id: " + log.warn( "OpenUrlPartStructure() failed to get partStructure id: " + t.getMessage() ); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/PagesPartStructure.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/PagesPartStructure.java index 5222e4704dc8..adb01cde8b6c 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/PagesPartStructure.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/PagesPartStructure.java @@ -21,12 +21,11 @@ package org.sakaibrary.osid.repository.xserver; +import lombok.extern.slf4j.Slf4j; + +@Slf4j public class PagesPartStructure implements org.osid.repository.PartStructure { - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.PagesPartStructure" ); - private org.osid.shared.Id PAGES_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "sakaibrary", "partStructure", "pages", "Pages" ); @@ -44,7 +43,7 @@ private PagesPartStructure() this.PAGES_PART_STRUCTURE_ID = Managers.getIdManager().getId( "9jkds919283123b9sp6578909654sa88x" ); } catch( Throwable t ) { - LOG.warn( "PagesPartStructure() failed to get partStructure id: " + log.warn( "PagesPartStructure() failed to get partStructure id: " + t.getMessage() ); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/Part.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/Part.java index 1308001164d4..3dce371e9dd6 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/Part.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/Part.java @@ -21,17 +21,16 @@ package org.sakaibrary.osid.repository.xserver; +import lombok.extern.slf4j.Slf4j; + /** * @author Massachusetts Institute of Techbology, Sakai Software Development Team * @version */ +@Slf4j public class Part implements org.osid.repository.Part { - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.Part" ); - private org.osid.repository.PartStructure partStructure = null; private org.osid.shared.Id partStructureId = null; private java.io.Serializable value = null; @@ -126,7 +125,7 @@ protected Part(org.osid.shared.Id partStructureId } catch (Throwable t) { - LOG.warn(t.getMessage()); + log.warn(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.repository.RepositoryException.OPERATION_FAILED); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/PreferredUrlPartStructure.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/PreferredUrlPartStructure.java index a40a2e3575a5..02de253a4bee 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/PreferredUrlPartStructure.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/PreferredUrlPartStructure.java @@ -21,13 +21,12 @@ package org.sakaibrary.osid.repository.xserver; +import lombok.extern.slf4j.Slf4j; + +@Slf4j public class PreferredUrlPartStructure implements org.osid.repository.PartStructure { - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.PreferredUrlPartStructure" ); - private org.osid.shared.Id URL_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "sakaibrary", "partStructure", "preferredUrl", "PreferredURL" ); @@ -49,7 +48,7 @@ private PreferredUrlPartStructure() } catch (Throwable t) { - LOG.warn( "PreferredUrlPartStructure() failed to get partStructure id: " + log.warn( "PreferredUrlPartStructure() failed to get partStructure id: " + t.getMessage() ); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/PublicationLocationPartStructure.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/PublicationLocationPartStructure.java index 2da66f00fe35..faeab146ee6c 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/PublicationLocationPartStructure.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/PublicationLocationPartStructure.java @@ -21,13 +21,12 @@ package org.sakaibrary.osid.repository.xserver; +import lombok.extern.slf4j.Slf4j; + +@Slf4j public class PublicationLocationPartStructure implements org.osid.repository.PartStructure { - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.PublicationLocationPartStructure" ); - private org.osid.shared.Id PUBLICATION_LOCATION_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "sakaibrary", "partStructure", "publicationLocation", "Publication Location" ); @@ -50,7 +49,7 @@ private PublicationLocationPartStructure() } catch (Throwable t) { - LOG.warn( "PublicationLocationPartStructure() failed to get partStructure id: " + log.warn( "PublicationLocationPartStructure() failed to get partStructure id: " + t.getMessage() ); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/PublisherPartStructure.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/PublisherPartStructure.java index 39c0bee8bf3e..484a16f60fe9 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/PublisherPartStructure.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/PublisherPartStructure.java @@ -21,13 +21,12 @@ package org.sakaibrary.osid.repository.xserver; +import lombok.extern.slf4j.Slf4j; + +@Slf4j public class PublisherPartStructure implements org.osid.repository.PartStructure { - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.PublisherPartStructure" ); - private org.osid.shared.Id PUBLISHER_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type("mit.edu","partStructure","publisher","Publisher"); private String displayName = "Publisher"; @@ -46,7 +45,7 @@ private PublisherPartStructure() } catch (Throwable t) { - LOG.warn( "PublisherPartStructure() failed to get partStructure id: " + log.warn( "PublisherPartStructure() failed to get partStructure id: " + t.getMessage() ); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/Record.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/Record.java index 66a12641e497..65247049835d 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/Record.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/Record.java @@ -21,17 +21,16 @@ package org.sakaibrary.osid.repository.xserver; +import lombok.extern.slf4j.Slf4j; + /** * @author Massachusetts Institute of Techbology, Sakai Software Development Team * @version */ +@Slf4j public class Record implements org.osid.repository.Record { - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.Record" ); - private java.util.Vector partVector = new java.util.Vector(); private org.osid.id.IdManager idManager = null; private org.osid.shared.Id recordStructureId = null; @@ -62,7 +61,7 @@ protected Record(org.osid.shared.Id recordStructureId } catch (Throwable t) { - LOG.warn(t.getMessage()); + log.warn(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } @@ -79,7 +78,7 @@ public org.osid.repository.Part createPart(org.osid.shared.Id partStructureId } catch (Throwable t) { - LOG.warn(t.getMessage()); + log.warn(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } @@ -102,7 +101,7 @@ public void deletePart(org.osid.shared.Id partId) } catch (Throwable t) { - LOG.warn(t.getMessage()); + log.warn(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } @@ -135,7 +134,7 @@ public org.osid.repository.RecordStructure getRecordStructure() } catch (Throwable t) { - LOG.warn(t.getMessage()); + log.warn(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/RecordStructure.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/RecordStructure.java index adeeac8de2de..8d36f2023a89 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/RecordStructure.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/RecordStructure.java @@ -21,19 +21,17 @@ package org.sakaibrary.osid.repository.xserver; +import lombok.extern.slf4j.Slf4j; + /** * @author Massachusetts Institute of Techbology, Sakai Software Development * Team * @version */ +@Slf4j public class RecordStructure implements org.osid.repository.RecordStructure { - - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.RecordStructure" ); - private org.osid.shared.Id id = null; private String idString = "af106d4f201080006d751920168000100"; private String displayName = "Citation"; @@ -60,7 +58,7 @@ protected RecordStructure() } catch (Throwable t) { - LOG.warn(t.getMessage()); + log.warn(t.getMessage()); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/Repository.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/Repository.java index 1f1e05c07a23..1a9f0dfc98c5 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/Repository.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/Repository.java @@ -21,6 +21,7 @@ package org.sakaibrary.osid.repository.xserver; +import lombok.extern.slf4j.Slf4j; import org.sakaibrary.xserver.XServerException; import org.sakaibrary.xserver.XServer; import org.sakaiproject.citation.util.impl.CQL2XServerFindCommand; @@ -29,14 +30,11 @@ * * @author gbhatnag */ +@Slf4j public class Repository implements org.osid.repository.Repository { private static final long serialVersionUID = 1L; - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.Repository" ); - private org.osid.shared.Id id = null; private String idString = null; private String displayName = null; @@ -90,7 +88,7 @@ protected Repository( String displayName try { this.id = idManager.getId(this.idString); } catch (Throwable t) { - LOG.warn(t.getMessage()); + log.warn(t.getMessage()); } } @@ -197,7 +195,7 @@ public org.osid.shared.TypeIterator getAssetTypes() } catch (Throwable t) { - LOG.warn(t.getMessage()); + log.warn(t.getMessage()); throw new org.osid.repository.RepositoryException( org.osid.OsidException.OPERATION_FAILED); } @@ -239,7 +237,7 @@ public org.osid.shared.TypeIterator getSearchTypes() } catch (Throwable t) { - LOG.warn(t.getMessage()); + log.warn(t.getMessage()); throw new org.osid.repository.RepositoryException( org.osid.OsidException.OPERATION_FAILED); } @@ -347,7 +345,7 @@ public org.osid.repository.AssetIterator getAssetsBySearch( } if( !( searchCriteria instanceof String ) ) { - LOG.warn( "getAssetsBySearch() invalid search criteria: " + searchCriteria ); + log.warn( "getAssetsBySearch() invalid search criteria: " + searchCriteria ); throw new org.osid.repository.RepositoryException( org.osid.OsidException.OPERATION_FAILED ); } @@ -362,10 +360,10 @@ public org.osid.repository.AssetIterator getAssetsBySearch( knownPropertiesType = searchProperties.getType().isEqual( searchPropertiesType ); } catch( org.osid.shared.SharedException se ) { - LOG.warn( "Unable to check searchProperties Type" ); + log.warn( "Unable to check searchProperties Type" ); } if( !knownPropertiesType ) { - LOG.warn( "searchProperties are of unknown type" ); + log.warn( "searchProperties are of unknown type" ); throw new org.osid.repository.RepositoryException( org.osid.shared.SharedException.UNKNOWN_TYPE ); } @@ -379,7 +377,7 @@ public org.osid.repository.AssetIterator getAssetsBySearch( username = ( String ) searchProperties.getProperty( "username" ); password = ( String ) searchProperties.getProperty( "password" ); } catch( org.osid.shared.SharedException se ) { - LOG.warn( "Problem getting guid from org.osid.shared.Properties " + + log.warn( "Problem getting guid from org.osid.shared.Properties " + "object passed to getAssetsBySearch().", se ); throw new org.osid.repository.RepositoryException( org.osid.OsidException.OPERATION_FAILED ); @@ -389,7 +387,7 @@ public org.osid.repository.AssetIterator getAssetsBySearch( baseUrl == null || baseUrl.trim().equals( "" ) || username == null || username.trim().equals( "" ) || password == null || password.trim().equals( "" ) ) { - LOG.warn( "required search property is null or empty:" + + log.warn( "required search property is null or empty:" + "\n guid: " + guid + "\n baseUrl: " + baseUrl + "\n username: " + username + @@ -399,7 +397,7 @@ public org.osid.repository.AssetIterator getAssetsBySearch( } if( databaseIds == null || databaseIds.size() == 0 ) { - LOG.warn( "ERROR: databaseIds from org.osid.shared.Properties is " + + log.warn( "ERROR: databaseIds from org.osid.shared.Properties is " + "null or empty" ); throw new org.osid.repository.RepositoryException( org.osid.OsidException.OPERATION_FAILED ); @@ -412,7 +410,7 @@ public org.osid.repository.AssetIterator getAssetsBySearch( ( searchTypeVector.elementAt( i ) ); if( !type.isEqual( searchType ) ) { - LOG.warn( "searchType is of unknown type" ); + log.warn( "searchType is of unknown type" ); throw new org.osid.repository.RepositoryException( org.osid.shared.SharedException.UNKNOWN_TYPE ); } @@ -472,12 +470,12 @@ public org.osid.repository.AssetIterator getAssetsBySearch( } catch( XServerException xse ) { if( xse.getErrorCode() != null && !xse.getErrorCode().trim().equals("") ) { - LOG.warn( "X-Server error " + xse.getErrorCode() + " - " + + log.warn( "X-Server error " + xse.getErrorCode() + " - " + xse.getErrorText() ); } else { - LOG.warn( "X-Server error - " + xse.getErrorText() ); + log.warn( "X-Server error - " + xse.getErrorText() ); } throw new org.osid.repository.RepositoryException( org.sakaibrary.osid.repository.xserver. @@ -490,12 +488,12 @@ public org.osid.repository.AssetIterator getAssetsBySearch( } catch( XServerException xse ) { if( xse.getErrorCode() != null && !xse.getErrorCode().trim().equals("") ) { - LOG.warn( "X-Server error " + xse.getErrorCode() + " - " + + log.warn( "X-Server error " + xse.getErrorCode() + " - " + xse.getErrorText() ); } else { - LOG.warn( "X-Server error - " + xse.getErrorText() ); + log.warn( "X-Server error - " + xse.getErrorText() ); } throw new org.osid.repository.RepositoryException( org.sakaibrary.osid.repository.xserver. @@ -542,7 +540,7 @@ public org.osid.shared.PropertiesIterator getProperties() try { guid = ( String ) searchProperties.getProperty( "guid" ); } catch( org.osid.shared.SharedException se ) { - LOG.warn( "getProperties() could not get guid: " + + log.warn( "getProperties() could not get guid: " + se.getMessage(), se ); throw new org.osid.repository.RepositoryException( org.osid.OsidException.OPERATION_FAILED); @@ -566,7 +564,7 @@ public org.osid.shared.PropertiesIterator getProperties() } catch (Throwable t) { - LOG.warn(t.getMessage()); + log.warn(t.getMessage()); throw new org.osid.repository.RepositoryException( org.osid.OsidException.OPERATION_FAILED); } @@ -617,7 +615,7 @@ public org.osid.shared.TypeIterator getPropertyTypes() } catch (Throwable t) { - LOG.warn(t.getMessage()); + log.warn(t.getMessage()); throw new org.osid.repository.RepositoryException( org.osid.OsidException.OPERATION_FAILED); } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/RepositoryManager.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/RepositoryManager.java index 0f4d4e139bae..cb54296f29d8 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/RepositoryManager.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/RepositoryManager.java @@ -21,12 +21,15 @@ package org.sakaibrary.osid.repository.xserver; -/** +import lombok.extern.slf4j.Slf4j; + +/** * RepositoryManager manages Repositories. * * @author Gaurav Bhatnagar (gbhatnag@umich.edu) * @version */ +@Slf4j public class RepositoryManager implements org.osid.repository.RepositoryManager { // constants @@ -35,10 +38,6 @@ public class RepositoryManager implements org.osid.repository.RepositoryManager public static final String REPOSITORY_DESCRIPTION = "UM metasearch engine for searching library licensed digital content"; public static final String REPOSITORY_ID = "XSERVER01"; - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.RepositoryManager" ); - private org.osid.id.IdManager idManager = null; private org.osid.OsidContext context = null; private java.util.Vector repositoryVector = new java.util.Vector(); @@ -80,7 +79,7 @@ public void assignConfiguration(java.util.Properties configuration) } catch (Throwable t) { - LOG.warn( "RepositoryManager.assignConfiguration() failed in reading " + + log.warn( "RepositoryManager.assignConfiguration() failed in reading " + "configuration properties or creating a new Repository: " + t.getMessage(), t ); @@ -161,7 +160,7 @@ public org.osid.repository.Repository getRepository(org.osid.shared.Id repositor } catch (Throwable t) { - LOG.warn(t.getMessage()); + log.warn(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } @@ -189,7 +188,7 @@ public org.osid.repository.Asset getAsset(org.osid.shared.Id assetId) } catch (Throwable t) { - LOG.warn(t.getMessage()); + log.warn(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.UNKNOWN_ID); @@ -219,7 +218,7 @@ public org.osid.repository.Asset getAssetByDate(org.osid.shared.Id assetId } catch (Throwable t) { - LOG.warn(t.getMessage()); + log.warn(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.UNKNOWN_ID); @@ -249,7 +248,7 @@ public org.osid.shared.LongValueIterator getAssetDates(org.osid.shared.Id assetI } catch (Throwable t) { - LOG.warn(t.getMessage()); + log.warn(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } } @@ -291,7 +290,7 @@ public org.osid.shared.TypeIterator getRepositoryTypes() } catch( Throwable t ) { - LOG.warn( t.getMessage() ); + log.warn( t.getMessage() ); throw new org.osid.repository.RepositoryException( org.osid.OsidException.OPERATION_FAILED ); } @@ -300,6 +299,6 @@ public org.osid.shared.TypeIterator getRepositoryTypes() public void osidVersion_2_0() throws org.osid.repository.RepositoryException { - LOG.debug( "osidVersion_2_0() called" ); + log.debug( "osidVersion_2_0() called" ); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/RightsPartStructure.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/RightsPartStructure.java index fa7be12b96f1..25bfd8ad9d3f 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/RightsPartStructure.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/RightsPartStructure.java @@ -21,10 +21,10 @@ package org.sakaibrary.osid.repository.xserver; +import lombok.extern.slf4j.Slf4j; + +@Slf4j public class RightsPartStructure implements org.osid.repository.PartStructure { - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.RightsPartStructure" ); private org.osid.shared.Id RIGHTS_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "mit.edu", "partStructure", @@ -51,7 +51,7 @@ private RightsPartStructure() } catch (Throwable t) { - LOG.warn( "RightsPartStructure() failed to get partStructure id: " + log.warn( "RightsPartStructure() failed to get partStructure id: " + t.getMessage() ); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/SourceTitlePartStructure.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/SourceTitlePartStructure.java index 9e7b1568b533..7606128c6630 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/SourceTitlePartStructure.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/SourceTitlePartStructure.java @@ -21,13 +21,12 @@ package org.sakaibrary.osid.repository.xserver; +import lombok.extern.slf4j.Slf4j; + +@Slf4j public class SourceTitlePartStructure implements org.osid.repository.PartStructure { - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.SourceTitlePartStructure" ); - private org.osid.shared.Id SOURCE_TITLE_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type("sakaibrary", "partStructure", "sourceTitle", "Source Title" ); @@ -49,7 +48,7 @@ private SourceTitlePartStructure() } catch (Throwable t) { - LOG.warn( "SourceTitlePartStructure() failed to get partStructure id: " + log.warn( "SourceTitlePartStructure() failed to get partStructure id: " + t.getMessage() ); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/StartPagePartStructure.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/StartPagePartStructure.java index aa53f5adf71f..8a3e85f5025c 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/StartPagePartStructure.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/StartPagePartStructure.java @@ -21,12 +21,11 @@ package org.sakaibrary.osid.repository.xserver; +import lombok.extern.slf4j.Slf4j; + +@Slf4j public class StartPagePartStructure implements org.osid.repository.PartStructure { - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.StartPagePartStructure" ); - private org.osid.shared.Id START_PAGE_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "sakaibrary", "partStructure", "startPage", "Page number that resource content begins on" ); @@ -47,7 +46,7 @@ private StartPagePartStructure() } catch (Throwable t) { - LOG.warn( "StartPagePartStructure() failed to get partStructure id: " + log.warn( "StartPagePartStructure() failed to get partStructure id: " + t.getMessage() ); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/SubjectPartStructure.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/SubjectPartStructure.java index 33f4df3a9a28..89ed45be8e51 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/SubjectPartStructure.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/SubjectPartStructure.java @@ -21,13 +21,12 @@ package org.sakaibrary.osid.repository.xserver; +import lombok.extern.slf4j.Slf4j; + +@Slf4j public class SubjectPartStructure implements org.osid.repository.PartStructure { - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.SubjectPartStructure" ); - private org.osid.shared.Id SUBJECT_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type("mit.edu", "partStructure", "subject", "Subject"); @@ -48,7 +47,7 @@ private SubjectPartStructure() } catch (Throwable t) { - LOG.warn( "SubjectPartStructure() failed to get partStructure id: " + log.warn( "SubjectPartStructure() failed to get partStructure id: " + t.getMessage() ); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/TypePartStructure.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/TypePartStructure.java index bdd1ddf4cdfb..94102b08591c 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/TypePartStructure.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/TypePartStructure.java @@ -21,13 +21,12 @@ package org.sakaibrary.osid.repository.xserver; +import lombok.extern.slf4j.Slf4j; + +@Slf4j public class TypePartStructure implements org.osid.repository.PartStructure { - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.TypePartStructure" ); - private org.osid.shared.Id TYPE_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "mit.edu", "partStructure", "type","Type" ); @@ -48,7 +47,7 @@ private TypePartStructure() } catch (Throwable t) { - LOG.warn( "TypePartStructure() failed to get partStructure id: " + log.warn( "TypePartStructure() failed to get partStructure id: " + t.getMessage() ); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/URLFormatPartStructure.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/URLFormatPartStructure.java index b4ed8b148e0f..710148d445ba 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/URLFormatPartStructure.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/URLFormatPartStructure.java @@ -21,11 +21,11 @@ package org.sakaibrary.osid.repository.xserver; +import lombok.extern.slf4j.Slf4j; + +@Slf4j public class URLFormatPartStructure implements org.osid.repository.PartStructure { - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.URLFormatPartStructure" ); private org.osid.shared.Id URL_FORMAT_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "sakaibrary", "partStructure", @@ -48,7 +48,7 @@ private URLFormatPartStructure() } catch (Throwable t) { - LOG.warn( "URLFormatPartStructure() failed to get partStructure id: " + log.warn( "URLFormatPartStructure() failed to get partStructure id: " + t.getMessage() ); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/URLLabelPartStructure.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/URLLabelPartStructure.java index 435a52dc83b8..9b49e04b69c3 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/URLLabelPartStructure.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/URLLabelPartStructure.java @@ -21,11 +21,11 @@ package org.sakaibrary.osid.repository.xserver; +import lombok.extern.slf4j.Slf4j; + +@Slf4j public class URLLabelPartStructure implements org.osid.repository.PartStructure { - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.URLLabelPartStructure" ); private org.osid.shared.Id URL_LABEL_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "sakaibrary", "partStructure", @@ -47,7 +47,7 @@ private URLLabelPartStructure() } catch (Throwable t) { - LOG.warn( "URLLabelPartStructure() failed to get partStructure id: " + log.warn( "URLLabelPartStructure() failed to get partStructure id: " + t.getMessage() ); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/URLPartStructure.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/URLPartStructure.java index 66dab9da8a16..44199b851649 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/URLPartStructure.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/URLPartStructure.java @@ -21,13 +21,12 @@ package org.sakaibrary.osid.repository.xserver; +import lombok.extern.slf4j.Slf4j; + +@Slf4j public class URLPartStructure implements org.osid.repository.PartStructure { - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.URLPartStructure" ); - private org.osid.shared.Id URL_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "mit.edu", "partStructure", "URL", "URL associated with resource" ); @@ -49,7 +48,7 @@ private URLPartStructure() } catch (Throwable t) { - LOG.warn( "URLPartStructure() failed to get partStructure id: " + log.warn( "URLPartStructure() failed to get partStructure id: " + t.getMessage() ); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/VolumePartStructure.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/VolumePartStructure.java index 1e3adc7e3bfb..ce4127763a9d 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/VolumePartStructure.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/VolumePartStructure.java @@ -21,12 +21,11 @@ package org.sakaibrary.osid.repository.xserver; +import lombok.extern.slf4j.Slf4j; + +@Slf4j public class VolumePartStructure implements org.osid.repository.PartStructure { - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.VolumePartStructure" ); - private org.osid.shared.Id VOLUME_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "sakaibrary", "partStructure", "volume", "Volume number of source" ); @@ -48,7 +47,7 @@ private VolumePartStructure() } catch (Throwable t) { - LOG.warn( "VolumePartStructure() failed to get partStructure id: " + log.warn( "VolumePartStructure() failed to get partStructure id: " + t.getMessage() ); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/YearPartStructure.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/YearPartStructure.java index f37c4b673e8a..35d42189b3ed 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/YearPartStructure.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/YearPartStructure.java @@ -21,12 +21,11 @@ package org.sakaibrary.osid.repository.xserver; +import lombok.extern.slf4j.Slf4j; + +@Slf4j public class YearPartStructure implements org.osid.repository.PartStructure { - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.YearPartStructure" ); - private org.osid.shared.Id YEAR_PART_STRUCTURE_ID = null; private org.osid.shared.Type type = new Type( "sakaibrary", "partStructure", "year", "Year resource was created" ); @@ -47,7 +46,7 @@ private YearPartStructure() } catch (Throwable t) { - LOG.warn( "YearPartStructure() failed to get partStructure id: " + log.warn( "YearPartStructure() failed to get partStructure id: " + t.getMessage() ); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/xserver/FindResultSetBean.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/xserver/FindResultSetBean.java index 8104e6643244..0857d8009613 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/xserver/FindResultSetBean.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/xserver/FindResultSetBean.java @@ -21,11 +21,10 @@ package org.sakaibrary.xserver; +import lombok.extern.slf4j.Slf4j; + +@Slf4j public class FindResultSetBean { - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.xserver.FindResultSetBean" ); - private String baseName; private String sourceId; private String setNumber; @@ -99,12 +98,12 @@ public String getNumDocs() { } public void printInfo() { - LOG.debug( "\nFIND RESULT SET INFO" ); - LOG.debug( "source id: " + getSourceId() ); - LOG.debug( "full name: " + getFullName() ); - LOG.debug( "set number: " + getSetNumber() ); - LOG.debug( "status: " + getStatus() ); - LOG.debug( "error text: " + getFindErrorText() ); - LOG.debug( "docs found: " + getNumDocs() ); + log.debug( "\nFIND RESULT SET INFO" ); + log.debug( "source id: " + getSourceId() ); + log.debug( "full name: " + getFullName() ); + log.debug( "set number: " + getSetNumber() ); + log.debug( "status: " + getStatus() ); + log.debug( "error text: " + getFindErrorText() ); + log.debug( "docs found: " + getNumDocs() ); } } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/xserver/XMLCleanup.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/xserver/XMLCleanup.java index 5021f5de0b94..dd9ee0a53da0 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/xserver/XMLCleanup.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/xserver/XMLCleanup.java @@ -23,17 +23,15 @@ import java.io.*; +import lombok.extern.slf4j.Slf4j; import org.xml.sax.*; import org.xml.sax.helpers.DefaultHandler; import javax.xml.parsers.SAXParserFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; +@Slf4j public class XMLCleanup extends DefaultHandler { - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.xserver.XMLCleanup" ); - private ByteArrayOutputStream bytes; private Writer out; private InputStream inputXml; @@ -54,7 +52,7 @@ public XMLCleanup() { try { out = new OutputStreamWriter( bytes, "UTF8" ); } catch( UnsupportedEncodingException e ) { - LOG.warn( "XMLCleanup() unsupported encoding: " + e.getMessage() ); + log.warn( "XMLCleanup() unsupported encoding: " + e.getMessage() ); } } @@ -80,7 +78,7 @@ public ByteArrayOutputStream cleanup( InputStream xml) throws XServerException { } // Error generated by the parser - LOG.warn("XMLCleanup.cleanup() parsing exception: " + spe.getMessage() + + log.warn("XMLCleanup.cleanup() parsing exception: " + spe.getMessage() + " - xml line " + spe.getLineNumber() + ", uri " + spe.getSystemId(), x ); } catch (SAXException sxe) { @@ -92,17 +90,17 @@ public ByteArrayOutputStream cleanup( InputStream xml) throws XServerException { x = sxe.getException(); } - LOG.warn( "XMLCleanup.cleanup() SAX exception: " + sxe.getMessage(), + log.warn( "XMLCleanup.cleanup() SAX exception: " + sxe.getMessage(), x ); } catch (ParserConfigurationException pce) { // Parser with specified options can't be built - LOG.warn( "XMLCleanup.cleanup() SAX parser cannot be built with " + + log.warn( "XMLCleanup.cleanup() SAX parser cannot be built with " + "specified options" ); } catch (IOException ioe) { // I/O error - LOG.warn( "XMLCleanup.cleanup() IO exception", ioe ); + log.warn( "XMLCleanup.cleanup() IO exception", ioe ); } catch (Throwable t) { - LOG.warn( "XMLCleanup.cleanup() exception", t ); + log.warn( "XMLCleanup.cleanup() exception", t ); } if( error ) { @@ -237,9 +235,9 @@ public void error(SAXParseException e) throws SAXParseException { // dump warnings too public void warning(SAXParseException err) throws SAXParseException { - LOG.warn("SAXParser warning" + ", xml line " + err.getLineNumber() + + log.warn("SAXParser warning" + ", xml line " + err.getLineNumber() + ", uri " + err.getSystemId()); - LOG.warn(" " + err.getMessage()); + log.warn(" " + err.getMessage()); } //=========================================================== diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/xserver/XMLTransform.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/xserver/XMLTransform.java index 0825e799a9c9..6fd92b90fde3 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/xserver/XMLTransform.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/xserver/XMLTransform.java @@ -24,6 +24,8 @@ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; + +import lombok.extern.slf4j.Slf4j; import org.xml.sax.SAXException; import org.w3c.dom.Document; @@ -37,11 +39,8 @@ import javax.xml.transform.stream.StreamResult; import java.io.*; +@Slf4j public class XMLTransform { - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.xserver.XMLTransform" ); - private Document document; private String xslFileName; private ByteArrayOutputStream xml; @@ -74,11 +73,11 @@ public ByteArrayOutputStream transform() { transformer.transform( source, result ); } catch ( TransformerConfigurationException tce ) { // Error generated by the parser - LOG.warn( "XMLTransform.transform() - TransformerFactory error: " + log.warn( "XMLTransform.transform() - TransformerFactory error: " + tce.getMessage() ); } catch( TransformerException te ) { // Error generated by the parser - LOG.warn( "XMLTransform.transform() - Transformation error: " + log.warn( "XMLTransform.transform() - Transformation error: " + te.getMessage() ); } catch( SAXException sxe ) { // Error generated by this application @@ -89,15 +88,15 @@ public ByteArrayOutputStream transform() { x = sxe.getException(); } - LOG.warn( "XMLTransform.transform() SAX exception: " + sxe.getMessage(), + log.warn( "XMLTransform.transform() SAX exception: " + sxe.getMessage(), x ); } catch( ParserConfigurationException pce ) { // Parser with specified options can't be built - LOG.warn( "XMLTransform.transform() SAX parser cannot be built with " + + log.warn( "XMLTransform.transform() SAX parser cannot be built with " + "specified options" ); } catch( IOException ioe ) { // I/O error - LOG.warn( "XMLCleanup.cleanup() IO exception", ioe ); + log.warn( "XMLCleanup.cleanup() IO exception", ioe ); } return transformedXml; diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/xserver/XServer.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/xserver/XServer.java index 0afdfd8e46d3..974a6d486289 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/xserver/XServer.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/xserver/XServer.java @@ -36,6 +36,7 @@ import java.net.HttpURLConnection; //SAX XML parsing imports +import lombok.extern.slf4j.Slf4j; import org.sakaibrary.osid.repository.xserver.SearchStatusProperties; import org.sakaibrary.xserver.session.MetasearchSession; import org.sakaibrary.xserver.session.MetasearchSessionManager; @@ -45,6 +46,7 @@ import javax.xml.parsers.SAXParser; import javax.xml.parsers.ParserConfigurationException; +@Slf4j public class XServer extends DefaultHandler { // // Number of records the Xserver should fetch at one time @@ -57,9 +59,6 @@ public class XServer extends DefaultHandler { boolean printXML = false; /* constants */ - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.xserver.XServer" ); private static final String XSLT_FILE = "/xsl/xserver2sakaibrary.xsl"; /* fields coming from searchProperties */ @@ -125,12 +124,12 @@ public XServer( String guid ) x = sxe.getException(); } - LOG.warn( "XServer() SAX exception in trying to get a new SAXParser " + + log.warn( "XServer() SAX exception in trying to get a new SAXParser " + "from SAXParserFactory: " + sxe.getMessage(), x ); throw new RuntimeException( "XServer() SAX exception: " + sxe.getMessage(), x ); } catch (ParserConfigurationException pce) { // Parser with specified options can't be built - LOG.warn( "XServer() SAX parser cannot be built with specified options" ); + log.warn( "XServer() SAX parser cannot be built with specified options" ); throw new RuntimeException( "XServer() SAX parser cannot be built with " + "specified options: " + pce.getMessage(), pce ); } @@ -175,7 +174,7 @@ public XServer( String guid ) pageSize = ( Integer ) searchProperties.getProperty( "pageSize" ); startRecord = ( Integer ) searchProperties.getProperty( "startRecord" ); } catch( org.osid.shared.SharedException se ) { - LOG.warn( "XServer() failed to get search properties - will assign " + + log.warn( "XServer() failed to get search properties - will assign " + "defaults", se ); } @@ -195,7 +194,7 @@ public XServer( String guid ) // check args if( startRecord.intValue() <= 0 ) { - LOG.warn( "XServer() - startRecord must be set to 1 or higher." ); + log.warn( "XServer() - startRecord must be set to 1 or higher." ); startRecord = null; startRecord = new Integer( 1 ); } @@ -232,7 +231,7 @@ private boolean loginURL( String username, String password ) if( printXML ) { // print xml - LOG.debug( xml.toString() ); + log.debug( xml.toString() ); } // run SAX Parser @@ -247,11 +246,11 @@ private boolean loginURL( String username, String password ) x = sxe.getException(); } - LOG.warn( "loginURL() SAX exception: " + sxe.getMessage(), + log.warn( "loginURL() SAX exception: " + sxe.getMessage(), x ); } catch (IOException ioe) { // I/O error - LOG.warn( "loginURL() IO exception", ioe ); + log.warn( "loginURL() IO exception", ioe ); } // return whether or not the login was successful @@ -301,7 +300,7 @@ private void findURL( String findCommand, String waitFlag ) if( printXML ) { // print xml - LOG.debug( xml.toString() ); + log.debug( xml.toString() ); } // run SAX Parser @@ -316,10 +315,10 @@ private void findURL( String findCommand, String waitFlag ) x = sxe.getException(); } - LOG.warn( "findURL() SAX exception: " + sxe.getMessage(), x ); + log.warn( "findURL() SAX exception: " + sxe.getMessage(), x ); } catch (IOException ioe) { // I/O error - LOG.warn( "findURL() IO exception", ioe ); + log.warn( "findURL() IO exception", ioe ); } } @@ -342,7 +341,7 @@ private void findGroupInfoURL() throws XServerException { if( printXML ) { // print xml - LOG.debug( xml.toString() ); + log.debug( xml.toString() ); } // run SAX Parser @@ -357,10 +356,10 @@ private void findGroupInfoURL() throws XServerException { x = sxe.getException(); } - LOG.warn( "findGroupInfoURL() SAX exception: " + sxe.getMessage(), x ); + log.warn( "findGroupInfoURL() SAX exception: " + sxe.getMessage(), x ); } catch (IOException ioe) { // I/O error - LOG.warn( "findGroupInfoURL() IO exception", ioe ); + log.warn( "findGroupInfoURL() IO exception", ioe ); } } @@ -400,7 +399,7 @@ private void mergeSortURL( String action, String primarySortKey ) if( printXML ) { // print xml - LOG.debug( xml.toString() ); + log.debug( xml.toString() ); } // run SAX Parser @@ -415,10 +414,10 @@ private void mergeSortURL( String action, String primarySortKey ) x = sxe.getException(); } - LOG.warn( "mergeSortURL() SAX exception: " + sxe.getMessage(), x ); + log.warn( "mergeSortURL() SAX exception: " + sxe.getMessage(), x ); } catch (IOException ioe) { // I/O error - LOG.warn( "mergeSortURL() IO exception", ioe ); + log.warn( "mergeSortURL() IO exception", ioe ); } } @@ -464,7 +463,7 @@ private ByteArrayOutputStream presentURL( String setNumber, String setEntry ) if( printXML ) { // print xml - LOG.debug( xml.toString() ); + log.debug( xml.toString() ); } return xml; @@ -493,7 +492,7 @@ public ByteArrayInputStream getRecordsXML( int numAssets ) throws XServerException, org.osid.repository.RepositoryException { // check args if( numAssets < 0 ) { - LOG.warn( "getRecordsXML() - numAssets below zero." ); + log.warn( "getRecordsXML() - numAssets below zero." ); numAssets = 0; } @@ -511,7 +510,7 @@ public ByteArrayInputStream getRecordsXML( int numAssets ) if( setNumber == null ) { // null setNumber indicates multiple search sources, do a merge - LOG.debug( "getRecordsXML() - doing merge, set number is null" ); + log.debug( "getRecordsXML() - doing merge, set number is null" ); mergeSortURL( "merge", sortBy ); // we'll be getting a new setNumber for the merged set, store it @@ -523,7 +522,7 @@ public ByteArrayInputStream getRecordsXML( int numAssets ) } else { if( !singleSearchSource ) { // do a merge_more if we're working with multiple search sources - LOG.debug( "getRecordsXML() - doing merge_more, set number " + + log.debug( "getRecordsXML() - doing merge_more, set number " + "is " + setNumber ); mergeSortURL( "merge_more", sortBy ); } @@ -586,7 +585,7 @@ public ByteArrayInputStream getRecordsXML( int numAssets ) ** **** end original code ********/ setEntryEnd = df.format( setEntryEndValue ); - LOG.debug( "getRecordsXML() - presenting records: " + + log.debug( "getRecordsXML() - presenting records: " + setEntryStart + "-" + setEntryEnd ); // run the present X-Service @@ -606,7 +605,7 @@ public void initAsynchSearch( String criteria, throws XServerException { this.searchSourceIds = sourceIds; - LOG.debug( "initAsynchSearch() - searchSourceIds: " + searchSourceIds.size() ); + log.debug( "initAsynchSearch() - searchSourceIds: " + searchSourceIds.size() ); if( searchSourceIds.size() == 1 ) { // only one search source - do not need to merge singleSearchSource = true; @@ -614,7 +613,7 @@ public void initAsynchSearch( String criteria, singleSearchSource = false; } - LOG.debug( "initAsynchSearch() - find_command: " + criteria ); + log.debug( "initAsynchSearch() - find_command: " + criteria ); // run the find X-Service in non-blocking mode findURL( criteria, "N" ); @@ -977,11 +976,11 @@ private boolean checkSessionState() { metasearchSession.getFoundGroupNumber() == null || metasearchSession.getSearchProperties() == null ) { if( metasearchSession == null ) { - LOG.error( "checkSessionState() - session state out of sync:" + + log.error( "checkSessionState() - session state out of sync:" + "\n guid: " + guid + "\n MetasearchSession: null" ); } else { - LOG.error( "checkSessionState() - session state out of sync:" + + log.error( "checkSessionState() - session state out of sync:" + "\n guid: " + guid + "\n MetasearchSession: " + metasearchSession + "\n logged in: " + metasearchSession.isLoggedIn() + @@ -1022,13 +1021,13 @@ private ByteArrayOutputStream doURLConnection( String urlQuery ) // disconnect urlConn.disconnect(); } catch( MalformedURLException mue ) { - LOG.warn( "doURLConnection() malformed URL" ); + log.warn( "doURLConnection() malformed URL" ); wrapXServerException( null, "Error in connecting to X-Server. Please contact Citations Helper Administrator." ); } catch( IOException ioe ) { - LOG.warn( "doURLConnection() IOException, connection failed" ); + log.warn( "doURLConnection() IOException, connection failed" ); wrapXServerException( null, "Error in connecting to X-Server. Please contact Citations Helper Administrator." ); } catch( XServerException xse ) { - LOG.warn( "doURLConnection() - XServerException: " + + log.warn( "doURLConnection() - XServerException: " + xse.getErrorCode() + " - " + xse.getErrorText() ); wrapXServerException( xse.getErrorCode(), xse.getErrorText() + "Please contact Citations Helper Administrator." ); } diff --git a/citations/citations-osid/xserver/src/java/org/sakaibrary/xserver/session/MetasearchSessionManager.java b/citations/citations-osid/xserver/src/java/org/sakaibrary/xserver/session/MetasearchSessionManager.java index 4f2d2528982a..ed21eda55e70 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaibrary/xserver/session/MetasearchSessionManager.java +++ b/citations/citations-osid/xserver/src/java/org/sakaibrary/xserver/session/MetasearchSessionManager.java @@ -21,6 +21,7 @@ package org.sakaibrary.xserver.session; +import lombok.extern.slf4j.Slf4j; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.memory.api.Cache; import org.sakaiproject.memory.api.MemoryService; @@ -33,12 +34,10 @@ * * @author gbhatnag */ +@Slf4j public class MetasearchSessionManager implements java.io.Serializable { /* constants */ private static final String CACHE_NAME = "org.sakaibrary.xserver.session.MetasearchSession"; - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.osid.repository.xserver.session.MetasearchSessionManager" ); /* private static variables */ private static MemoryService memoryService = (MemoryService)ComponentManager.get(MemoryService.class); @@ -54,7 +53,7 @@ private MetasearchSessionManager() { if ( cache == null ) { cache = memoryService.getCache(CACHE_NAME); - LOG.info( "MetasearchSessionManager cache session initiated properly." ); + log.info( "MetasearchSessionManager cache session initiated properly." ); } } @@ -84,7 +83,7 @@ public void putMetasearchSession( String guid, MetasearchSession ms ) { // given guid and ms.getGuid() should match -- TODO new Exception Type? if( !ms.getGuid().equals( guid ) ) { - LOG.warn( "putMetasearchSession(): putting MetasearchSession into " + + log.warn( "putMetasearchSession(): putting MetasearchSession into " + "cache with mismatched guids..." ); } @@ -105,7 +104,7 @@ public MetasearchSession getMetasearchSession( String guid ) { MetasearchSession ms = (MetasearchSession) cache.get( guid ); return ms; } catch( Exception ce ) { - LOG.warn( "MetasearchSessionManager.getMetasearchSession()" + + log.warn( "MetasearchSessionManager.getMetasearchSession()" + " cannot get cache with guid: " + guid, ce ); } diff --git a/citations/citations-osid/xserver/src/java/org/sakaiproject/component/osid/id/Id.java b/citations/citations-osid/xserver/src/java/org/sakaiproject/component/osid/id/Id.java index a33668b8b6d4..e78159cd3a70 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaiproject/component/osid/id/Id.java +++ b/citations/citations-osid/xserver/src/java/org/sakaiproject/component/osid/id/Id.java @@ -21,17 +21,16 @@ package org.sakaiproject.component.osid.id; +import lombok.extern.slf4j.Slf4j; + +@Slf4j public class Id implements org.osid.shared.Id { - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaiproject.component.osid.id.Id" ); - private String idString = null; private void log(String entry) throws org.osid.shared.SharedException { - LOG.debug("Id.log() entry: " + entry); + log.debug("Id.log() entry: " + entry); } protected Id() throws org.osid.shared.SharedException diff --git a/citations/citations-osid/xserver/src/java/org/sakaiproject/component/osid/id/IdManager.java b/citations/citations-osid/xserver/src/java/org/sakaiproject/component/osid/id/IdManager.java index 27eed06b98fc..428168b7f6c9 100644 --- a/citations/citations-osid/xserver/src/java/org/sakaiproject/component/osid/id/IdManager.java +++ b/citations/citations-osid/xserver/src/java/org/sakaiproject/component/osid/id/IdManager.java @@ -21,12 +21,11 @@ package org.sakaiproject.component.osid.id; +import lombok.extern.slf4j.Slf4j; + +@Slf4j public class IdManager implements org.osid.id.IdManager { - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaiproject.component.osid.id.IdManager" ); - org.osid.OsidContext context = null; java.util.Properties configuration = null; @@ -48,7 +47,7 @@ public void assignConfiguration(java.util.Properties configuration) throws org.o private void log(String entry) throws org.osid.id.IdException { - LOG.debug("IdManager.log() entry: " + entry); + log.debug("IdManager.log() entry: " + entry); } public org.osid.shared.Id createId() throws org.osid.id.IdException diff --git a/citations/citations-servlet/servlet/src/java/org/sakaiproject/citation/servlet/BatchCitationServlet.java b/citations/citations-servlet/servlet/src/java/org/sakaiproject/citation/servlet/BatchCitationServlet.java index 8c094321f5a3..743f96e2f021 100644 --- a/citations/citations-servlet/servlet/src/java/org/sakaiproject/citation/servlet/BatchCitationServlet.java +++ b/citations/citations-servlet/servlet/src/java/org/sakaiproject/citation/servlet/BatchCitationServlet.java @@ -38,8 +38,8 @@ import javax.servlet.http.HttpServletRequestWrapper; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.citation.api.Citation; import org.sakaiproject.citation.api.Schema; import org.sakaiproject.content.api.ContentResource; @@ -56,7 +56,7 @@ public class BatchCitationServlet extends CitationServlet { - private static Log log = LogFactory.getLog(BatchCitationServlet.class); + private static Logger log = LoggerFactory.getLogger(BatchCitationServlet.class); /** * respond to an HTTP GET request diff --git a/citations/citations-servlet/servlet/src/java/org/sakaiproject/citation/servlet/CitationServlet.java b/citations/citations-servlet/servlet/src/java/org/sakaiproject/citation/servlet/CitationServlet.java index c7c81ff437c3..7daba9e858de 100644 --- a/citations/citations-servlet/servlet/src/java/org/sakaiproject/citation/servlet/CitationServlet.java +++ b/citations/citations-servlet/servlet/src/java/org/sakaiproject/citation/servlet/CitationServlet.java @@ -21,30 +21,12 @@ package org.sakaiproject.citation.servlet; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.HashMap; -import java.util.logging.Logger; - -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - import org.sakaiproject.cheftool.VmServlet; import org.sakaiproject.citation.api.*; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.content.api.ContentHostingService; import org.sakaiproject.content.api.ContentResource; import org.sakaiproject.entity.api.ResourceProperties; -import org.sakaiproject.entity.api.Reference; -import org.sakaiproject.entity.cover.EntityManager; import org.sakaiproject.exception.IdUnusedException; import org.sakaiproject.exception.PermissionException; import org.sakaiproject.exception.ServerOverloadException; @@ -55,12 +37,19 @@ import org.sakaiproject.tool.api.ToolException; import org.sakaiproject.tool.cover.ActiveToolManager; import org.sakaiproject.tool.cover.SessionManager; -import org.sakaiproject.user.cover.UserDirectoryService; -import org.sakaiproject.util.BasicAuth; -import org.sakaiproject.util.ParameterParser; -import org.sakaiproject.util.ResourceLoader; -import org.sakaiproject.util.Validator; -import org.sakaiproject.util.Web; +import org.sakaiproject.util.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; /** * @@ -76,8 +65,7 @@ public class CitationServlet extends VmServlet public static final String COMPACT_TEMPLATE = "/vm/compact.vm"; // private String collectionTitle = null; - /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(CitationServlet.class); + private static final Logger M_log = LoggerFactory.getLogger(CitationServlet.class); /** Resource bundle using current language locale */ protected static ResourceLoader rb = new ResourceLoader("citations"); @@ -173,9 +161,7 @@ public void init( ServletConfig config ) throws ServletException */ public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { - if(M_log.isDebugEnabled()) { - M_log.debug("doGet() " + req.getMethod()); - } + M_log.debug("doGet() {}", req.getMethod()); // process any login that might be present basicAuth.doLogin(req); diff --git a/citations/citations-tool/tool/src/java/org/sakaiproject/citation/tool/CitationHelperAction.java b/citations/citations-tool/tool/src/java/org/sakaiproject/citation/tool/CitationHelperAction.java index 16b06aada183..70fad117bdac 100644 --- a/citations/citations-tool/tool/src/java/org/sakaiproject/citation/tool/CitationHelperAction.java +++ b/citations/citations-tool/tool/src/java/org/sakaiproject/citation/tool/CitationHelperAction.java @@ -53,8 +53,8 @@ import net.sf.json.JSONObject; import org.apache.commons.io.input.BOMInputStream; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.map.type.TypeFactory; import org.sakaiproject.antivirus.api.VirusFoundException; @@ -451,7 +451,7 @@ public static void clearAdvancedFormState( SessionState state ) } } - protected final static Log logger = LogFactory.getLog(CitationHelperAction.class); + protected final static Logger logger = LoggerFactory.getLogger(CitationHelperAction.class); public static ResourceLoader rb = new ResourceLoader("citations"); @@ -672,7 +672,7 @@ protected void toolModeDispatch(String methodBase, String methodExt, HttpServlet catch (IOException e) { logger.warn("IOException", e); - // Log.warn("chef", this + " : ", e); + // Logger.warn("chef", this + " : ", e); } return; } diff --git a/citations/citations-tool/tool/src/java/org/sakaiproject/citation/tool/EditorIntegrationHelperAction.java b/citations/citations-tool/tool/src/java/org/sakaiproject/citation/tool/EditorIntegrationHelperAction.java index 8452f4809a9e..55f765ec6ada 100644 --- a/citations/citations-tool/tool/src/java/org/sakaiproject/citation/tool/EditorIntegrationHelperAction.java +++ b/citations/citations-tool/tool/src/java/org/sakaiproject/citation/tool/EditorIntegrationHelperAction.java @@ -42,8 +42,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.SecurityAdvisor; import org.sakaiproject.authz.cover.SecurityService; import org.sakaiproject.cheftool.Context; @@ -112,7 +112,7 @@ */ public class EditorIntegrationHelperAction extends CitationHelperAction { - protected final static Log m_log = LogFactory.getLog(EditorIntegrationHelperAction.class); + protected final static Logger m_log = LoggerFactory.getLogger(EditorIntegrationHelperAction.class); /** * Editor Integration Library Resources Search @@ -301,4 +301,4 @@ private boolean isNull(String string) { return (string == null) || (string.trim().length() == 0); } -} \ No newline at end of file +} diff --git a/citations/citations-util/util/src/java/org/sakaiproject/citation/util/impl/CQL2XServerFindCommand.java b/citations/citations-util/util/src/java/org/sakaiproject/citation/util/impl/CQL2XServerFindCommand.java index ba7c1172a148..6052a5fa3789 100644 --- a/citations/citations-util/util/src/java/org/sakaiproject/citation/util/impl/CQL2XServerFindCommand.java +++ b/citations/citations-util/util/src/java/org/sakaiproject/citation/util/impl/CQL2XServerFindCommand.java @@ -4,17 +4,14 @@ import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; +import lombok.extern.slf4j.Slf4j; import org.xml.sax.Attributes; import org.xml.sax.SAXException; +@Slf4j public class CQL2XServerFindCommand extends org.xml.sax.helpers.DefaultHandler implements org.sakaiproject.citation.util.api.CQL2MetasearchCommand { - // logger - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.common.search.impl.CQL2XServerFindCommand" ); - // index mappings private static final java.util.Map INDEX_MAP = new java.util.HashMap(); static { @@ -59,11 +56,11 @@ public CQL2XServerFindCommand() { x = sxe.getException(); } - LOG.warn( "CQL2XServerFindCommand() SAX exception: " + sxe.getMessage(), + log.warn( "CQL2XServerFindCommand() SAX exception: " + sxe.getMessage(), x ); } catch (ParserConfigurationException pce) { // Parser with specified options can't be built - LOG.warn( "CQL2XServerFindCommand() SAX parser cannot be built with " + + log.warn( "CQL2XServerFindCommand() SAX parser cannot be built with " + "specified options" ); } } @@ -88,10 +85,10 @@ public String doCQL2MetasearchCommand( String cqlSearchQuery ) { // parse the criteria root = parser.parse( cqlSearchQuery ); } catch( java.io.IOException ioe ) { - LOG.warn( "CQL2XServerFindCommand.doCQL2MetasearchCommand() IO " + + log.warn( "CQL2XServerFindCommand.doCQL2MetasearchCommand() IO " + "exception while parsing: " + ioe.getMessage() ); } catch( org.z3950.zing.cql.CQLParseException e ) { - LOG.warn( "CQL2XServerFindCommand.doCQL2MetasearchCommand() CQL " + + log.warn( "CQL2XServerFindCommand.doCQL2MetasearchCommand() CQL " + "parsing exception while parsing: " + e.getMessage() ); } @@ -108,7 +105,7 @@ public String doCQL2MetasearchCommand( String cqlSearchQuery ) { byteInputStream = new java.io.ByteArrayInputStream( cqlXml.getBytes( "UTF8" ) ); } catch( java.io.UnsupportedEncodingException uee ) { - LOG.warn( "CQL2XServerFindCommand.doCQL2MetasearchCommand() " + + log.warn( "CQL2XServerFindCommand.doCQL2MetasearchCommand() " + "unsupported encoding: " + uee.getMessage() ); } @@ -125,7 +122,7 @@ public String doCQL2MetasearchCommand( String cqlSearchQuery ) { saxParser.parse( byteInputStream, this ); byteInputStream.close(); } catch( java.io.IOException ioe ) { - LOG.warn( "CQL2XServerFindCommand.doCQL2MetasearchCommand() " + + log.warn( "CQL2XServerFindCommand.doCQL2MetasearchCommand() " + "unable to close byteStream: " + ioe.getMessage() ); } catch( org.xml.sax.SAXException sxe ) { // Error generated by this application @@ -136,7 +133,7 @@ public String doCQL2MetasearchCommand( String cqlSearchQuery ) { x = sxe.getException(); } - LOG.warn( "CQL2XServerFindCommand() SAX exception: " + + log.warn( "CQL2XServerFindCommand() SAX exception: " + sxe.getMessage(), x ); } @@ -249,7 +246,7 @@ private String translateIndex( String cqlIndex ) { String xserverIndex = ( String ) INDEX_MAP.get( cqlIndex ); if( xserverIndex == null || xserverIndex.equals( "" ) ) { - LOG.warn( "CQL2XServerFindCommand.translateIndex() - null/empty index" ); + log.warn( "CQL2XServerFindCommand.translateIndex() - null/empty index" ); // default to keyword xserverIndex = "WRD"; } @@ -261,7 +258,7 @@ private String translateBooleanRelation( String booleanRelation ) { String xserverBoolean = ( String ) BOOL_RELATION_MAP.get( booleanRelation ); if( xserverBoolean == null || xserverBoolean.equals( "" ) ) { - LOG.warn( "CQL2XServerFindCommand.translateIndex() - null/empty boolean relation" ); + log.warn( "CQL2XServerFindCommand.translateIndex() - null/empty boolean relation" ); // default to and xserverBoolean = "%20AND%20"; } diff --git a/citations/citations-util/util/src/java/org/sakaiproject/citation/util/impl/CQLSearchQuery.java b/citations/citations-util/util/src/java/org/sakaiproject/citation/util/impl/CQLSearchQuery.java index e5cc04e80b96..758c0d52547d 100644 --- a/citations/citations-util/util/src/java/org/sakaiproject/citation/util/impl/CQLSearchQuery.java +++ b/citations/citations-util/util/src/java/org/sakaiproject/citation/util/impl/CQLSearchQuery.java @@ -1,13 +1,10 @@ package org.sakaiproject.citation.util.impl; -import org.sakaiproject.citation.util.api.SearchQuery; +import lombok.extern.slf4j.Slf4j; +@Slf4j public class CQLSearchQuery implements org.sakaiproject.citation.util.api.CQLSearchQuery { - - private static final org.apache.commons.logging.Log LOG = - org.apache.commons.logging.LogFactory.getLog( - "org.sakaibrary.common.search.impl.CQLSearchQuery" ); private org.sakaiproject.citation.util.api.SearchQuery searchQuery; private String cqlQuery; @@ -35,7 +32,7 @@ public String getCQLSearchQueryString( String yearString = getYearString(); // debugging - LOG.debug( "going to parse - keyword: " + keywordString + + log.debug( "going to parse - keyword: " + keywordString + "; title: " + titleString + "; author: " + authorString + "; subject: " + subjectString + "; year: " + yearString ); @@ -64,7 +61,7 @@ public String getCQLSearchQueryString( searchString = searchString.replaceAll( "\\s", " and " ); // debugging - LOG.debug( "full search string to parse: " + searchString ); + log.debug( "full search string to parse: " + searchString ); // convert the searchString to CQL org.z3950.zing.cql.CQLParser parser = new org.z3950.zing.cql.CQLParser(); @@ -74,10 +71,10 @@ public String getCQLSearchQueryString( // parse the criteria root = parser.parse( searchString ); } catch( java.io.IOException ioe ) { - LOG.warn( "CQLSearchQuery.getCQLSearchQueryString() IO " + + log.warn( "CQLSearchQuery.getCQLSearchQueryString() IO " + "exception while parsing: " + ioe.getMessage() ); } catch( org.z3950.zing.cql.CQLParseException e ) { - LOG.warn( "CQLSearchQuery.getCQLSearchQueryString() CQL " + + log.warn( "CQLSearchQuery.getCQLSearchQueryString() CQL " + "parsing exception while parsing: " + e.getMessage() ); } diff --git a/cloud-content/impl/src/main/java/coza/opencollab/sakai/cloudcontent/Logger.java b/cloud-content/impl/src/main/java/coza/opencollab/sakai/cloudcontent/CommonLogger.java similarity index 97% rename from cloud-content/impl/src/main/java/coza/opencollab/sakai/cloudcontent/Logger.java rename to cloud-content/impl/src/main/java/coza/opencollab/sakai/cloudcontent/CommonLogger.java index 9397fec921e1..b34c4ec1adbc 100644 --- a/cloud-content/impl/src/main/java/coza/opencollab/sakai/cloudcontent/Logger.java +++ b/cloud-content/impl/src/main/java/coza/opencollab/sakai/cloudcontent/CommonLogger.java @@ -6,7 +6,7 @@ * * @author OpenCollab */ -public interface Logger { +public interface CommonLogger { /** * Called if the space used on the account has reached a warning limit. diff --git a/cloud-content/impl/src/main/java/coza/opencollab/sakai/cloudcontent/SwiftFileSystemHandler.java b/cloud-content/impl/src/main/java/coza/opencollab/sakai/cloudcontent/SwiftFileSystemHandler.java index 69cf660e7693..ba89bcf47cbd 100644 --- a/cloud-content/impl/src/main/java/coza/opencollab/sakai/cloudcontent/SwiftFileSystemHandler.java +++ b/cloud-content/impl/src/main/java/coza/opencollab/sakai/cloudcontent/SwiftFileSystemHandler.java @@ -1,7 +1,7 @@ package coza.opencollab.sakai.cloudcontent; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.io.Closeables; @@ -94,21 +94,21 @@ public class SwiftFileSystemHandler implements FileSystemHandler { /** * The logger for warnings and errors. */ - private Logger logger = new DefaultLogger(); + private CommonLogger logger = new DefaultLogger(); /** - * The limit where a error will be made using the Logger. + * The limit where a error will be made using the CommonLogger. */ private long errorLimitForAccountSizeInBytes = -1L; /** - * The limit where a warning will be made using the Logger. + * The limit where a warning will be made using the CommonLogger. */ private long warningLimitForAccountSizeInBytes = -1L; /** - * The limit where a error will be made using the Logger. + * The limit where a error will be made using the CommonLogger. */ private long errorLimitForContainerSizeInBytes = -1L; /** - * The limit where a warning will be made using the Logger. + * The limit where a warning will be made using the CommonLogger. */ private long warningLimitForContainerSizeInBytes = -1L; // private boolean retrieveContainerFromIdWithRegex = false; @@ -188,11 +188,11 @@ public void setInvalidCharactersRegex(String invalidCharactersRegex) { } /** - * The limit where a error will be made using the Logger. + * The limit where a error will be made using the CommonLogger. * If the value (default) is negative this will not be tested. * If positive then a exception will be thrown before a new resource is saved * and the bytes used in the account is already over this value. - * A error will also be logged to the Logger. + * A error will also be logged to the CommonLogger. * * Note that this test is run before the save, thus it is possible that * the value can be exceeded after the save with no exception. @@ -202,9 +202,9 @@ public void setErrorLimitForAccountSizeInBytes(long errorLimitForAccountSizeInBy } /** - * The limit where a warning will be made using the Logger. + * The limit where a warning will be made using the CommonLogger. * If the value (default) is negative this will not be tested. - * If positive then a warning will be logged to the Logger. + * If positive then a warning will be logged to the CommonLogger. * * Note that this test is run before the save, thus it is possible that * the value can be exceeded after the save with no warning. @@ -214,11 +214,11 @@ public void setWarningLimitForAccountSizeInBytes(long warningLimitForAccountSize } /** - * The limit where a error will be made using the Logger. + * The limit where a error will be made using the CommonLogger. * If the value (default) is negative this will not be tested. * If positive then a exception will be thrown before a new resource is saved * and the bytes used in the container is already over this value. - * A error will also be logged to the Logger. + * A error will also be logged to the CommonLogger. * * Note that this test is run before the save, thus it is possible that * the value can be exceeded after the save with no exception. @@ -230,7 +230,7 @@ public void setErrorLimitForContainerSizeInBytes(long errorLimitForContainerSize /** * The limit where a warning will be made using the WarningLogger. * If the value (default) is negative this will not be tested. - * If positive then a warning will be logged to the Logger. + * If positive then a warning will be logged to the CommonLogger. * * Note that this test is run before the save, thus it is possible that * the value can be exceeded after the save with no warning. @@ -242,7 +242,7 @@ public void setWarningLimitForContainerSizeInBytes(long warningLimitForContainer /** * The logger for warnings and errors. */ - public void setLogger(Logger logger) { + public void setLogger(CommonLogger logger) { this.logger = logger; } @@ -349,7 +349,7 @@ public boolean delete(String id, String root, String filePath) { /** * Checks the space used for the account against the space available. - * Will call the Logger to report any warning or error. + * Will call the CommonLogger to report any warning or error. */ private void checkAccountSpace() throws IOException{ if(warningLimitForAccountSizeInBytes <= 0L && errorLimitForAccountSizeInBytes <= 0L){ @@ -368,7 +368,7 @@ private void checkAccountSpace() throws IOException{ /** * Checks the space used for the container against the space available. - * Will call the Logger to report any warning or error. + * Will call the CommonLogger to report any warning or error. */ private void checkContainerSpace(String container) throws IOException{ if(warningLimitForContainerSizeInBytes <= 0L && errorLimitForContainerSizeInBytes <= 0L){ @@ -457,28 +457,28 @@ class ContainerAndName { /** * A simple implementation that uses typical commons-logging. */ - class DefaultLogger implements Logger { + class DefaultLogger implements CommonLogger { - private Log log = LogFactory.getLog(SwiftFileSystemHandler.class); + private final Logger log = LoggerFactory.getLogger(SwiftFileSystemHandler.class); @Override public void warningOnAccountSize(long warningLimitInBytes, long bytesUsed) { - log.warn("Warning on Swift account size -- warningLimit: " + warningLimitInBytes + ", bytesUsed: " + bytesUsed); + log.warn("Warning on Swift account size -- warningLimit: {}, bytesUsed: {}", warningLimitInBytes, bytesUsed); } @Override public void errorOnAccountSize(long maxSizeInBytes, long bytesUsed) { - log.error("Error on Swift account size -- maxSize: " + maxSizeInBytes + ", bytesUsed: " + bytesUsed); + log.error("Error on Swift account size -- maxSize: {}, bytesUsed: {}", maxSizeInBytes, bytesUsed); } @Override public void warningOnContainerSize(long warningLimitInBytes, long bytesUsed) { - log.warn("Warning on Swift container size -- warningLimit: " + warningLimitInBytes + ", bytesUsed: " + bytesUsed); + log.warn("Warning on Swift container size -- warningLimit: {}, bytesUsed: {}", warningLimitInBytes, bytesUsed); } @Override public void errorOnContainerSize(long maxSizeInBytes, long bytesUsed) { - log.error("Error on Swift container size -- maxSize: " + maxSizeInBytes + ", bytesUsed: " + bytesUsed); + log.error("Error on Swift container size -- maxSize: {}, bytesUsed: {}", maxSizeInBytes, bytesUsed); } }; } diff --git a/cmprovider/src/java/org/sakaiproject/cmprovider/AbstractCmEntityProvider.java b/cmprovider/src/java/org/sakaiproject/cmprovider/AbstractCmEntityProvider.java index 448905856e2d..b8d5ba1e31c9 100644 --- a/cmprovider/src/java/org/sakaiproject/cmprovider/AbstractCmEntityProvider.java +++ b/cmprovider/src/java/org/sakaiproject/cmprovider/AbstractCmEntityProvider.java @@ -9,8 +9,8 @@ import javax.validation.Validator; import javax.validation.Validation; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroupService; import org.sakaiproject.cmprovider.data.CmEntityData; @@ -105,7 +105,7 @@ public abstract class AbstractCmEntityProvider implements RESTful, CoreEntityPro protected SessionManager sessionManager; public void setSessionManager(SessionManager manager) { sessionManager = manager; } - private static final Log LOG = LogFactory.getLog(AbstractCmEntityProvider.class); + private static final Logger LOG = LoggerFactory.getLogger(AbstractCmEntityProvider.class); public String[] getHandledOutputFormats() { return new String[] { Formats.JSON }; diff --git a/common/archive-impl/impl2/src/java/org/sakaiproject/archive/impl/ArchiveService2Impl.java b/common/archive-impl/impl2/src/java/org/sakaiproject/archive/impl/ArchiveService2Impl.java index 7896a5b773be..bbdc9071087a 100644 --- a/common/archive-impl/impl2/src/java/org/sakaiproject/archive/impl/ArchiveService2Impl.java +++ b/common/archive-impl/impl2/src/java/org/sakaiproject/archive/impl/ArchiveService2Impl.java @@ -21,8 +21,8 @@ import java.io.IOException; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.archive.api.ArchiveService; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.entity.api.EntityManager; @@ -30,7 +30,7 @@ public class ArchiveService2Impl implements ArchiveService { /** Our logger. */ - private static Log M_log = LogFactory.getLog(ArchiveService2Impl.class); + private static Logger M_log = LoggerFactory.getLogger(ArchiveService2Impl.class); /******************************************************************************* * Dependencies and their setter methods diff --git a/common/archive-impl/impl2/src/java/org/sakaiproject/archive/impl/ImportMetadataImpl.java b/common/archive-impl/impl2/src/java/org/sakaiproject/archive/impl/ImportMetadataImpl.java index f6b62f387149..8284822a22ea 100644 --- a/common/archive-impl/impl2/src/java/org/sakaiproject/archive/impl/ImportMetadataImpl.java +++ b/common/archive-impl/impl2/src/java/org/sakaiproject/archive/impl/ImportMetadataImpl.java @@ -21,8 +21,8 @@ package org.sakaiproject.archive.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.archive.api.ImportMetadata; /** @@ -32,7 +32,7 @@ */ public class ImportMetadataImpl implements ImportMetadata { - private static final Log LOG = LogFactory.getLog(ImportMetadataImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(ImportMetadataImpl.class); private String id; private String legacyTool; @@ -151,4 +151,4 @@ public void setSakaiTool(String sakaiTool) this.sakaiTool = sakaiTool; } -} \ No newline at end of file +} diff --git a/common/archive-impl/impl2/src/java/org/sakaiproject/archive/impl/ImportMetadataServiceImpl.java b/common/archive-impl/impl2/src/java/org/sakaiproject/archive/impl/ImportMetadataServiceImpl.java index a06295a6c394..122c6bf7a6d8 100644 --- a/common/archive-impl/impl2/src/java/org/sakaiproject/archive/impl/ImportMetadataServiceImpl.java +++ b/common/archive-impl/impl2/src/java/org/sakaiproject/archive/impl/ImportMetadataServiceImpl.java @@ -24,8 +24,8 @@ import java.util.ArrayList; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.archive.api.ImportMetadata; import org.sakaiproject.archive.api.ImportMetadataService; import org.w3c.dom.Document; @@ -41,7 +41,7 @@ public class ImportMetadataServiceImpl implements ImportMetadataService { - private static final Log LOG = LogFactory.getLog(ImportMetadataImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(ImportMetadataImpl.class); private static final String ROOT = "importConfiguration"; private static final String MAPPINGS = "mappings"; @@ -330,4 +330,4 @@ public boolean hasMaintainRole(String username, Document siteDoc) } return false; } -} \ No newline at end of file +} diff --git a/common/archive-impl/impl2/src/java/org/sakaiproject/archive/impl/SiteArchiver.java b/common/archive-impl/impl2/src/java/org/sakaiproject/archive/impl/SiteArchiver.java index 6d985b975de9..3dfeef0c0f45 100644 --- a/common/archive-impl/impl2/src/java/org/sakaiproject/archive/impl/SiteArchiver.java +++ b/common/archive-impl/impl2/src/java/org/sakaiproject/archive/impl/SiteArchiver.java @@ -29,8 +29,8 @@ import java.util.regex.Pattern; import java.util.regex.Matcher; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.archive.api.ArchiveService; import org.sakaiproject.authz.api.AuthzGroup; import org.sakaiproject.authz.api.GroupNotDefinedException; @@ -58,7 +58,7 @@ public class SiteArchiver { - private static Log M_log = LogFactory.getLog(SiteArchiver.class); + private static Logger M_log = LoggerFactory.getLogger(SiteArchiver.class); /** Dependency: ServerConfigurationService. */ protected ServerConfigurationService m_serverConfigurationService = null; @@ -105,8 +105,7 @@ public String archive(String siteId, String m_storagePath, String fromSystem) { StringBuilder results = new StringBuilder(); - if (M_log.isDebugEnabled()) - M_log.debug("archive(): site: " + siteId); + M_log.debug("archive(): site: {}", siteId); Site theSite = null; try @@ -323,7 +322,7 @@ protected String archiveSite(Site site, Document doc, Stack stack, String fromSy } catch(Exception any) { - M_log.warn("archve: exception archiving site: "+ site.getId() + ": ", any); + M_log.warn("archve: exception archiving site: {}: {}", site.getId(), any); } stack.pop(); @@ -363,16 +362,16 @@ protected String archiveUsers(Site site, Document doc, Stack stack) } catch (GroupNotDefinedException e) { - M_log.warn(e, e); + M_log.warn(e.getMessage(), e); } catch (Exception any) { - M_log.warn(any,any); + M_log.warn(any.getMessage(), any); } } catch (Exception any) { - M_log.warn(any,any); + M_log.warn(any.getMessage(), any); } stack.pop(); diff --git a/common/archive-impl/impl2/src/java/org/sakaiproject/archive/impl/SiteMerger.java b/common/archive-impl/impl2/src/java/org/sakaiproject/archive/impl/SiteMerger.java index 0969c0caa5c9..82bb9fb3a8e3 100644 --- a/common/archive-impl/impl2/src/java/org/sakaiproject/archive/impl/SiteMerger.java +++ b/common/archive-impl/impl2/src/java/org/sakaiproject/archive/impl/SiteMerger.java @@ -27,8 +27,8 @@ import java.util.Vector; import org.apache.commons.codec.binary.Base64; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.archive.api.ArchiveService; import org.sakaiproject.authz.api.AuthzGroup; import org.sakaiproject.authz.api.AuthzGroupService; @@ -52,7 +52,7 @@ import org.w3c.dom.NodeList; public class SiteMerger { - private static Log M_log = LogFactory.getLog(SiteMerger.class); + private static Logger M_log = LoggerFactory.getLogger(SiteMerger.class); protected static HashMap userIdTrans = new HashMap(); @@ -388,7 +388,7 @@ protected void mergeSite(String siteId, String fromSiteId, Element element, Hash } catch(Exception any) { - M_log.warn(any,any); + M_log.warn(any.getMessage(), any); } Site site = null; @@ -417,7 +417,7 @@ protected void mergeSite(String siteId, String fromSiteId, Element element, Hash mergeSiteRoles(element3, siteId, useIdTrans, filterSakaiRoles, filteredSakaiRoles); } catch (PermissionException e1) { - M_log.warn(e1,e1); + M_log.warn(e1.getMessage(), e1); } } } diff --git a/common/archive-impl/impl2/src/java/org/sakaiproject/archive/impl/SiteZipper.java b/common/archive-impl/impl2/src/java/org/sakaiproject/archive/impl/SiteZipper.java index 89e583d2c216..4da5c5907951 100644 --- a/common/archive-impl/impl2/src/java/org/sakaiproject/archive/impl/SiteZipper.java +++ b/common/archive-impl/impl2/src/java/org/sakaiproject/archive/impl/SiteZipper.java @@ -37,14 +37,14 @@ import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ServerConfigurationService; public class SiteZipper { - private static Log log = LogFactory.getLog(SiteZipper.class); + private static Logger log = LoggerFactory.getLogger(SiteZipper.class); protected ServerConfigurationService serverConfigurationService = null; public void setServerConfigurationService(ServerConfigurationService service) { diff --git a/common/common-composite-component/src/java/org/sakaiproject/component/common/edu/person/FileSystemPhotoService.java b/common/common-composite-component/src/java/org/sakaiproject/component/common/edu/person/FileSystemPhotoService.java index 219aa6fcaf8f..9a62c9b7d852 100644 --- a/common/common-composite-component/src/java/org/sakaiproject/component/common/edu/person/FileSystemPhotoService.java +++ b/common/common-composite-component/src/java/org/sakaiproject/component/common/edu/person/FileSystemPhotoService.java @@ -6,15 +6,15 @@ import java.io.FileOutputStream; import java.io.IOException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.common.edu.person.BasePhotoService; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.user.api.UserDirectoryService; import org.sakaiproject.user.api.UserNotDefinedException; public class FileSystemPhotoService extends BasePhotoService { - private static final Log LOG = LogFactory.getLog(FileSystemPhotoService.class); + private static final Logger LOG = LoggerFactory.getLogger(FileSystemPhotoService.class); private String photoRepositoryPath = null; diff --git a/common/common-composite-component/src/java/org/sakaiproject/component/common/edu/person/SakaiPersonManagerImpl.java b/common/common-composite-component/src/java/org/sakaiproject/component/common/edu/person/SakaiPersonManagerImpl.java index 871fb36cede5..4f17da0da856 100644 --- a/common/common-composite-component/src/java/org/sakaiproject/component/common/edu/person/SakaiPersonManagerImpl.java +++ b/common/common-composite-component/src/java/org/sakaiproject/component/common/edu/person/SakaiPersonManagerImpl.java @@ -45,8 +45,8 @@ import org.hibernate.criterion.Order; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.common.edu.person.PhotoService; import org.sakaiproject.api.common.edu.person.SakaiPerson; import org.sakaiproject.api.common.edu.person.SakaiPersonManager; @@ -71,7 +71,7 @@ */ public class SakaiPersonManagerImpl extends HibernateDaoSupport implements SakaiPersonManager { - private static final Log LOG = LogFactory.getLog(SakaiPersonManagerImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(SakaiPersonManagerImpl.class); private static final String PERCENT_SIGN = "%"; diff --git a/common/common-composite-component/src/java/org/sakaiproject/component/common/edu/person/SakaiPersonObserver.java b/common/common-composite-component/src/java/org/sakaiproject/component/common/edu/person/SakaiPersonObserver.java index 21ae70a49ef3..245a41110e8a 100644 --- a/common/common-composite-component/src/java/org/sakaiproject/component/common/edu/person/SakaiPersonObserver.java +++ b/common/common-composite-component/src/java/org/sakaiproject/component/common/edu/person/SakaiPersonObserver.java @@ -24,8 +24,8 @@ import java.util.Observable; import java.util.Observer; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.common.edu.person.SakaiPerson; import org.sakaiproject.api.common.edu.person.SakaiPersonManager; import org.sakaiproject.component.api.ServerConfigurationService; @@ -42,7 +42,7 @@ */ public class SakaiPersonObserver implements Observer { - private static Log log = LogFactory.getLog(SakaiPersonObserver.class); + private static Logger log = LoggerFactory.getLogger(SakaiPersonObserver.class); private EventTrackingService eventTrackingService; public void setEventTrackingService(EventTrackingService eventTrackingService) { diff --git a/common/common-composite-component/src/java/org/sakaiproject/component/common/edu/person/SakaiPersonPhotoService.java b/common/common-composite-component/src/java/org/sakaiproject/component/common/edu/person/SakaiPersonPhotoService.java index f45475d7b01b..343ec034ceac 100644 --- a/common/common-composite-component/src/java/org/sakaiproject/component/common/edu/person/SakaiPersonPhotoService.java +++ b/common/common-composite-component/src/java/org/sakaiproject/component/common/edu/person/SakaiPersonPhotoService.java @@ -22,8 +22,8 @@ package org.sakaiproject.component.common.edu.person; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.common.edu.person.PhotoService; import org.sakaiproject.api.common.edu.person.SakaiPersonManager; @@ -32,7 +32,7 @@ * By default, roster photos come from the Profile service. */ public class SakaiPersonPhotoService implements PhotoService { - private static final Log log = LogFactory.getLog(SakaiPersonPhotoService.class); + private static final Logger log = LoggerFactory.getLogger(SakaiPersonPhotoService.class); private SakaiPersonManager sakaiPersonManager; diff --git a/common/common-composite-component/src/java/org/sakaiproject/component/common/manager/PersistableHelper.java b/common/common-composite-component/src/java/org/sakaiproject/component/common/manager/PersistableHelper.java index 422ac29d0474..b36f04f37179 100644 --- a/common/common-composite-component/src/java/org/sakaiproject/component/common/manager/PersistableHelper.java +++ b/common/common-composite-component/src/java/org/sakaiproject/component/common/manager/PersistableHelper.java @@ -25,8 +25,8 @@ import java.util.Date; import org.apache.commons.beanutils.PropertyUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.common.manager.Persistable; import org.sakaiproject.tool.api.Session; import org.sakaiproject.tool.api.SessionManager; @@ -38,7 +38,7 @@ public class PersistableHelper { private static final String SYSTEM = "SYSTEM"; - private static final Log LOG = LogFactory.getLog(PersistableHelper.class); + private static final Logger LOG = LoggerFactory.getLogger(PersistableHelper.class); private static final String LASTMODIFIEDDATE = "lastModifiedDate"; @@ -66,15 +66,9 @@ public void modifyPersistableFields(Persistable persistable) PropertyUtils.setProperty(persistable, LASTMODIFIEDBY, actor); PropertyUtils.setProperty(persistable, LASTMODIFIEDDATE, now); } - catch (NoSuchMethodException e) + catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { - LOG.error(e); - throw new RuntimeException(e); - } catch (IllegalAccessException e) { - LOG.error(e); - throw new RuntimeException(e); - } catch (InvocationTargetException e) { - LOG.error(e); + LOG.error(e.getMessage()); throw new RuntimeException(e); } } @@ -97,15 +91,9 @@ public void createPersistableFields(Persistable persistable) PropertyUtils.setProperty(persistable, CREATEDBY, actor); PropertyUtils.setProperty(persistable, CREATEDDATE, now); } - catch (NoSuchMethodException e) + catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { - LOG.error(e); - throw new RuntimeException(e); - } catch (IllegalAccessException e) { - LOG.error(e); - throw new RuntimeException(e); - } catch (InvocationTargetException e) { - LOG.error(e); + LOG.error(e.getMessage()); throw new RuntimeException(e); } } diff --git a/common/common-composite-component/src/java/org/sakaiproject/component/common/type/TypeManagerImpl.java b/common/common-composite-component/src/java/org/sakaiproject/component/common/type/TypeManagerImpl.java index f84099eea160..6bacebeb1376 100644 --- a/common/common-composite-component/src/java/org/sakaiproject/component/common/type/TypeManagerImpl.java +++ b/common/common-composite-component/src/java/org/sakaiproject/component/common/type/TypeManagerImpl.java @@ -27,8 +27,8 @@ import org.hibernate.Query; import org.hibernate.Session; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.common.type.Type; import org.sakaiproject.api.common.type.TypeManager; import org.sakaiproject.component.common.manager.PersistableHelper; @@ -41,7 +41,7 @@ */ public class TypeManagerImpl extends HibernateDaoSupport implements TypeManager { - private static final Log LOG = LogFactory.getLog(TypeManagerImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(TypeManagerImpl.class); private static final String ID = "id"; diff --git a/common/impl/src/java/org/sakaiproject/component/common/edu/person/InetOrgPersonImpl.java b/common/impl/src/java/org/sakaiproject/component/common/edu/person/InetOrgPersonImpl.java index 680a02149af6..3bac9535fbf5 100644 --- a/common/impl/src/java/org/sakaiproject/component/common/edu/person/InetOrgPersonImpl.java +++ b/common/impl/src/java/org/sakaiproject/component/common/edu/person/InetOrgPersonImpl.java @@ -31,8 +31,8 @@ import org.hibernate.Hibernate; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.common.edu.person.InetOrgPerson; import org.sakaiproject.api.common.edu.person.OrganizationalPerson; import org.sakaiproject.api.common.edu.person.Person; @@ -43,7 +43,7 @@ */ public class InetOrgPersonImpl extends OrganizationalPersonImpl implements Person, OrganizationalPerson, InetOrgPerson { - private static final Log LOG = LogFactory.getLog(InetOrgPersonImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(InetOrgPersonImpl.class); /** * @see org.sakaiproject.service.profile.InetOrgPerson#getAudio() diff --git a/common/impl/src/java/org/sakaiproject/component/common/edu/person/SakaiPersonImpl.java b/common/impl/src/java/org/sakaiproject/component/common/edu/person/SakaiPersonImpl.java index ada32e636087..3c24d22712dd 100644 --- a/common/impl/src/java/org/sakaiproject/component/common/edu/person/SakaiPersonImpl.java +++ b/common/impl/src/java/org/sakaiproject/component/common/edu/person/SakaiPersonImpl.java @@ -21,8 +21,8 @@ package org.sakaiproject.component.common.edu.person; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.common.edu.person.InetOrgPerson; import org.sakaiproject.api.common.edu.person.OrganizationalPerson; import org.sakaiproject.api.common.edu.person.Person; @@ -34,7 +34,7 @@ */ public class SakaiPersonImpl extends EduPersonImpl implements Person, OrganizationalPerson, InetOrgPerson, SakaiPerson { - private static final Log LOG = LogFactory.getLog(SakaiPersonImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(SakaiPersonImpl.class); /** * Empty constuctor for hibernate diff --git a/common/impl/src/java/org/sakaiproject/component/common/manager/PersistableImpl.java b/common/impl/src/java/org/sakaiproject/component/common/manager/PersistableImpl.java index 369c5367cacc..3c14bfd4e02b 100644 --- a/common/impl/src/java/org/sakaiproject/component/common/manager/PersistableImpl.java +++ b/common/impl/src/java/org/sakaiproject/component/common/manager/PersistableImpl.java @@ -23,8 +23,8 @@ import java.util.Date; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.common.manager.Persistable; /** @@ -32,7 +32,7 @@ */ public abstract class PersistableImpl implements Persistable { - private static final Log LOG = LogFactory.getLog(PersistableImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(PersistableImpl.class); protected Long id; diff --git a/common/impl/src/java/org/sakaiproject/component/common/manager/TypeablePersistableImpl.java b/common/impl/src/java/org/sakaiproject/component/common/manager/TypeablePersistableImpl.java index f0de8b74d8b1..9a4b9897403d 100644 --- a/common/impl/src/java/org/sakaiproject/component/common/manager/TypeablePersistableImpl.java +++ b/common/impl/src/java/org/sakaiproject/component/common/manager/TypeablePersistableImpl.java @@ -21,8 +21,8 @@ package org.sakaiproject.component.common.manager; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.common.type.Type; import org.sakaiproject.api.common.type.Typeable; @@ -31,7 +31,7 @@ */ public abstract class TypeablePersistableImpl extends PersistableImpl implements Typeable { - private static final Log LOG = LogFactory.getLog(TypeablePersistableImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(TypeablePersistableImpl.class); private static final String NULL = "null"; diff --git a/common/impl/src/java/org/sakaiproject/component/common/type/TypeImpl.java b/common/impl/src/java/org/sakaiproject/component/common/type/TypeImpl.java index bdc20328db14..d376608f2c4d 100644 --- a/common/impl/src/java/org/sakaiproject/component/common/type/TypeImpl.java +++ b/common/impl/src/java/org/sakaiproject/component/common/type/TypeImpl.java @@ -21,8 +21,8 @@ package org.sakaiproject.component.common.type; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.common.type.Type; import org.sakaiproject.component.common.manager.PersistableImpl; @@ -31,7 +31,7 @@ */ public class TypeImpl extends PersistableImpl implements Type { - private static final Log LOG = LogFactory.getLog(TypeImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(TypeImpl.class); private String authority; diff --git a/common/import-handlers/content-handlers/src/java/org/sakaiproject/importer/impl/handlers/LBCCHandler.java b/common/import-handlers/content-handlers/src/java/org/sakaiproject/importer/impl/handlers/LBCCHandler.java index d959e6184d97..a1e04a8f62a3 100644 --- a/common/import-handlers/content-handlers/src/java/org/sakaiproject/importer/impl/handlers/LBCCHandler.java +++ b/common/import-handlers/content-handlers/src/java/org/sakaiproject/importer/impl/handlers/LBCCHandler.java @@ -71,12 +71,12 @@ import javax.activation.MimetypesFileTypeMap; -import org.apache.commons.logging.LogFactory; -import org.apache.commons.logging.Log; +import org.slf4j.LoggerFactory; +import org.slf4j.Logger; public class LBCCHandler implements HandlesImportable { - private Log m_log = LogFactory.getLog(org.sakaiproject.importer.impl.handlers.LBCCHandler.class); + private Logger m_log = LoggerFactory.getLogger(org.sakaiproject.importer.impl.handlers.LBCCHandler.class); public boolean canHandleType(String typeName) { return "lessonbuilder-cc-file".equals(typeName); diff --git a/common/import-handlers/content-handlers/src/java/org/sakaiproject/importer/impl/handlers/ResourcesHandler.java b/common/import-handlers/content-handlers/src/java/org/sakaiproject/importer/impl/handlers/ResourcesHandler.java index d853393737f4..73492ae30eda 100644 --- a/common/import-handlers/content-handlers/src/java/org/sakaiproject/importer/impl/handlers/ResourcesHandler.java +++ b/common/import-handlers/content-handlers/src/java/org/sakaiproject/importer/impl/handlers/ResourcesHandler.java @@ -68,8 +68,8 @@ import javax.activation.MimetypesFileTypeMap; -import org.apache.commons.logging.LogFactory; -import org.apache.commons.logging.Log; +import org.slf4j.LoggerFactory; +import org.slf4j.Logger; public class ResourcesHandler implements HandlesImportable { private static final String COPYRIGHT = "(c) 2007"; @@ -80,7 +80,7 @@ public class ResourcesHandler implements HandlesImportable { private SecurityService securityService; private ServerConfigurationService serverConfigurationService; - private Log m_log = LogFactory.getLog(org.sakaiproject.importer.impl.handlers.ResourcesHandler.class); + private Logger m_log = LoggerFactory.getLogger(org.sakaiproject.importer.impl.handlers.ResourcesHandler.class); public boolean canHandleType(String typeName) { return (("sakai-file-resource".equals(typeName) || ("sakai-folder".equals(typeName)) || diff --git a/common/import-parsers/blackboard_5-5/src/java/org/sakaiproject/importer/impl/translators/Bb55AnnouncementTranslator.java b/common/import-parsers/blackboard_5-5/src/java/org/sakaiproject/importer/impl/translators/Bb55AnnouncementTranslator.java index cc87117bee30..2b623cf2cbd7 100644 --- a/common/import-parsers/blackboard_5-5/src/java/org/sakaiproject/importer/impl/translators/Bb55AnnouncementTranslator.java +++ b/common/import-parsers/blackboard_5-5/src/java/org/sakaiproject/importer/impl/translators/Bb55AnnouncementTranslator.java @@ -5,8 +5,8 @@ import java.text.SimpleDateFormat; import java.util.Date; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.importer.api.Importable; import org.sakaiproject.importer.api.IMSResourceTranslator; import org.sakaiproject.importer.impl.Blackboard55FileParser; @@ -17,7 +17,7 @@ public class Bb55AnnouncementTranslator implements IMSResourceTranslator { - private static Log log = LogFactory.getLog(Bb55AnnouncementTranslator.class); + private static Logger log = LoggerFactory.getLogger(Bb55AnnouncementTranslator.class); public String getTypeName() { // TODO Auto-generated method stub diff --git a/common/import-parsers/blackboard_6/impl/src/java/org/sakaiproject/importer/impl/translators/Bb6AnnouncementTranslator.java b/common/import-parsers/blackboard_6/impl/src/java/org/sakaiproject/importer/impl/translators/Bb6AnnouncementTranslator.java index 313a1278f674..f9096f7dc6e8 100644 --- a/common/import-parsers/blackboard_6/impl/src/java/org/sakaiproject/importer/impl/translators/Bb6AnnouncementTranslator.java +++ b/common/import-parsers/blackboard_6/impl/src/java/org/sakaiproject/importer/impl/translators/Bb6AnnouncementTranslator.java @@ -19,8 +19,8 @@ import java.text.SimpleDateFormat; import java.util.Date; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.importer.impl.importables.Announcement; @@ -38,7 +38,7 @@ */ public class Bb6AnnouncementTranslator implements IMSResourceTranslator { - private static Log log = LogFactory.getLog(Bb6AnnouncementTranslator.class); + private static Logger log = LoggerFactory.getLogger(Bb6AnnouncementTranslator.class); public String getTypeName() { return "resource/x-bb-announcement"; diff --git a/common/import-parsers/common-cartridge/src/java/org/sakaiproject/importer/impl/CommonCartridgeFileParser.java b/common/import-parsers/common-cartridge/src/java/org/sakaiproject/importer/impl/CommonCartridgeFileParser.java index 585739c0504f..ac1a67881306 100644 --- a/common/import-parsers/common-cartridge/src/java/org/sakaiproject/importer/impl/CommonCartridgeFileParser.java +++ b/common/import-parsers/common-cartridge/src/java/org/sakaiproject/importer/impl/CommonCartridgeFileParser.java @@ -36,8 +36,8 @@ import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.archive.api.ImportMetadata; import org.sakaiproject.importer.api.ImportFileParser; import org.sakaiproject.importer.api.Importable; @@ -55,7 +55,7 @@ public class CommonCartridgeFileParser extends IMSFileParser { private static final String CC_NAMESPACE_URI = "http://www.imsglobal.org/xsd/imscc/imscp_v1p1"; /** Our logger. */ - private static Log M_log = LogFactory.getLog(CommonCartridgeFileParser.class); + private static Logger M_log = LoggerFactory.getLogger(CommonCartridgeFileParser.class); public CommonCartridgeFileParser() { // add resource translators here diff --git a/common/import-parsers/common-cartridge/src/java/org/sakaiproject/importer/impl/LBCommonCartridgeFileParser.java b/common/import-parsers/common-cartridge/src/java/org/sakaiproject/importer/impl/LBCommonCartridgeFileParser.java index 019241a27e0b..5e586ad8efa0 100644 --- a/common/import-parsers/common-cartridge/src/java/org/sakaiproject/importer/impl/LBCommonCartridgeFileParser.java +++ b/common/import-parsers/common-cartridge/src/java/org/sakaiproject/importer/impl/LBCommonCartridgeFileParser.java @@ -36,8 +36,8 @@ import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.archive.api.ImportMetadata; import org.sakaiproject.importer.api.ImportFileParser; import org.sakaiproject.importer.api.ImportDataSource; @@ -62,7 +62,7 @@ public class LBCommonCartridgeFileParser extends IMSFileParser { "http://www.imsglobal.org/xsd/imsccv1p3/imscp_v1p1"}; /** Our logger. */ - private static Log M_log = LogFactory.getLog(LBCommonCartridgeFileParser.class); + private static Logger M_log = LoggerFactory.getLogger(LBCommonCartridgeFileParser.class); public LBCommonCartridgeFileParser() { } diff --git a/common/privacy-comp-impl/src/java/org/sakaiproject/component/privacy/PrivacyManagerImpl.java b/common/privacy-comp-impl/src/java/org/sakaiproject/component/privacy/PrivacyManagerImpl.java index 723d57075e9f..92310ec8ac12 100644 --- a/common/privacy-comp-impl/src/java/org/sakaiproject/component/privacy/PrivacyManagerImpl.java +++ b/common/privacy-comp-impl/src/java/org/sakaiproject/component/privacy/PrivacyManagerImpl.java @@ -21,8 +21,8 @@ package org.sakaiproject.component.privacy; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.Hibernate; import org.hibernate.HibernateException; import org.hibernate.Query; @@ -53,7 +53,7 @@ public class PrivacyManagerImpl extends HibernateDaoSupport implements PrivacyManager, AuthzGroupAdvisor { - private static Log log = LogFactory.getLog(PrivacyManagerImpl.class); + private static Logger log = LoggerFactory.getLogger(PrivacyManagerImpl.class); private static final String QUERY_BY_USERID_CONTEXTID_TYPEID = "findPrivacyByUserIdContextIdType"; private static final String QUERY_BY_DISABLED_USERID_CONTEXTID = "findDisabledPrivacyUserIdContextIdType"; diff --git a/common/privacy-integration-test/src/test/org/sakaiproject/component/test/privacy/PrivacyTest.java b/common/privacy-integration-test/src/test/org/sakaiproject/component/test/privacy/PrivacyTest.java index d364c43e85ef..b968fd4007c1 100644 --- a/common/privacy-integration-test/src/test/org/sakaiproject/component/test/privacy/PrivacyTest.java +++ b/common/privacy-integration-test/src/test/org/sakaiproject/component/test/privacy/PrivacyTest.java @@ -26,15 +26,15 @@ import junit.framework.TestSuite; import java.util.*; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.privacy.PrivacyManager; import org.sakaiproject.test.SakaiTestBase; public class PrivacyTest extends SakaiTestBase { - private static Log log = LogFactory.getLog(PrivacyTest.class); + private static Logger log = LoggerFactory.getLogger(PrivacyTest.class); private PrivacyManager privacyManager; public static Test suite() diff --git a/content-review/impl/turnitin/src/main/java/org/sakaiproject/contentreview/turnitin/util/TurnitinAPIUtil.java b/content-review/impl/turnitin/src/main/java/org/sakaiproject/contentreview/turnitin/util/TurnitinAPIUtil.java index 9d49b05426e9..98db45a5984b 100644 --- a/content-review/impl/turnitin/src/main/java/org/sakaiproject/contentreview/turnitin/util/TurnitinAPIUtil.java +++ b/content-review/impl/turnitin/src/main/java/org/sakaiproject/contentreview/turnitin/util/TurnitinAPIUtil.java @@ -49,8 +49,8 @@ import javax.xml.parsers.ParserConfigurationException; import org.apache.commons.io.IOUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.azeckoski.reflectutils.transcoders.XMLTranscoder; import org.sakaiproject.content.api.ContentResource; import org.sakaiproject.contentreview.exception.SubmissionException; @@ -71,7 +71,7 @@ @CommonsLog public class TurnitinAPIUtil { - private static final Log apiTraceLog = LogFactory.getLog("org.sakaiproject.turnitin.util.TurnitinAPIUtil.apicalltrace"); + private static final Logger apiTraceLog = LoggerFactory.getLogger("org.sakaiproject.turnitin.util.TurnitinAPIUtil.apicalltrace"); private static String encodeSakaiTitles(String assignTitle) { String assignEnc = assignTitle; diff --git a/content/content-cleanup/content-cleanup-impl/src/java/org/sakaiproject/content/CleanupDeletedContent.java b/content/content-cleanup/content-cleanup-impl/src/java/org/sakaiproject/content/CleanupDeletedContent.java index 778aa7d7ad88..bf1e00a3e326 100644 --- a/content/content-cleanup/content-cleanup-impl/src/java/org/sakaiproject/content/CleanupDeletedContent.java +++ b/content/content-cleanup/content-cleanup-impl/src/java/org/sakaiproject/content/CleanupDeletedContent.java @@ -21,8 +21,8 @@ import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; @@ -48,8 +48,7 @@ */ public class CleanupDeletedContent implements Job { - private static final Log log = LogFactory - .getLog(CleanupDeletedContent.class); + private static final Logger log = LoggerFactory.getLogger(CleanupDeletedContent.class); private ContentHostingService chs; private ServerConfigurationService scs; @@ -117,19 +116,16 @@ public void execute(JobExecutionContext context) } } else { - if (log.isDebugEnabled()) { - log.debug("Resource " + resource.getId() + " is still too new, skipping."); - } + log.debug("Resource {} is still too new, skipping.", resource.getId()); } } else { - log.warn("No modified date set for file with id " + resource.getId() + ". Cannot process for deletion."); + log.warn("No modified date set for file with id {}. Cannot process for deletion.", resource.getId()); } } int failed = attempted - removed; - log.info("Out of " + deleted.size() + "(~"+ formatSize(totalSize)+ ") " - + "deleted resources, successfully removed " + removed + "(~"+ formatSize(removedSize)+ ")" - + ((failed > 0) ? ", failed on " + failed + " resources": "")); + log.info("Out of {}(~{}) deleted resources, successfully removed {}(~{}), failed resources: {}", + deleted.size(), formatSize(totalSize), removed, formatSize(removedSize), failed); } static String formatSize(long size) { diff --git a/content/content-copyright/impl/src/java/org/sakaiproject/content/copyright/CopyrightManager.java b/content/content-copyright/impl/src/java/org/sakaiproject/content/copyright/CopyrightManager.java index 01e1c4c6b873..7672e9a8e1b1 100644 --- a/content/content-copyright/impl/src/java/org/sakaiproject/content/copyright/CopyrightManager.java +++ b/content/content-copyright/impl/src/java/org/sakaiproject/content/copyright/CopyrightManager.java @@ -24,13 +24,13 @@ import java.util.Locale; import java.util.ResourceBundle; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ServerConfigurationService; public class CopyrightManager implements org.sakaiproject.content.copyright.api.CopyrightManager { - static final Log logger = LogFactory.getLog(CopyrightManager.class); + static final Logger logger = LoggerFactory.getLogger(CopyrightManager.class); protected boolean active = true; @@ -96,4 +96,4 @@ private boolean existsFile(String file,String baseURL) { return f.exists(); } -} \ No newline at end of file +} diff --git a/content/content-impl-providers/impl/src/java/org/sakaiproject/content/providers/BaseEventDelayHandler.java b/content/content-impl-providers/impl/src/java/org/sakaiproject/content/providers/BaseEventDelayHandler.java index a47521472dd1..c35d239c3965 100644 --- a/content/content-impl-providers/impl/src/java/org/sakaiproject/content/providers/BaseEventDelayHandler.java +++ b/content/content-impl-providers/impl/src/java/org/sakaiproject/content/providers/BaseEventDelayHandler.java @@ -6,8 +6,8 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.scheduler.DelayedInvocation; import org.sakaiproject.api.app.scheduler.ScheduledInvocationCommand; import org.sakaiproject.api.app.scheduler.ScheduledInvocationManager; @@ -28,7 +28,7 @@ public class BaseEventDelayHandler implements EventDelayHandler, ScheduledInvoca { private boolean autoDdl; - private static final Log LOG = LogFactory.getLog(BaseEventDelayHandler.class); + private static final Logger LOG = LoggerFactory.getLogger(BaseEventDelayHandler.class); private SqlService sqlService; private ScheduledInvocationManager schedInvocMgr; diff --git a/content/content-metadata/impl/src/java/org/sakaiproject/content/metadata/logic/MetadataServiceFromContent.java b/content/content-metadata/impl/src/java/org/sakaiproject/content/metadata/logic/MetadataServiceFromContent.java index 8945f1feaa31..b3d9eb440f06 100644 --- a/content/content-metadata/impl/src/java/org/sakaiproject/content/metadata/logic/MetadataServiceFromContent.java +++ b/content/content-metadata/impl/src/java/org/sakaiproject/content/metadata/logic/MetadataServiceFromContent.java @@ -26,8 +26,8 @@ import java.util.Collections; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.SecurityAdvisor; import org.sakaiproject.authz.api.SecurityService; import org.sakaiproject.content.api.ContentHostingService; @@ -45,7 +45,7 @@ public class MetadataServiceFromContent implements MetadataService { - private static Log logger = LogFactory.getLog(MetadataServiceFromContent.class); + private static Logger logger = LoggerFactory.getLogger(MetadataServiceFromContent.class); protected final ContentHostingService contentHostingService; protected final SecurityService securityService; diff --git a/content/content-metadata/impl/src/java/org/sakaiproject/content/metadata/model/ListMetadataType.java b/content/content-metadata/impl/src/java/org/sakaiproject/content/metadata/model/ListMetadataType.java index d6e24672bc58..99ad27d2d371 100644 --- a/content/content-metadata/impl/src/java/org/sakaiproject/content/metadata/model/ListMetadataType.java +++ b/content/content-metadata/impl/src/java/org/sakaiproject/content/metadata/model/ListMetadataType.java @@ -27,7 +27,7 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; +import org.slf4j.Logger; import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.type.TypeReference; import org.sakaiproject.content.metadata.model.MetadataConverter; diff --git a/content/content-tool/tool/src/java/org/sakaiproject/content/tool/AttachmentAction.java b/content/content-tool/tool/src/java/org/sakaiproject/content/tool/AttachmentAction.java index 4b11dada586b..687af47e5b49 100644 --- a/content/content-tool/tool/src/java/org/sakaiproject/content/tool/AttachmentAction.java +++ b/content/content-tool/tool/src/java/org/sakaiproject/content/tool/AttachmentAction.java @@ -26,8 +26,8 @@ import java.util.Vector; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.cheftool.Context; import org.sakaiproject.cheftool.JetspeedRunData; import org.sakaiproject.cheftool.RunData; @@ -64,7 +64,7 @@ public class AttachmentAction { /** Our logger. */ - private static Log M_log = LogFactory.getLog(AttachmentAction.class); + private static Logger M_log = LoggerFactory.getLogger(AttachmentAction.class); /** Resource bundle using current language locale */ private static ResourceLoader rb = new ResourceLoader("helper"); diff --git a/content/content-tool/tool/src/java/org/sakaiproject/content/tool/FilePickerAction.java b/content/content-tool/tool/src/java/org/sakaiproject/content/tool/FilePickerAction.java index 484e5ae2c9a5..49606ab253c4 100755 --- a/content/content-tool/tool/src/java/org/sakaiproject/content/tool/FilePickerAction.java +++ b/content/content-tool/tool/src/java/org/sakaiproject/content/tool/FilePickerAction.java @@ -48,8 +48,8 @@ import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletRequestWrapper; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.myfaces.webapp.filter.MultipartRequestWrapper; @@ -144,7 +144,7 @@ public class FilePickerAction extends PagedResourceHelperAction private String resourceBundle = ServerConfigurationService.getString(RESOURCEBUNDLE, DEFAULT_RESOURCEBUNDLE); private ResourceLoader srb = new Resource().getLoader(resourceClass, resourceBundle); - private static final Log logger = LogFactory.getLog(FilePickerAction.class); + private static final Logger logger = LoggerFactory.getLogger(FilePickerAction.class); protected static final String PREFIX = "filepicker."; diff --git a/content/content-tool/tool/src/java/org/sakaiproject/content/tool/ListItem.java b/content/content-tool/tool/src/java/org/sakaiproject/content/tool/ListItem.java index d110842db1f7..87b7e924d656 100644 --- a/content/content-tool/tool/src/java/org/sakaiproject/content/tool/ListItem.java +++ b/content/content-tool/tool/src/java/org/sakaiproject/content/tool/ListItem.java @@ -42,8 +42,8 @@ import java.util.TreeSet; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.antivirus.api.VirusFoundException; import org.sakaiproject.authz.api.AuthzGroupService; import org.sakaiproject.authz.cover.SecurityService; @@ -115,7 +115,7 @@ public class ListItem /** Resource bundle using current language locale */ private static ResourceLoader trb = new ResourceLoader("types"); - private static final Log logger = LogFactory.getLog(ListItem.class); + private static final Logger logger = LoggerFactory.getLogger(ListItem.class); protected static final Comparator DEFAULT_COMPARATOR = ContentHostingService.newContentHostingComparator(ResourceProperties.PROP_DISPLAY_NAME, true); diff --git a/content/content-tool/tool/src/java/org/sakaiproject/content/tool/ResourceConditionsHelper.java b/content/content-tool/tool/src/java/org/sakaiproject/content/tool/ResourceConditionsHelper.java index 9263f0590dd7..0845b485b8f6 100644 --- a/content/content-tool/tool/src/java/org/sakaiproject/content/tool/ResourceConditionsHelper.java +++ b/content/content-tool/tool/src/java/org/sakaiproject/content/tool/ResourceConditionsHelper.java @@ -25,8 +25,8 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.cheftool.Context; import org.sakaiproject.cheftool.VelocityPortletPaneledAction; import org.sakaiproject.component.cover.ComponentManager; @@ -54,7 +54,7 @@ public class ResourceConditionsHelper { */ private static final long serialVersionUID = -3875833398687224551L; - static final Log logger = LogFactory.getLog(ResourceConditionsHelper.class); + static final Logger logger = LoggerFactory.getLogger(ResourceConditionsHelper.class); static final ConditionService conditionService = (ConditionService)ComponentManager.get("org.sakaiproject.conditions.api.ConditionService"); @@ -264,4 +264,4 @@ static void notifyCondition(Entity entity) { } -} \ No newline at end of file +} diff --git a/content/content-tool/tool/src/java/org/sakaiproject/content/tool/ResourcesAction.java b/content/content-tool/tool/src/java/org/sakaiproject/content/tool/ResourcesAction.java index ec131c94d578..fa0aa3cb08f6 100644 --- a/content/content-tool/tool/src/java/org/sakaiproject/content/tool/ResourcesAction.java +++ b/content/content-tool/tool/src/java/org/sakaiproject/content/tool/ResourcesAction.java @@ -53,8 +53,8 @@ import java.util.regex.Pattern; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.alias.api.AliasEdit; import org.sakaiproject.alias.api.AliasService; import org.sakaiproject.antivirus.api.VirusFoundException; @@ -424,7 +424,7 @@ public void setParent(String parent) private String resourceBundle = ServerConfigurationService.getString(RESOURCEBUNDLE, DEFAULT_RESOURCEBUNDLE); private ResourceLoader srb = new Resource().getLoader(resourceClass, resourceBundle); - static final Log logger = LogFactory.getLog(ResourcesAction.class); + static final Logger logger = LoggerFactory.getLogger(ResourcesAction.class); static final ResourceConditionsHelper conditionsHelper = new ResourceConditionsHelper(); @@ -7711,7 +7711,7 @@ public void doRestore( RunData data) } catch (Exception e) { String[] args = { e.getClass().getName(), selectedItem, e.getMessage()}; addAlert(state, trb.getFormattedMessage("action.exception", args)); - logger.fatal("Unable to restore recourse with ID " + selectedItem ,e); + logger.error("Unable to restore recourse with ID {}", selectedItem, e); } } } @@ -7724,7 +7724,7 @@ else if ("remove".equalsIgnoreCase(flow)) } catch (Exception ex) { String[] args = {ex.getClass().getName(),selectedItem, ex.getMessage() }; addAlert(state, trb.getFormattedMessage("action.exception", args)); - logger.fatal("Unable to permanently remove recourse with ID " + selectedItem ,ex); + logger.error("Unable to permanently remove recourse with ID {}", selectedItem, ex); } } } diff --git a/content/content-tool/tool/src/java/org/sakaiproject/content/tool/ResourcesHelperAction.java b/content/content-tool/tool/src/java/org/sakaiproject/content/tool/ResourcesHelperAction.java index 18239b58132c..79c464afe311 100644 --- a/content/content-tool/tool/src/java/org/sakaiproject/content/tool/ResourcesHelperAction.java +++ b/content/content-tool/tool/src/java/org/sakaiproject/content/tool/ResourcesHelperAction.java @@ -48,8 +48,8 @@ import org.apache.commons.fileupload.disk.DiskFileItem; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.cheftool.Context; import org.sakaiproject.cheftool.JetspeedRunData; import org.sakaiproject.cheftool.RunData; @@ -92,7 +92,7 @@ public class ResourcesHelperAction extends VelocityPortletPaneledAction { /** the logger for this class */ - private static final Log logger = LogFactory.getLog(ResourcesHelperAction.class); + private static final Logger logger = LoggerFactory.getLogger(ResourcesHelperAction.class); private static final ResourceConditionsHelper conditionsHelper = new ResourceConditionsHelper(); diff --git a/content/content-tool/tool/src/java/org/sakaiproject/content/tool/ResourcesMetadata.java b/content/content-tool/tool/src/java/org/sakaiproject/content/tool/ResourcesMetadata.java index c37479a606f9..22f44447ac88 100644 --- a/content/content-tool/tool/src/java/org/sakaiproject/content/tool/ResourcesMetadata.java +++ b/content/content-tool/tool/src/java/org/sakaiproject/content/tool/ResourcesMetadata.java @@ -30,8 +30,8 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.regex.Pattern; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.content.api.ContentHostingHandlerResolver; import org.sakaiproject.util.ResourceLoader; import org.sakaiproject.util.Validator; @@ -44,7 +44,7 @@ public class ResourcesMetadata /** Resource bundle using current language locale */ private ResourceLoader rb = new ResourceLoader("content"); - static final Log logger = LogFactory.getLog(ResourcesMetadata.class); + static final Logger logger = LoggerFactory.getLogger(ResourcesMetadata.class); public static final String WIDGET_STRING = "string"; public static final String WIDGET_TEXTAREA = "textarea"; diff --git a/content/content-tool/tool/src/java/org/sakaiproject/content/tool/SiteEmailNotificationDragAndDrop.java b/content/content-tool/tool/src/java/org/sakaiproject/content/tool/SiteEmailNotificationDragAndDrop.java index 15d39abbba3c..ea784d7364bc 100644 --- a/content/content-tool/tool/src/java/org/sakaiproject/content/tool/SiteEmailNotificationDragAndDrop.java +++ b/content/content-tool/tool/src/java/org/sakaiproject/content/tool/SiteEmailNotificationDragAndDrop.java @@ -34,14 +34,14 @@ import org.sakaiproject.exception.IdUnusedException; import org.sakaiproject.exception.PermissionException; import org.sakaiproject.exception.TypeException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; //import org.sakaiproject.content.cover.ComponentManager; public class SiteEmailNotificationDragAndDrop extends SiteEmailNotification { - static final Log logger = LogFactory.getLog(SiteEmailNotificationDragAndDrop.class); + static final Logger logger = LoggerFactory.getLogger(SiteEmailNotificationDragAndDrop.class); /* property bundles */ private static final String DEFAULT_RESOURCECLASS = "org.sakaiproject.localization.util.SiteemaconProperties"; diff --git a/content/content-types/src/java/org/sakaiproject/content/types/ContentTypeRegistryBean.java b/content/content-types/src/java/org/sakaiproject/content/types/ContentTypeRegistryBean.java index 07d941a3c91c..a6430679587d 100644 --- a/content/content-types/src/java/org/sakaiproject/content/types/ContentTypeRegistryBean.java +++ b/content/content-types/src/java/org/sakaiproject/content/types/ContentTypeRegistryBean.java @@ -1,12 +1,12 @@ package org.sakaiproject.content.types; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.content.api.ResourceTypeRegistry; public class ContentTypeRegistryBean { - private static Log log = LogFactory.getLog(ContentTypeRegistryBean.class); + private static Logger log = LoggerFactory.getLogger(ContentTypeRegistryBean.class); private boolean useContentTypeRegistry; private ResourceTypeRegistry resourceTypeRegistry; diff --git a/content/content-types/src/java/org/sakaiproject/content/types/FileUploadType.java b/content/content-types/src/java/org/sakaiproject/content/types/FileUploadType.java index 2dc6fd532ca1..306f5705b4dc 100644 --- a/content/content-types/src/java/org/sakaiproject/content/types/FileUploadType.java +++ b/content/content-types/src/java/org/sakaiproject/content/types/FileUploadType.java @@ -55,15 +55,15 @@ import org.sakaiproject.util.Resource; import org.sakaiproject.util.ResourceLoader; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class FileUploadType extends BaseResourceType { protected String typeId = ResourceType.TYPE_UPLOAD; protected String helperId = "sakai.resource.type.helper"; - private static final Log LOG = LogFactory.getLog(FileUploadType.class); + private static final Logger LOG = LoggerFactory.getLogger(FileUploadType.class); /** localized tool properties **/ diff --git a/courier/courier-impl/impl/src/java/org/sakaiproject/courier/impl/BasicCourierService.java b/courier/courier-impl/impl/src/java/org/sakaiproject/courier/impl/BasicCourierService.java index 32a5bc408c3d..a2395cd87f62 100644 --- a/courier/courier-impl/impl/src/java/org/sakaiproject/courier/impl/BasicCourierService.java +++ b/courier/courier-impl/impl/src/java/org/sakaiproject/courier/impl/BasicCourierService.java @@ -31,8 +31,8 @@ import java.util.Vector; import java.util.concurrent.ConcurrentHashMap; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.courier.api.CourierService; @@ -55,7 +55,7 @@ public class BasicCourierService implements CourierService { /** Our logger. */ - private static final Log M_log = LogFactory.getLog(BasicCourierService.class); + private static final Logger M_log = LoggerFactory.getLogger(BasicCourierService.class); protected static final int nLocks = 100; diff --git a/courier/courier-tool/tool/src/java/org/sakaiproject/courier/tool/CourierTool.java b/courier/courier-tool/tool/src/java/org/sakaiproject/courier/tool/CourierTool.java index 28385d60e37d..117d470d8ff6 100644 --- a/courier/courier-tool/tool/src/java/org/sakaiproject/courier/tool/CourierTool.java +++ b/courier/courier-tool/tool/src/java/org/sakaiproject/courier/tool/CourierTool.java @@ -34,8 +34,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.courier.api.Delivery; @@ -54,7 +54,7 @@ public class CourierTool extends HttpServlet { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(CourierTool.class); + private static Logger M_log = LoggerFactory.getLogger(CourierTool.class); private SessionManager sessionManager = (SessionManager) ComponentManager.get(SessionManager.class); diff --git a/dashboard/impl/src/java/org/sakaiproject/dash/dao/DashHibernateDao.java b/dashboard/impl/src/java/org/sakaiproject/dash/dao/DashHibernateDao.java index 2e562abf95b7..fe64e5319725 100644 --- a/dashboard/impl/src/java/org/sakaiproject/dash/dao/DashHibernateDao.java +++ b/dashboard/impl/src/java/org/sakaiproject/dash/dao/DashHibernateDao.java @@ -5,8 +5,8 @@ import org.springframework.orm.hibernate3.HibernateCallback; import org.springframework.orm.hibernate3.support.HibernateDaoSupport; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.Criteria; import org.hibernate.HibernateException; @@ -37,7 +37,7 @@ public class DashHibernateDao extends HibernateDaoSupport { - private Log LOG = LogFactory.getLog(DashHibernateDao.class); + private Logger LOG = LoggerFactory.getLogger(DashHibernateDao.class); diff --git a/dashboard/impl/src/java/org/sakaiproject/dash/dao/mapper/CalendarItemMapper.java b/dashboard/impl/src/java/org/sakaiproject/dash/dao/mapper/CalendarItemMapper.java index a3f3b6629861..1a9629ae2c9c 100644 --- a/dashboard/impl/src/java/org/sakaiproject/dash/dao/mapper/CalendarItemMapper.java +++ b/dashboard/impl/src/java/org/sakaiproject/dash/dao/mapper/CalendarItemMapper.java @@ -24,8 +24,8 @@ import java.sql.ResultSet; import java.sql.SQLException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.dash.model.CalendarItem; import org.sakaiproject.dash.model.Context; import org.sakaiproject.dash.model.RepeatingCalendarItem; @@ -38,7 +38,7 @@ */ public class CalendarItemMapper implements RowMapper { - private static Log logger = LogFactory.getLog(CalendarItemMapper.class); + private static Logger logger = LoggerFactory.getLogger(CalendarItemMapper.class); /* (non-Javadoc) * @see org.springframework.jdbc.core.RowMapper#mapRow(java.sql.ResultSet, int) diff --git a/dashboard/impl/src/java/org/sakaiproject/dash/entity/AnnouncementSupport.java b/dashboard/impl/src/java/org/sakaiproject/dash/entity/AnnouncementSupport.java index 906e0c5738b3..906068fbc78f 100644 --- a/dashboard/impl/src/java/org/sakaiproject/dash/entity/AnnouncementSupport.java +++ b/dashboard/impl/src/java/org/sakaiproject/dash/entity/AnnouncementSupport.java @@ -30,8 +30,8 @@ import java.util.SortedSet; import java.util.TreeSet; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.announcement.api.AnnouncementChannel; import org.sakaiproject.announcement.api.AnnouncementMessage; import org.sakaiproject.announcement.api.AnnouncementMessageHeader; @@ -68,7 +68,7 @@ */ public class AnnouncementSupport{ - private Log logger = LogFactory.getLog(AnnouncementSupport.class); + private Logger logger = LoggerFactory.getLogger(AnnouncementSupport.class); private String ANNOUNCEMENT_TOOL_ID ="sakai.announcements"; @@ -501,14 +501,10 @@ public String getEventIdentifer() { */ public void processEvent(Event event) { - if(logger.isDebugEnabled()) { - logger.debug("\n\n\n=============================================================\n" + event - + "\n=============================================================\n\n\n"); - } - if(logger.isDebugEnabled()) { - logger.debug("Announcement new: create news links and news item for " + event.getResource()); - } - + logger.debug("\n\n\n============================================================\n{}\n=============================================================\n\n\n", + event.toString()); + logger.debug("Announcement new: create news links and news item for {}", event.getResource()); + String eventId = event.getEvent(); Entity entity = sakaiProxy.getEntity(event.getResource()); @@ -517,12 +513,7 @@ public void processEvent(Event event) { createUpdateDashboardItemLinks(event, annc); } else { - // for now, let's log the error - StringBuilder buf = new StringBuilder(); - buf.append(eventId); - buf.append(" is not processed for entityReference "); - buf.append(event.getResource()); - logger.info(buf); + logger.info("{} is not processed for entityReference {}", eventId, event.getResource()); } } } @@ -545,19 +536,12 @@ public String getEventIdentifer() { * @see org.sakaiproject.dash.listener.EventProcessor#processEvent(org.sakaiproject.event.api.Event) */ public void processEvent(Event event) { - - if(logger.isDebugEnabled()) { - logger.debug("\n\n\n=============================================================\n" + event - + "\n=============================================================\n\n\n"); - } - if(logger.isDebugEnabled()) { - logger.debug("Announcement remove any: removing news links and news item for " + event.getResource()); - } + logger.debug("\n\n\n============================================================\n{}\n=============================================================\n\n\n", + event.toString()); + logger.debug("Announcement remove any: removing news links and news item for {}", event.getResource()); dashboardLogic.removeNewsItem(event.getResource()); - if(logger.isDebugEnabled()) { - logger.debug("Announcement remove any: removing calendar links and news item for " + event.getResource()); - } + logger.debug("Announcement remove any: removing calendar links and news item for {}", event.getResource()); dashboardLogic.removeCalendarItems(event.getResource()); } } @@ -579,19 +563,12 @@ public String getEventIdentifer() { * @see org.sakaiproject.dash.listener.EventProcessor#processEvent(org.sakaiproject.event.api.Event) */ public void processEvent(Event event) { - - if(logger.isDebugEnabled()) { - logger.debug("\n\n\n=============================================================\n" + event - + "\n=============================================================\n\n\n"); - } - if(logger.isDebugEnabled()) { - logger.debug("Announcement remove own: removing news links and news item for " + event.getResource()); - } + logger.debug("\n\n\n============================================================\n{}\n=============================================================\n\n\n", + event.toString()); + logger.debug("Announcement remove own: removing news links and news item for {}", event.getResource()); dashboardLogic.removeNewsItem(event.getResource()); - if(logger.isDebugEnabled()) { - logger.debug("Announcement remove own: removing calendar links and news item for " + event.getResource()); - } + logger.debug("Announcement remove own: removing calendar links and news item for {}", event.getResource()); dashboardLogic.removeCalendarItems(event.getResource()); } } @@ -613,14 +590,9 @@ public String getEventIdentifer() { * @see org.sakaiproject.dash.listener.EventProcessor#processEvent(org.sakaiproject.event.api.Event) */ public void processEvent(Event event) { - - if(logger.isDebugEnabled()) { - logger.debug("\n\n\n=============================================================\n" + event - + "\n=============================================================\n\n\n"); - } - if(logger.isDebugEnabled()) { - logger.debug("removing calendar links and calendar item for " + event.getResource()); - } + logger.debug("\n\n\n============================================================\n{}\n=============================================================\n\n\n", + event.toString()); + logger.debug("removing calendar links and calendar item for {}", event.getResource()); // clean the threadlocal cache m_threadLocalManager.set(event.getResource(), null); Entity entity = sakaiProxy.getEntity(event.getResource()); @@ -644,10 +616,7 @@ public void processEvent(Event event) { dashboardLogic.reviseCalendarItemsTitle(annc.getReference(), title); } - if(logger.isDebugEnabled()) { - logger.debug("Announcement update title: update news links and news item for " + event.getResource()); - } - + logger.debug("Announcement update title: update news links and news item for {}", event.getResource()); } } @@ -669,14 +638,9 @@ public String getEventIdentifer() { * @see org.sakaiproject.dash.listener.EventProcessor#processEvent(org.sakaiproject.event.api.Event) */ public void processEvent(Event event) { - - if(logger.isDebugEnabled()) { - logger.debug("\n\n\n=============================================================\n" + event - + "\n=============================================================\n\n\n"); - } - if(logger.isDebugEnabled()) { - logger.debug("removing calendar links and calendar item for " + event.getResource()); - } + logger.debug("\n\n\n============================================================\n{}\n=============================================================\n\n\n", + event.toString()); + logger.debug("removing calendar links and calendar item for {}", event.getResource()); // clean the threadlocal cache m_threadLocalManager.set(event.getResource(), null); Entity entity = sakaiProxy.getEntity(event.getResource()); @@ -691,12 +655,8 @@ public void processEvent(Event event) { dashboardLogic.updateCalendarLinks(anncReference); } - if(logger.isDebugEnabled()) { - logger.debug("removing news links and news item for " + event.getResource()); - } - + logger.debug("removing news links and news item for {}", event.getResource()); } - } /** @@ -716,16 +676,10 @@ public String getEventIdentifer() { * @see org.sakaiproject.dash.listener.EventProcessor#processEvent(org.sakaiproject.event.api.Event) */ public void processEvent(Event event) { + logger.debug("\n\n\n============================================================\n{}\n=============================================================\n\n\n", + event.toString()); + logger.debug("removing calendar links and calendar item for {}", event.getResource()); - if(logger.isDebugEnabled()) { - logger.debug("\n\n\n=============================================================\n" + event - + "\n=============================================================\n\n\n"); - } - - if(logger.isDebugEnabled()) { - logger.debug("removing calendar links and calendar item for " + event.getResource()); - } - String entityReference = event.getResource(); m_threadLocalManager.set(entityReference, null); Entity entity = sakaiProxy.getEntity(entityReference); @@ -740,10 +694,7 @@ public void processEvent(Event event) { createUpdateDashboardItemLinks(event, annc); } } - - if(logger.isDebugEnabled()) { - logger.debug("Announcement update availability: update news links and news item for " + entityReference); - } + logger.debug("Announcement update availability: update news links and news item for {}", entityReference); } } @@ -764,15 +715,10 @@ public String getEventIdentifer() { * @see org.sakaiproject.dash.listener.EventProcessor#processEvent(org.sakaiproject.event.api.Event) */ public void processEvent(Event event) { - - if(logger.isDebugEnabled()) { - logger.debug("\n\n\n=============================================================\n" + event - + "\n=============================================================\n\n\n"); - } - if(logger.isDebugEnabled()) { - logger.debug("Announcement update own:" + event.getResource()); - } - + logger.debug("\n\n\n============================================================\n{}\n=============================================================\n\n\n", + event.toString()); + logger.debug("Announcement update own: {}", event.getResource()); + // update NewsItem Title and title EntitySupportUtil.updateNewsItemTimeTitle(event); } @@ -795,11 +741,8 @@ public String getEventIdentifer() { * @see org.sakaiproject.dash.listener.EventProcessor#processEvent(org.sakaiproject.event.api.Event) */ public void processEvent(Event event) { - - if(logger.isDebugEnabled()) { - logger.debug("Announcement update any:" + event.getResource()); - } - + logger.debug("Announcement update any: {}", event.getResource()); + // update NewsItem Title and title EntitySupportUtil.updateNewsItemTimeTitle(event); } diff --git a/dashboard/impl/src/java/org/sakaiproject/dash/entity/EntitySupportUtil.java b/dashboard/impl/src/java/org/sakaiproject/dash/entity/EntitySupportUtil.java index 8770dc68d4bb..015bf5bb2774 100644 --- a/dashboard/impl/src/java/org/sakaiproject/dash/entity/EntitySupportUtil.java +++ b/dashboard/impl/src/java/org/sakaiproject/dash/entity/EntitySupportUtil.java @@ -23,8 +23,8 @@ import java.util.Date; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.dash.logic.DashboardLogic; import org.sakaiproject.dash.model.NewsItem; import org.sakaiproject.event.api.Event; @@ -36,7 +36,7 @@ */ public class EntitySupportUtil{ - private Log logger = LogFactory.getLog(EntitySupportUtil.class); + private Logger logger = LoggerFactory.getLogger(EntitySupportUtil.class); static ResourceLoader rl = new ResourceLoader("dash_entity"); diff --git a/dashboard/impl/src/java/org/sakaiproject/dash/entity/ResourceSupport.java b/dashboard/impl/src/java/org/sakaiproject/dash/entity/ResourceSupport.java index c4cdf5ac9865..8f2564ec023c 100644 --- a/dashboard/impl/src/java/org/sakaiproject/dash/entity/ResourceSupport.java +++ b/dashboard/impl/src/java/org/sakaiproject/dash/entity/ResourceSupport.java @@ -32,8 +32,8 @@ import java.util.SortedSet; import java.util.TreeSet; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.content.api.ContentCollection; import org.sakaiproject.content.api.ContentHostingService; import org.sakaiproject.content.api.ContentResource; @@ -63,7 +63,7 @@ public class ResourceSupport { - private static Log logger = LogFactory.getLog(ResourceEntityType.class); + private static Logger logger = LoggerFactory.getLogger(ResourceEntityType.class); ResourceLoader rl = new ResourceLoader("dash_entity"); diff --git a/dashboard/impl/src/java/org/sakaiproject/dash/entity/ScheduleSupport.java b/dashboard/impl/src/java/org/sakaiproject/dash/entity/ScheduleSupport.java index 4c8b020fd248..e488b9318ccc 100644 --- a/dashboard/impl/src/java/org/sakaiproject/dash/entity/ScheduleSupport.java +++ b/dashboard/impl/src/java/org/sakaiproject/dash/entity/ScheduleSupport.java @@ -34,8 +34,8 @@ import java.util.TimeZone; import java.util.TreeSet; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.announcement.api.AnnouncementMessage; import org.sakaiproject.calendar.api.Calendar; import org.sakaiproject.calendar.api.CalendarEvent; @@ -71,7 +71,7 @@ */ public class ScheduleSupport{ - private Log logger = LogFactory.getLog(ScheduleSupport.class); + private Logger logger = LoggerFactory.getLogger(ScheduleSupport.class); ResourceLoader rl = new ResourceLoader("dash_entity"); @@ -445,7 +445,7 @@ public List getUsersWithAccess(String entityReference) { */ public class ScheduleNewEventProcessor implements EventProcessor { - private Log logger = LogFactory.getLog(ScheduleNewEventProcessor.class); + private Logger logger = LoggerFactory.getLogger(ScheduleNewEventProcessor.class); /* (non-Javadoc) * @see org.sakaiproject.dash.listener.EventProcessor#getEventIdentifer() @@ -459,18 +459,13 @@ public String getEventIdentifer() { * @see org.sakaiproject.dash.listener.EventProcessor#processEvent(org.sakaiproject.event.api.Event) */ public void processEvent(Event event) { - - if(logger.isDebugEnabled()) { - logger.debug("\n\n\n=============================================================\n" + event - + "\n=============================================================\n\n\n"); - } - if(logger.isDebugEnabled()) { - logger.debug("removing links and item for " + event.getResource()); - } + logger.debug("\n\n\n============================================================\n{}\n=============================================================\n\n\n", + event.toString()); + logger.debug("removing links and item for {}", event.getResource()); + String eventId = event.getEvent(); - String eventContextString = event.getContext(); - + Entity entity = sakaiProxy.getEntity(event.getResource()); // handle add events if(entity != null && entity instanceof CalendarEvent) { @@ -537,7 +532,7 @@ public void processEvent(Event event) { RepeatingCalendarItem repeatingCalendarItem = dashboardLogic.createRepeatingCalendarItem(cEvent.getDisplayName(), new Date(cEvent.getRange().firstTime().getTime()), lastDate, key, cEventReference, context, sourceType, frequency, maxCount); - logger.debug(repeatingCalendarItem); + logger.debug(repeatingCalendarItem.toString()); } } } @@ -545,7 +540,7 @@ public void processEvent(Event event) { } else { // for now, let's log the error. // this event is posted for creation of a calendar as well as for creation of calendar events, so this is not necessarily an error. - logger.debug(eventId + " is not processed for entityReference " + event.getResource()); + logger.debug("{} is not processed for entityReference {}", eventId, event.getResource()); } } @@ -556,7 +551,7 @@ public void processEvent(Event event) { */ public class ScheduleRemoveEventProcessor implements EventProcessor { - private Log logger = LogFactory.getLog(ScheduleRemoveEventProcessor.class); + private Logger logger = LoggerFactory.getLogger(ScheduleRemoveEventProcessor.class); /* (non-Javadoc) * @see org.sakaiproject.dash.listener.EventProcessor#getEventIdentifer() @@ -570,17 +565,10 @@ public String getEventIdentifer() { * @see org.sakaiproject.dash.listener.EventProcessor#processEvent(org.sakaiproject.event.api.Event) */ public void processEvent(Event event) { - - if(logger.isDebugEnabled()) { - logger.debug("\n\n\n=============================================================\n" + event - + "\n=============================================================\n\n\n"); - } - if(logger.isDebugEnabled()) { - logger.debug("removing news links and news item for " + event.getResource()); - } - if(logger.isDebugEnabled()) { - logger.debug("removing calendar links and news item for " + event.getResource()); - } + logger.debug("\n\n\n============================================================\n{}\n=============================================================\n\n\n", + event.toString()); + logger.debug("removing news links and news item for {}", event.getResource()); + logger.debug("removing calendar links and news item for {}", event.getResource()); // remove all links and CalendarItem itself dashboardLogic.removeCalendarItems(event.getResource()); } @@ -592,7 +580,7 @@ public void processEvent(Event event) { */ public class ScheduleUpdateTitleEventProcessor implements EventProcessor { - private Log logger = LogFactory.getLog(ScheduleUpdateTitleEventProcessor.class); + private Logger logger = LoggerFactory.getLogger(ScheduleUpdateTitleEventProcessor.class); /* (non-Javadoc) * @see org.sakaiproject.dash.listener.EventProcessor#getEventIdentifer() @@ -606,14 +594,9 @@ public String getEventIdentifer() { * @see org.sakaiproject.dash.listener.EventProcessor#processEvent(org.sakaiproject.event.api.Event) */ public void processEvent(Event event) { - - if(logger.isDebugEnabled()) { - logger.debug("\n\n\n=============================================================\n" + event - + "\n=============================================================\n\n\n"); - } - if(logger.isDebugEnabled()) { - logger.debug("updating title of calendar item for " + event.getResource()); - } + logger.debug("\n\n\n============================================================\n{}\n=============================================================\n\n\n", + event.toString()); + logger.debug("updating title of calendar item for {}", event.getResource()); Entity entity = sakaiProxy.getEntity(event.getResource()); if(entity != null && entity instanceof CalendarEvent) { @@ -663,7 +646,7 @@ public void processEvent(Event event) { */ public class ScheduleUpdateTimeEventProcessor implements EventProcessor { - private Log logger = LogFactory.getLog(ScheduleUpdateTimeEventProcessor.class); + private Logger logger = LoggerFactory.getLogger(ScheduleUpdateTimeEventProcessor.class); /* (non-Javadoc) * @see org.sakaiproject.dash.listener.EventProcessor#getEventIdentifer() @@ -677,15 +660,10 @@ public String getEventIdentifer() { * @see org.sakaiproject.dash.listener.EventProcessor#processEvent(org.sakaiproject.event.api.Event) */ public void processEvent(Event event) { - - if(logger.isDebugEnabled()) { - logger.debug("\n\n\n=============================================================\n" + event - + "\n=============================================================\n\n\n"); - } - if(logger.isDebugEnabled()) { - logger.debug("updating time of calendar item for " + event.getResource()); - } - + logger.debug("\n\n\n============================================================\n{}\n=============================================================\n\n\n", + event.toString()); + logger.debug("updating time of calendar item for {}", event.getResource()); + String entityReference = event.getResource(); Entity entity = sakaiProxy.getEntity(entityReference ); @@ -731,7 +709,7 @@ public void processEvent(Event event) { } if(logger.isDebugEnabled()) { - logger.debug("removing news links and news item for " + event.getResource()); + logger.debug("removing news links and news item for {}", event.getResource()); } } @@ -742,7 +720,7 @@ public void processEvent(Event event) { */ public class ScheduleUpdateTypeEventProcessor implements EventProcessor { - private Log logger = LogFactory.getLog(ScheduleUpdateTypeEventProcessor.class); + private Logger logger = LoggerFactory.getLogger(ScheduleUpdateTypeEventProcessor.class); /* (non-Javadoc) * @see org.sakaiproject.dash.listener.EventProcessor#getEventIdentifer() @@ -756,15 +734,10 @@ public String getEventIdentifer() { * @see org.sakaiproject.dash.listener.EventProcessor#processEvent(org.sakaiproject.event.api.Event) */ public void processEvent(Event event) { - - if(logger.isDebugEnabled()) { - logger.debug("\n\n\n=============================================================\n" + event - + "\n=============================================================\n\n\n"); - } - if(logger.isDebugEnabled()) { - logger.debug("updating type of calendar item for " + event.getResource()); - } - + logger.debug("\n\n\n============================================================\n{}\n=============================================================\n\n\n", + event.toString()); + logger.debug("updating type of calendar item for {}", event.getResource()); + String[] parts = event.getResource().split("::"); if(parts.length > 2) { String entityReference = parts[0]; @@ -780,9 +753,7 @@ public void processEvent(Event event) { // get the assignment entity and its new time CalendarEvent cEvent = (CalendarEvent) entity; - if(logger.isDebugEnabled()) { - logger.debug("removing news links and news item for " + entityReference); - } + logger.debug("removing news links and news item for {}", entityReference); if(cEvent.getRecurrenceRule() != null) { // update the label key for the repeating calendar item dashboardLogic.reviseRepeatingCalendarItemsLabelKey(entityReference, oldLabelKey, newLabelKey); @@ -804,28 +775,22 @@ public void processEvent(Event event) { public class ScheduleReviseEventProcessor implements EventProcessor { - private Log logger = LogFactory.getLog(ScheduleReviseEventProcessor.class); + private Logger logger = LoggerFactory.getLogger(ScheduleReviseEventProcessor.class); public String getEventIdentifer() { return SakaiProxy.EVENT_SCHEDULE_REVISE_EVENT; } public void processEvent(Event event) { - if(logger.isDebugEnabled()) { - logger.debug("\n\n\n=============================================================\n" + event - + "\n=============================================================\n\n\n"); - } - if(logger.isDebugEnabled()) { - logger.debug("revising calendar item for " + event.getResource()); - } - + logger.debug("\n\n\n============================================================\n{}\n=============================================================\n\n\n", + event.toString()); + logger.debug("revising calendar item for {}", event.getResource()); } - } public class ScheduleUpdateAccessEventProcessor implements EventProcessor { - private Log logger = LogFactory.getLog(ScheduleUpdateAccessEventProcessor.class); + private Logger logger = LoggerFactory.getLogger(ScheduleUpdateAccessEventProcessor.class); public String getEventIdentifer() { @@ -833,14 +798,10 @@ public String getEventIdentifer() { } public void processEvent(Event event) { - if(logger.isDebugEnabled()) { - logger.debug("\n\n\n=============================================================\n" + event - + "\n=============================================================\n\n\n"); - } - if(logger.isDebugEnabled()) { - logger.debug("revising calendar item for " + event.getResource()); - } - + logger.debug("\n\n\n============================================================\n{}\n=============================================================\n\n\n", + event.toString()); + logger.debug("revising calendar item for {}", event.getResource()); + Entity entity = sakaiProxy.getEntity(event.getResource()); if(entity != null && entity instanceof AnnouncementMessage) { @@ -853,18 +814,13 @@ public void processEvent(Event event) { dashboardLogic.updateCalendarLinks(cReference); } - if(logger.isDebugEnabled()) { - logger.debug("removing news links and news item for " + event.getResource()); - } - - + logger.debug("removing news links and news item for {}", event.getResource()); } - } public class ScheduleUpdateFrequencyEventProcessor implements EventProcessor { - private Log logger = LogFactory.getLog(ScheduleUpdateFrequencyEventProcessor.class); + private Logger logger = LoggerFactory.getLogger(ScheduleUpdateFrequencyEventProcessor.class); public String getEventIdentifer() { @@ -872,14 +828,10 @@ public String getEventIdentifer() { } public void processEvent(Event event) { - if(logger.isDebugEnabled()) { - logger.debug("\n\n\n=============================================================\n" + event - + "\n=============================================================\n\n\n"); - } - if(logger.isDebugEnabled()) { - logger.debug("revising calendar item for " + event.getResource()); - } - + logger.debug("\n\n\n============================================================\n{}\n=============================================================\n\n\n", + event.toString()); + logger.debug("revising calendar item for {}", event.getResource()); + String entityReference = event.getResource(); Entity entity = sakaiProxy.getEntity(entityReference ); @@ -954,7 +906,7 @@ public void processEvent(Event event) { public class ScheduleUpdateExcludedEventProcessor implements EventProcessor { - private Log logger = LogFactory.getLog(ScheduleUpdateExcludedEventProcessor.class); + private Logger logger = LoggerFactory.getLogger(ScheduleUpdateExcludedEventProcessor.class); public String getEventIdentifer() { @@ -962,11 +914,9 @@ public String getEventIdentifer() { } public void processEvent(Event event) { - if(logger.isDebugEnabled()) { - logger.debug("\n\n\n=============================================================\n" + event - + "\n=============================================================\n\n\n"); - } - + logger.debug("\n\n\n============================================================\n{}\n=============================================================\n\n\n", + event.toString()); + // This is a case of a revision to one instance of a repeating event. If effect, // a new calendar-event entity has been created to represent the instance that // was excluded from the recurring event. @@ -1007,7 +957,7 @@ public void processEvent(Event event) { dashboardLogic.createCalendarLinks(calendarItem); } else { // for now, let's log the error - logger.info(eventId + " is not processed for entityReference " + event.getResource()); + logger.info("{} is not processed for entityReference {}",eventId, event.getResource()); } } @@ -1015,7 +965,7 @@ public void processEvent(Event event) { public class ScheduleUpdateExclusionsEventProcessor implements EventProcessor { - private Log logger = LogFactory.getLog(ScheduleUpdateExclusionsEventProcessor.class); + private Logger logger = LoggerFactory.getLogger(ScheduleUpdateExclusionsEventProcessor.class); public String getEventIdentifer() { @@ -1023,11 +973,9 @@ public String getEventIdentifer() { } public void processEvent(Event event) { - if(logger.isDebugEnabled()) { - logger.debug("\n\n\n=============================================================\n" + event - + "\n=============================================================\n\n\n"); - } - + logger.debug("\n\n\n============================================================\n{}\n=============================================================\n\n\n", + event.toString()); + // This is a case of a revision to one instance of a repeating event, which is // then no longer an instance of the repeating event. This event processor handles // the change to the repeating event: exclusion of one instance from the sequence. @@ -1062,10 +1010,8 @@ public void processEvent(Event event) { } entityReference = buf.toString(); } - if(logger.isDebugEnabled()) { - logger.info("processEvent() " + entityReference + " " + sequenceNumber); - } - + logger.info("processEvent() {} {}", entityReference, sequenceNumber); + if(entityReference != null && sequenceNumber >= -1) { String calendarTimeLabelKey = null; CalendarItem calendarItem = dashboardLogic.getCalendarItem(entityReference, calendarTimeLabelKey, sequenceNumber); diff --git a/dashboard/impl/src/java/org/sakaiproject/dash/jobs/DashAggregateJob.java b/dashboard/impl/src/java/org/sakaiproject/dash/jobs/DashAggregateJob.java index 4c94ab2f6403..e6ad3511e7f8 100644 --- a/dashboard/impl/src/java/org/sakaiproject/dash/jobs/DashAggregateJob.java +++ b/dashboard/impl/src/java/org/sakaiproject/dash/jobs/DashAggregateJob.java @@ -28,8 +28,8 @@ import java.util.Date; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.quartz.SchedulerException; @@ -49,7 +49,7 @@ //TODO: Find all statsUpdateManager and replace with this dashboard job public class DashAggregateJob implements StatefulJob { - private Log LOG = LogFactory.getLog(DashAggregateJob.class); + private Logger LOG = LoggerFactory.getLogger(DashAggregateJob.class); // Spring fields private int maxEventsPerRun = 0; diff --git a/dashboard/impl/src/java/org/sakaiproject/dash/jobs/DashCheckAdminChangesJob.java b/dashboard/impl/src/java/org/sakaiproject/dash/jobs/DashCheckAdminChangesJob.java index d7705fb4c4da..7216ce2ef9f7 100644 --- a/dashboard/impl/src/java/org/sakaiproject/dash/jobs/DashCheckAdminChangesJob.java +++ b/dashboard/impl/src/java/org/sakaiproject/dash/jobs/DashCheckAdminChangesJob.java @@ -18,15 +18,15 @@ */ package org.sakaiproject.dash.jobs; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; //TODO: Find all statsUpdateManager and replace with this dashboard job public class DashCheckAdminChangesJob extends DashQuartzJob { - private Log logger = LogFactory.getLog(DashCheckAdminChangesJob.class); + private Logger logger = LoggerFactory.getLogger(DashCheckAdminChangesJob.class); //Matches the bean id final static String beanId = "dashCheckAdminChangesJob"; diff --git a/dashboard/impl/src/java/org/sakaiproject/dash/jobs/DashCheckAvailabilityJob.java b/dashboard/impl/src/java/org/sakaiproject/dash/jobs/DashCheckAvailabilityJob.java index 8b2bc10f42f1..dd0e430927e4 100644 --- a/dashboard/impl/src/java/org/sakaiproject/dash/jobs/DashCheckAvailabilityJob.java +++ b/dashboard/impl/src/java/org/sakaiproject/dash/jobs/DashCheckAvailabilityJob.java @@ -18,14 +18,14 @@ */ package org.sakaiproject.dash.jobs; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; //TODO: Find all statsUpdateManager and replace with this dashboard job public class DashCheckAvailabilityJob extends DashQuartzJob { - private Log logger = LogFactory.getLog(DashCheckAvailabilityJob.class); + private Logger logger = LoggerFactory.getLogger(DashCheckAvailabilityJob.class); //Matches the bean id final static String beanId = "dashCheckAvailabilityJob"; diff --git a/dashboard/impl/src/java/org/sakaiproject/dash/jobs/DashExpirePurgeJob.java b/dashboard/impl/src/java/org/sakaiproject/dash/jobs/DashExpirePurgeJob.java index b0091934a36e..1d1373303a08 100644 --- a/dashboard/impl/src/java/org/sakaiproject/dash/jobs/DashExpirePurgeJob.java +++ b/dashboard/impl/src/java/org/sakaiproject/dash/jobs/DashExpirePurgeJob.java @@ -18,15 +18,15 @@ */ package org.sakaiproject.dash.jobs; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; //TODO: Find all statsUpdateManager and replace with this dashboard job public class DashExpirePurgeJob extends DashQuartzJob { - private Log logger = LogFactory.getLog(DashExpirePurgeJob.class); + private Logger logger = LoggerFactory.getLogger(DashExpirePurgeJob.class); //Matches the bean id final static String beanId = "dashExpirePurgeJob"; diff --git a/dashboard/impl/src/java/org/sakaiproject/dash/jobs/DashQuartzJob.java b/dashboard/impl/src/java/org/sakaiproject/dash/jobs/DashQuartzJob.java index 98006bfebcb2..355a2786f3bb 100644 --- a/dashboard/impl/src/java/org/sakaiproject/dash/jobs/DashQuartzJob.java +++ b/dashboard/impl/src/java/org/sakaiproject/dash/jobs/DashQuartzJob.java @@ -18,8 +18,8 @@ */ package org.sakaiproject.dash.jobs; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; @@ -30,7 +30,7 @@ //TODO: Find all statsUpdateManager and replace with this dashboard job public class DashQuartzJob implements Job { - private Log logger = LogFactory.getLog(DashQuartzJob.class); + private Logger logger = LoggerFactory.getLogger(DashQuartzJob.class); private String configMessage; diff --git a/dashboard/impl/src/java/org/sakaiproject/dash/jobs/DashRepeatEventJob.java b/dashboard/impl/src/java/org/sakaiproject/dash/jobs/DashRepeatEventJob.java index 79dcbeac22c6..3140beb4c611 100644 --- a/dashboard/impl/src/java/org/sakaiproject/dash/jobs/DashRepeatEventJob.java +++ b/dashboard/impl/src/java/org/sakaiproject/dash/jobs/DashRepeatEventJob.java @@ -19,14 +19,14 @@ package org.sakaiproject.dash.jobs; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; //TODO: Find all statsUpdateManager and replace with this dashboard job public class DashRepeatEventJob extends DashQuartzJob { - private Log logger = LogFactory.getLog(DashRepeatEventJob.class); + private Logger logger = LoggerFactory.getLogger(DashRepeatEventJob.class); //Matches the bean id final static String beanId = "dashRepeatEventJob"; diff --git a/dashboard/impl/src/java/org/sakaiproject/dash/jobs/DashSyncUserSitesJob.java b/dashboard/impl/src/java/org/sakaiproject/dash/jobs/DashSyncUserSitesJob.java index 5dfdc16aa850..110182f213b2 100644 --- a/dashboard/impl/src/java/org/sakaiproject/dash/jobs/DashSyncUserSitesJob.java +++ b/dashboard/impl/src/java/org/sakaiproject/dash/jobs/DashSyncUserSitesJob.java @@ -19,8 +19,8 @@ package org.sakaiproject.dash.jobs; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; @@ -34,7 +34,7 @@ * */ public class DashSyncUserSitesJob extends DashQuartzJob { - private Log logger = LogFactory.getLog(DashSyncUserSitesJob.class); + private Logger logger = LoggerFactory.getLogger(DashSyncUserSitesJob.class); //Matches the bean id final static String beanId = "dashSyncUserSitesJob"; diff --git a/dashboard/impl/src/java/org/sakaiproject/dash/logic/DashboardConfigImpl.java b/dashboard/impl/src/java/org/sakaiproject/dash/logic/DashboardConfigImpl.java index c0745b591cfa..eba4305c2806 100644 --- a/dashboard/impl/src/java/org/sakaiproject/dash/logic/DashboardConfigImpl.java +++ b/dashboard/impl/src/java/org/sakaiproject/dash/logic/DashboardConfigImpl.java @@ -27,15 +27,15 @@ import net.sf.ehcache.Cache; import net.sf.ehcache.Element; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.dash.app.DashboardConfig; import org.sakaiproject.dash.dao.DashboardDao; import org.springframework.transaction.annotation.Transactional; public class DashboardConfigImpl implements DashboardConfig { - private static Log logger = LogFactory.getLog(DashboardConfigImpl.class); + private static Logger logger = LoggerFactory.getLogger(DashboardConfigImpl.class); public static final String DASHBOARD_CACHE_PREFIX = "org.sakaiproject.dash.app.DashboardConfig."; diff --git a/dashboard/impl/src/java/org/sakaiproject/dash/logic/DashboardLogicImpl.java b/dashboard/impl/src/java/org/sakaiproject/dash/logic/DashboardLogicImpl.java index 806267d7cef3..2cd86c6d1b8a 100644 --- a/dashboard/impl/src/java/org/sakaiproject/dash/logic/DashboardLogicImpl.java +++ b/dashboard/impl/src/java/org/sakaiproject/dash/logic/DashboardLogicImpl.java @@ -1187,7 +1187,7 @@ public void updateCalendarLinks(String entityReference) { if(calendarLinks.size() > 0) { count = dao.addCalendarLinks(calendarLinks); } - // TODO: Log count + // TODO: Logger count } if(logger.isDebugEnabled()) { StringBuilder buf = new StringBuilder("updateCalendarLinks("); diff --git a/dashboard/tool/src/java/org/sakaiproject/dash/tool/util/JsonHelper.java b/dashboard/tool/src/java/org/sakaiproject/dash/tool/util/JsonHelper.java index 1de983e16dc0..c77e64a4a072 100644 --- a/dashboard/tool/src/java/org/sakaiproject/dash/tool/util/JsonHelper.java +++ b/dashboard/tool/src/java/org/sakaiproject/dash/tool/util/JsonHelper.java @@ -27,8 +27,8 @@ import net.sf.json.JSONArray; import net.sf.json.JSONObject; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.dash.app.DashboardCommonLogic; import org.sakaiproject.dash.app.DashboardConfig; import org.sakaiproject.dash.model.CalendarItem; @@ -43,7 +43,7 @@ */ public class JsonHelper { - private static Log logger = LogFactory.getLog(JsonHelper.class); + private static Logger logger = LoggerFactory.getLogger(JsonHelper.class); protected DashboardCommonLogic dashboardCommonLogic; protected DashboardConfig dashboardConfig; diff --git a/dav/dav-server/src/java/org/sakaiproject/dav/DavRealm.java b/dav/dav-server/src/java/org/sakaiproject/dav/DavRealm.java index 1590ec3876c4..3ccb33ee0910 100644 --- a/dav/dav-server/src/java/org/sakaiproject/dav/DavRealm.java +++ b/dav/dav-server/src/java/org/sakaiproject/dav/DavRealm.java @@ -26,8 +26,8 @@ import org.apache.catalina.LifecycleException; import org.apache.catalina.realm.RealmBase; import org.apache.catalina.Wrapper; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Simple implementation of Realm that consults the Sakai user directory service to provide container security equivalent to then application security in CHEF. @@ -37,7 +37,7 @@ public final class DavRealm extends RealmBase { - private static Log M_log = LogFactory.getLog(DavRealm.class); + private static Logger M_log = LoggerFactory.getLogger(DavRealm.class); /** Descriptive information about this Realm implementation. */ protected static final String info = "org.sakaiproject.realm.DavRealm/1.0"; diff --git a/dav/dav/src/java/org/sakaiproject/dav/DavServlet.java b/dav/dav/src/java/org/sakaiproject/dav/DavServlet.java index 54139ae03e23..d831b0344025 100644 --- a/dav/dav/src/java/org/sakaiproject/dav/DavServlet.java +++ b/dav/dav/src/java/org/sakaiproject/dav/DavServlet.java @@ -120,8 +120,8 @@ import org.apache.tomcat.util.buf.UDecoder; import org.sakaiproject.dav.MD5Encoder; import org.apache.catalina.util.XMLWriter; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.alias.api.AliasService; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.component.cover.ServerConfigurationService; @@ -181,7 +181,7 @@ public class DavServlet extends HttpServlet private static final long serialVersionUID = 1L; /** Our logger. */ - private static Log M_log = LogFactory.getLog(DavServlet.class); + private static Logger M_log = LoggerFactory.getLogger(DavServlet.class); protected static ResourceLoader rb = new ResourceLoader("org.sakaiproject.tool.dav.bundle.Messages"); // -------------------------------------------------------------- Constants diff --git a/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/CourseManagementAdministrationHibernateImpl.java b/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/CourseManagementAdministrationHibernateImpl.java index fad12a87af41..6c3ed06b2d76 100644 --- a/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/CourseManagementAdministrationHibernateImpl.java +++ b/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/CourseManagementAdministrationHibernateImpl.java @@ -27,8 +27,8 @@ import java.util.List; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.Hibernate; import org.hibernate.HibernateException; import org.hibernate.Query; @@ -60,7 +60,7 @@ public class CourseManagementAdministrationHibernateImpl extends HibernateDaoSupport implements CourseManagementAdministration { - private static final Log log = LogFactory.getLog(CourseManagementAdministrationHibernateImpl.class); + private static final Logger log = LoggerFactory.getLogger(CourseManagementAdministrationHibernateImpl.class); protected Authentication authn; public void setAuthn(Authentication authn) { diff --git a/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/CourseManagementServiceFederatedImpl.java b/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/CourseManagementServiceFederatedImpl.java index b0721a8a97e2..63ed5acaf9ca 100644 --- a/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/CourseManagementServiceFederatedImpl.java +++ b/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/CourseManagementServiceFederatedImpl.java @@ -32,8 +32,8 @@ import java.util.Set; import java.util.Map.Entry; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.coursemanagement.api.AcademicSession; import org.sakaiproject.coursemanagement.api.CanonicalCourse; import org.sakaiproject.coursemanagement.api.CourseManagementService; @@ -75,7 +75,7 @@ public class CourseManagementServiceFederatedImpl implements CourseManagementService { - private static final Log log = LogFactory.getLog(CourseManagementServiceFederatedImpl.class); + private static final Logger log = LoggerFactory.getLogger(CourseManagementServiceFederatedImpl.class); private List implList; diff --git a/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/CourseManagementServiceHibernateImpl.java b/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/CourseManagementServiceHibernateImpl.java index 2d2cc871706c..e9d30e8ba76f 100644 --- a/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/CourseManagementServiceHibernateImpl.java +++ b/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/CourseManagementServiceHibernateImpl.java @@ -36,8 +36,8 @@ import org.hibernate.Session; import org.hibernate.criterion.DetachedCriteria; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.coursemanagement.api.AcademicSession; import org.sakaiproject.coursemanagement.api.CanonicalCourse; import org.sakaiproject.coursemanagement.api.CourseManagementService; @@ -59,7 +59,7 @@ * */ public class CourseManagementServiceHibernateImpl extends HibernateDaoSupport implements CourseManagementService { - private static final Log log = LogFactory.getLog(CourseManagementServiceHibernateImpl.class); + private static final Logger log = LoggerFactory.getLogger(CourseManagementServiceHibernateImpl.class); public void init() { log.info("Initializing " + getClass().getName()); diff --git a/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/CourseSitePublishServiceImpl.java b/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/CourseSitePublishServiceImpl.java index b7289840e8ea..b45e38a96a93 100644 --- a/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/CourseSitePublishServiceImpl.java +++ b/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/CourseSitePublishServiceImpl.java @@ -15,8 +15,8 @@ */ package org.sakaiproject.coursemanagement.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.FunctionManager; import org.sakaiproject.authz.api.SecurityService; import org.sakaiproject.coursemanagement.api.AcademicSession; @@ -40,7 +40,7 @@ */ public class CourseSitePublishServiceImpl extends HibernateDaoSupport implements CourseSitePublishService { // logger - private final transient Log logger = LogFactory.getLog(getClass()); + private final transient Logger logger = LoggerFactory.getLogger(getClass()); // class members private static final long ONE_DAY_IN_MS = 1000L * 60L * 60L * 24L; // one day in ms = 1000ms/s · 60s/m · 60m/h · 24h/day @@ -226,7 +226,7 @@ public int publishCourseSites(int numDaysBeforeTermStarts) { } } } catch (Exception ex) { - logger.error(ex); + logger.error(ex.getMessage(), ex); } return numSitesPublished; } diff --git a/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/CourseSiteRemovalServiceImpl.java b/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/CourseSiteRemovalServiceImpl.java index 761f701e27ea..71dc699deee2 100644 --- a/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/CourseSiteRemovalServiceImpl.java +++ b/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/CourseSiteRemovalServiceImpl.java @@ -15,8 +15,8 @@ */ package org.sakaiproject.coursemanagement.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.FunctionManager; import org.sakaiproject.authz.api.Member; import org.sakaiproject.authz.api.SecurityService; @@ -42,7 +42,7 @@ public class CourseSiteRemovalServiceImpl extends HibernateDaoSupport implements CourseSiteRemovalService { // logger - private final transient Log logger = LogFactory.getLog(getClass()); + private final transient Logger logger = LoggerFactory.getLogger(getClass()); // class members private static final long ONE_DAY_IN_MS = 1000L * 60L * 60L * 24L; // one day in ms = 1000ms/s · 60s/m · 60m/h · 24h/day @@ -208,7 +208,7 @@ public int removeCourseSites(CourseSiteRemovalService.Action action, int numDays } } } catch (Exception ex) { - logger.error(ex); + logger.error(ex.getMessage(), ex); } return numSitesRemoved; } diff --git a/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/IndexGenerator.java b/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/IndexGenerator.java index 4933b61fb127..4374cc481d25 100644 --- a/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/IndexGenerator.java +++ b/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/IndexGenerator.java @@ -20,8 +20,8 @@ **********************************************************************************/ package org.sakaiproject.coursemanagement.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.db.api.SqlService; @@ -33,7 +33,7 @@ * */ public abstract class IndexGenerator { - private static final Log log = LogFactory.getLog(IndexGenerator.class); + private static final Logger log = LoggerFactory.getLogger(IndexGenerator.class); public abstract SqlService sqlService(); public abstract ServerConfigurationService scs(); diff --git a/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/SampleDataLoader.java b/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/SampleDataLoader.java index eb8fddee975e..801bc97c73dc 100644 --- a/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/SampleDataLoader.java +++ b/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/SampleDataLoader.java @@ -37,8 +37,8 @@ import java.util.Map; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroupService; import org.sakaiproject.coursemanagement.api.AcademicSession; import org.sakaiproject.coursemanagement.api.CanonicalCourse; @@ -62,7 +62,7 @@ import org.springframework.transaction.support.DefaultTransactionDefinition; public class SampleDataLoader implements BeanFactoryAware { - private static final Log log = LogFactory.getLog(SampleDataLoader.class); + private static final Logger log = LoggerFactory.getLogger(SampleDataLoader.class); protected static final int ACADEMIC_SESSION_YEAR; protected static final String[] ACADEMIC_SESSION_EIDS = new String[4]; diff --git a/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/SiteTitleAdvisorCMS.java b/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/SiteTitleAdvisorCMS.java index 7703d99d910b..41b3d19b7528 100644 --- a/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/SiteTitleAdvisorCMS.java +++ b/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/SiteTitleAdvisorCMS.java @@ -27,8 +27,8 @@ import lombok.Setter; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroupService; import org.sakaiproject.authz.api.SecurityService; import org.sakaiproject.component.api.ServerConfigurationService; @@ -50,7 +50,7 @@ public class SiteTitleAdvisorCMS implements SiteTitleAdvisor { // Services - private final transient Log log = LogFactory.getLog( getClass() ); + private final transient Logger log = LoggerFactory.getLogger( getClass() ); @Getter @Setter private static UserDirectoryService uds; @Getter @Setter private static SecurityService ss; @Getter @Setter private static CourseManagementService cms; diff --git a/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/aop/CourseManagementAdministrationAuthzAdvisor.java b/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/aop/CourseManagementAdministrationAuthzAdvisor.java index b1da4b67f037..515dc4ce1078 100644 --- a/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/aop/CourseManagementAdministrationAuthzAdvisor.java +++ b/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/aop/CourseManagementAdministrationAuthzAdvisor.java @@ -22,14 +22,14 @@ import java.lang.reflect.Method; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.SecurityService; import org.sakaiproject.coursemanagement.impl.exception.PermissionException; import org.springframework.aop.MethodBeforeAdvice; public class CourseManagementAdministrationAuthzAdvisor implements MethodBeforeAdvice { - private static final Log log = LogFactory.getLog(CourseManagementAdministrationAuthzAdvisor.class); + private static final Logger log = LoggerFactory.getLogger(CourseManagementAdministrationAuthzAdvisor.class); SecurityService securityService; diff --git a/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/job/ClassPathCMSyncJob.java b/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/job/ClassPathCMSyncJob.java index f1dbc9a8e583..c6024913ff29 100644 --- a/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/job/ClassPathCMSyncJob.java +++ b/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/job/ClassPathCMSyncJob.java @@ -22,8 +22,8 @@ import java.io.InputStream; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; @@ -41,7 +41,7 @@ * */ public class ClassPathCMSyncJob extends CmSynchronizer implements Job { - private static final Log log = LogFactory.getLog(ClassPathCMSyncJob.class); + private static final Logger log = LoggerFactory.getLogger(ClassPathCMSyncJob.class); protected String classPathToXml; diff --git a/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/job/CmSynchronizer.java b/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/job/CmSynchronizer.java index 5da0eb36b8a1..490c3174a333 100644 --- a/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/job/CmSynchronizer.java +++ b/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/job/CmSynchronizer.java @@ -33,8 +33,8 @@ import java.util.Map; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.jdom.Document; import org.jdom.Element; import org.jdom.JDOMException; @@ -60,7 +60,7 @@ * */ public abstract class CmSynchronizer { - private static final Log log = LogFactory.getLog(CmSynchronizer.class); + private static final Logger log = LoggerFactory.getLogger(CmSynchronizer.class); protected CourseManagementService cmService; protected CourseManagementAdministration cmAdmin; @@ -142,7 +142,7 @@ protected void reconcileAcademicSessions(Document doc) { } } } catch (JDOMException jde) { - log.error(jde); + log.error(jde.getMessage()); } if(log.isInfoEnabled()) log.info("Finished reconciling AcademicSessions in " + (System.currentTimeMillis()-start) + " ms"); @@ -159,7 +159,7 @@ protected void reconcileCurrentAcademicSessions(Document doc) { if(log.isDebugEnabled()) log.debug("Found current academic sessions to reconcile: " + academicSessionEids); cmAdmin.setCurrentAcademicSessions(academicSessionEids); } catch (JDOMException jde) { - log.error(jde); + log.error(jde.getMessage()); } } @@ -204,7 +204,7 @@ protected void reconcileCanonicalCourses(Document doc) { } } } catch (JDOMException jde) { - log.error(jde); + log.error(jde.getMessage()); } if(log.isInfoEnabled()) log.info("Finished reconciling CanonicalCourses in " + (System.currentTimeMillis()-start) + " ms"); @@ -255,7 +255,7 @@ protected void reconcileCourseOfferings(Document doc) { } } catch (JDOMException jde) { - log.error(jde); + log.error(jde.getMessage()); } if(log.isInfoEnabled()) log.info("Finished reconciling CourseOfferings in " + (System.currentTimeMillis()-start) + " ms"); } @@ -343,7 +343,7 @@ protected void reconcileEnrollmentSets(Document doc) { reconcileOfficialInstructors(element, enr); } } catch (JDOMException jde) { - log.error(jde); + log.error(jde.getMessage()); } if(log.isInfoEnabled()) log.info("Finished reconciling EnrollmentSets in " + (System.currentTimeMillis()-start) + " ms"); @@ -475,7 +475,7 @@ protected void reconcileSections(Document doc) { } } } catch (JDOMException jde) { - log.error(jde); + log.error(jde.getMessage()); } if(log.isInfoEnabled()) log.info("Finished reconciling Sections in " + (System.currentTimeMillis()-start) + " ms"); } @@ -576,7 +576,7 @@ protected void reconcileCourseSets(Document doc) { } } } catch (JDOMException jde) { - log.error(jde); + log.error(jde.getMessage()); } if(log.isInfoEnabled()) log.info("Finished reconciling CourseSets in " + (System.currentTimeMillis()-start) + " ms"); } diff --git a/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/test/org/sakaiproject/coursemanagement/test/CourseManagementAdministrationTest.java b/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/test/org/sakaiproject/coursemanagement/test/CourseManagementAdministrationTest.java index 4410142b87a9..b55a1180a42f 100644 --- a/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/test/org/sakaiproject/coursemanagement/test/CourseManagementAdministrationTest.java +++ b/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/test/org/sakaiproject/coursemanagement/test/CourseManagementAdministrationTest.java @@ -27,8 +27,8 @@ import java.util.List; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.Assert; import org.junit.Test; import org.sakaiproject.coursemanagement.api.AcademicSession; @@ -46,7 +46,7 @@ import org.springframework.beans.factory.annotation.Autowired; public class CourseManagementAdministrationTest extends CourseManagementTestBase { - private static final Log log = LogFactory.getLog(CourseManagementAdministrationTest.class); + private static final Logger log = LoggerFactory.getLogger(CourseManagementAdministrationTest.class); @Autowired private CourseManagementService cm; diff --git a/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/test/org/sakaiproject/coursemanagement/test/CourseManagementServiceTest.java b/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/test/org/sakaiproject/coursemanagement/test/CourseManagementServiceTest.java index 256c86594c93..d1600ef0221f 100644 --- a/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/test/org/sakaiproject/coursemanagement/test/CourseManagementServiceTest.java +++ b/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/test/org/sakaiproject/coursemanagement/test/CourseManagementServiceTest.java @@ -25,8 +25,8 @@ import java.util.Map; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -41,7 +41,7 @@ import org.springframework.beans.factory.annotation.Autowired; public class CourseManagementServiceTest extends CourseManagementTestBase { - private static final Log log = LogFactory.getLog(CourseManagementServiceTest.class); + private static final Logger log = LoggerFactory.getLogger(CourseManagementServiceTest.class); @Autowired private CourseManagementService cm; diff --git a/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/test/org/sakaiproject/coursemanagement/test/HibernateTestDataLoader.java b/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/test/org/sakaiproject/coursemanagement/test/HibernateTestDataLoader.java index 7d62598a7f50..f3ff411d17e0 100644 --- a/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/test/org/sakaiproject/coursemanagement/test/HibernateTestDataLoader.java +++ b/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/test/org/sakaiproject/coursemanagement/test/HibernateTestDataLoader.java @@ -27,8 +27,8 @@ import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.coursemanagement.api.AcademicSession; import org.sakaiproject.coursemanagement.api.CourseManagementService; import org.sakaiproject.coursemanagement.api.CourseOffering; @@ -53,7 +53,7 @@ * @author Josh Holtzman */ public class HibernateTestDataLoader extends HibernateDaoSupport implements DataLoader { - private static final Log log = LogFactory.getLog(HibernateTestDataLoader.class); + private static final Logger log = LoggerFactory.getLogger(HibernateTestDataLoader.class); private CourseManagementService cm; diff --git a/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/test/org/sakaiproject/coursemanagement/test/performance/IndexPerformance.java b/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/test/org/sakaiproject/coursemanagement/test/performance/IndexPerformance.java index cf3daa82456e..1da1d972d2c1 100644 --- a/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/test/org/sakaiproject/coursemanagement/test/performance/IndexPerformance.java +++ b/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/test/org/sakaiproject/coursemanagement/test/performance/IndexPerformance.java @@ -24,8 +24,8 @@ import java.util.Map; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.coursemanagement.api.CourseManagementAdministration; import org.sakaiproject.coursemanagement.api.CourseManagementService; import org.sakaiproject.coursemanagement.api.Enrollment; @@ -40,7 +40,7 @@ import org.springframework.transaction.support.DefaultTransactionDefinition; public class IndexPerformance { - private static final Log log = LogFactory.getLog(IndexPerformance.class); + private static final Logger log = LoggerFactory.getLogger(IndexPerformance.class); private static final int secCount = 10; private static final int enrollmentsPerEnrollmentSet = 100; diff --git a/edu-services/gradebook-service/hibernate/src/java/org/sakaiproject/tool/gradebook/GradableObject.java b/edu-services/gradebook-service/hibernate/src/java/org/sakaiproject/tool/gradebook/GradableObject.java index 20fdfaf572d8..66702d299414 100644 --- a/edu-services/gradebook-service/hibernate/src/java/org/sakaiproject/tool/gradebook/GradableObject.java +++ b/edu-services/gradebook-service/hibernate/src/java/org/sakaiproject/tool/gradebook/GradableObject.java @@ -28,8 +28,8 @@ import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * A GradableObject is a component of a Gradebook for which students can be @@ -38,7 +38,7 @@ * @author Josh Holtzman */ public abstract class GradableObject implements Serializable { - protected static final Log log = LogFactory.getLog(GradableObject.class); + protected static final Logger log = LoggerFactory.getLogger(GradableObject.class); protected Long id; protected int version; diff --git a/edu-services/gradebook-service/hibernate/src/java/org/sakaiproject/tool/gradebook/GradeMapping.java b/edu-services/gradebook-service/hibernate/src/java/org/sakaiproject/tool/gradebook/GradeMapping.java index 3e1a5e2abcbb..6aab3600320e 100644 --- a/edu-services/gradebook-service/hibernate/src/java/org/sakaiproject/tool/gradebook/GradeMapping.java +++ b/edu-services/gradebook-service/hibernate/src/java/org/sakaiproject/tool/gradebook/GradeMapping.java @@ -27,8 +27,8 @@ import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * A GradeMapping provides a means to convert between an arbitrary set of grades @@ -36,7 +36,7 @@ * */ public class GradeMapping implements Serializable, Comparable { - protected Log log = LogFactory.getLog(GradeMapping.class); + protected Logger log = LoggerFactory.getLogger(GradeMapping.class); protected Long id; protected int version; diff --git a/edu-services/gradebook-service/hibernate/src/java/org/sakaiproject/tool/gradebook/GradebookArchive.java b/edu-services/gradebook-service/hibernate/src/java/org/sakaiproject/tool/gradebook/GradebookArchive.java index 468957294456..8ced7b6ef3dd 100644 --- a/edu-services/gradebook-service/hibernate/src/java/org/sakaiproject/tool/gradebook/GradebookArchive.java +++ b/edu-services/gradebook-service/hibernate/src/java/org/sakaiproject/tool/gradebook/GradebookArchive.java @@ -29,8 +29,8 @@ import java.io.ByteArrayOutputStream; import java.util.Collection; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Models a gradebook and all of its dependent objects, which can all be @@ -39,7 +39,7 @@ * @author Josh Holtzman */ public class GradebookArchive { - private static Log log = LogFactory.getLog(GradebookArchive.class); + private static Logger log = LoggerFactory.getLogger(GradebookArchive.class); private Gradebook gradebook; private GradeMapping selectedGradeMapping; diff --git a/edu-services/gradebook-service/hibernate/src/java/org/sakaiproject/tool/gradebook/Spreadsheet.java b/edu-services/gradebook-service/hibernate/src/java/org/sakaiproject/tool/gradebook/Spreadsheet.java index ac7ca2441510..bd90534957ef 100644 --- a/edu-services/gradebook-service/hibernate/src/java/org/sakaiproject/tool/gradebook/Spreadsheet.java +++ b/edu-services/gradebook-service/hibernate/src/java/org/sakaiproject/tool/gradebook/Spreadsheet.java @@ -21,8 +21,8 @@ package org.sakaiproject.tool.gradebook; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; @@ -45,7 +45,7 @@ public class Spreadsheet implements Serializable { protected String name; protected Date dateCreated; - protected static final Log log = LogFactory.getLog(Spreadsheet.class); + protected static final Logger log = LoggerFactory.getLogger(Spreadsheet.class); public Spreadsheet(Gradebook gradebook, String content, String creator, String name, Date dateCreated) { diff --git a/edu-services/gradebook-service/impl/src/java/org/sakaiproject/component/gradebook/BaseHibernateManager.java b/edu-services/gradebook-service/impl/src/java/org/sakaiproject/component/gradebook/BaseHibernateManager.java index 967455b4a5f3..89e0cab53b27 100644 --- a/edu-services/gradebook-service/impl/src/java/org/sakaiproject/component/gradebook/BaseHibernateManager.java +++ b/edu-services/gradebook-service/impl/src/java/org/sakaiproject/component/gradebook/BaseHibernateManager.java @@ -35,8 +35,8 @@ import java.util.Set; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.HibernateException; import org.hibernate.Query; import org.hibernate.Session; @@ -77,7 +77,7 @@ * logic, but not exposed to external callers. */ public abstract class BaseHibernateManager extends HibernateDaoSupport { - private static final Log log = LogFactory.getLog(BaseHibernateManager.class); + private static final Logger log = LoggerFactory.getLogger(BaseHibernateManager.class); // Oracle will throw a SQLException if we put more than this into a // "WHERE tbl.col IN (:paramList)" query. diff --git a/edu-services/gradebook-service/impl/src/java/org/sakaiproject/component/gradebook/GradebookExternalAssessmentServiceImpl.java b/edu-services/gradebook-service/impl/src/java/org/sakaiproject/component/gradebook/GradebookExternalAssessmentServiceImpl.java index 33bf5b80029b..f873bd83a1de 100644 --- a/edu-services/gradebook-service/impl/src/java/org/sakaiproject/component/gradebook/GradebookExternalAssessmentServiceImpl.java +++ b/edu-services/gradebook-service/impl/src/java/org/sakaiproject/component/gradebook/GradebookExternalAssessmentServiceImpl.java @@ -37,8 +37,8 @@ import java.util.concurrent.ConcurrentHashMap; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.HibernateException; import org.hibernate.Query; import org.hibernate.Session; @@ -65,9 +65,9 @@ import org.springframework.orm.hibernate3.HibernateTemplate; public class GradebookExternalAssessmentServiceImpl extends BaseHibernateManager implements GradebookExternalAssessmentService { - private static final Log log = LogFactory.getLog(GradebookExternalAssessmentServiceImpl.class); + private static final Logger log = LoggerFactory.getLogger(GradebookExternalAssessmentServiceImpl.class); // Special logger for data contention analysis. - private static final Log logData = LogFactory.getLog(GradebookExternalAssessmentServiceImpl.class.getName() + ".GB_DATA"); + private static final Logger logData = LoggerFactory.getLogger(GradebookExternalAssessmentServiceImpl.class.getName() + ".GB_DATA"); private GradebookService gradebookService; private EventTrackingService eventTrackingService; @@ -961,7 +961,7 @@ private Double convertStringToDouble(String doubleAsString) { Number numericScore = getNumberFormat().parse(doubleAsString.trim()); scoreAsDouble = numericScore.doubleValue(); } catch (ParseException e) { - log.error(e); + log.error(e.getMessage()); } } diff --git a/edu-services/gradebook-service/impl/src/java/org/sakaiproject/component/gradebook/GradebookFrameworkServiceImpl.java b/edu-services/gradebook-service/impl/src/java/org/sakaiproject/component/gradebook/GradebookFrameworkServiceImpl.java index 79232fa18216..fa02b3539406 100644 --- a/edu-services/gradebook-service/impl/src/java/org/sakaiproject/component/gradebook/GradebookFrameworkServiceImpl.java +++ b/edu-services/gradebook-service/impl/src/java/org/sakaiproject/component/gradebook/GradebookFrameworkServiceImpl.java @@ -31,8 +31,8 @@ import java.util.Map; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.HibernateException; import org.hibernate.Query; import org.hibernate.Session; @@ -53,7 +53,7 @@ import org.springframework.orm.hibernate3.HibernateTemplate; public class GradebookFrameworkServiceImpl extends BaseHibernateManager implements GradebookFrameworkService { - private static final Log log = LogFactory.getLog(GradebookFrameworkServiceImpl.class); + private static final Logger log = LoggerFactory.getLogger(GradebookFrameworkServiceImpl.class); public static final String UID_OF_DEFAULT_GRADING_SCALE_PROPERTY = "uidOfDefaultGradingScale"; diff --git a/edu-services/gradebook-service/impl/src/java/org/sakaiproject/component/gradebook/GradebookServiceHibernateImpl.java b/edu-services/gradebook-service/impl/src/java/org/sakaiproject/component/gradebook/GradebookServiceHibernateImpl.java index 0fe56e996adb..78840cb9188d 100644 --- a/edu-services/gradebook-service/impl/src/java/org/sakaiproject/component/gradebook/GradebookServiceHibernateImpl.java +++ b/edu-services/gradebook-service/impl/src/java/org/sakaiproject/component/gradebook/GradebookServiceHibernateImpl.java @@ -46,8 +46,8 @@ import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; import org.apache.commons.lang.math.NumberUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.Hibernate; import org.hibernate.HibernateException; import org.hibernate.Query; @@ -94,7 +94,7 @@ * A Hibernate implementation of GradebookService. */ public class GradebookServiceHibernateImpl extends BaseHibernateManager implements GradebookService { - private static final Log log = LogFactory.getLog(GradebookServiceHibernateImpl.class); + private static final Logger log = LoggerFactory.getLogger(GradebookServiceHibernateImpl.class); private Authz authz; private GradebookPermissionService gradebookPermissionService; @@ -2801,7 +2801,7 @@ private Double convertStringToDouble(String doubleAsString) { Number numericScore = numberFormat.parse(doubleAsString.trim()); scoreAsDouble = numericScore.doubleValue(); } catch (ParseException e) { - log.error(e); + log.error(e.getMessage()); } } diff --git a/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sakai2impl/AuthnSakai2Impl.java b/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sakai2impl/AuthnSakai2Impl.java index 5456d7436239..5a16fd2236ca 100644 --- a/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sakai2impl/AuthnSakai2Impl.java +++ b/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sakai2impl/AuthnSakai2Impl.java @@ -21,8 +21,8 @@ **********************************************************************************/ package org.sakaiproject.tool.gradebook.facades.sakai2impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.api.Session; import org.sakaiproject.tool.cover.SessionManager; import org.sakaiproject.tool.gradebook.facades.Authn; @@ -33,7 +33,7 @@ * @author Josh Holtzman */ public class AuthnSakai2Impl implements Authn { - private static final Log log = LogFactory.getLog(AuthnSakai2Impl.class); + private static final Logger log = LoggerFactory.getLogger(AuthnSakai2Impl.class); /** * @see org.sakaiproject.tool.gradebook.facades.Authn#getUserUid() diff --git a/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sakai2impl/AuthzSakai2Impl.java b/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sakai2impl/AuthzSakai2Impl.java index 3b2250fbe802..f1b4e6da0ac7 100644 --- a/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sakai2impl/AuthzSakai2Impl.java +++ b/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sakai2impl/AuthzSakai2Impl.java @@ -24,8 +24,8 @@ import java.util.Collection; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.cover.FunctionManager; import org.sakaiproject.authz.cover.SecurityService; @@ -47,7 +47,7 @@ * role-determined group-scoped authz. */ public class AuthzSakai2Impl extends AuthzSectionsImpl implements Authz { - private static final Log log = LogFactory.getLog(AuthzSakai2Impl.class); + private static final Logger log = LoggerFactory.getLogger(AuthzSakai2Impl.class); public static final String PERMISSION_GRADE_ALL = "gradebook.gradeAll", diff --git a/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sakai2impl/BaseEntityProducer.java b/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sakai2impl/BaseEntityProducer.java index 01c17baeb24b..9be3630723bb 100644 --- a/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sakai2impl/BaseEntityProducer.java +++ b/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sakai2impl/BaseEntityProducer.java @@ -45,7 +45,7 @@ */ @Deprecated public class BaseEntityProducer implements EntityProducer { - //private static final Log log = LogFactory.getLog(BaseEntityProducer.class); + //private static final Logger log = LoggerFactory.getLogger(BaseEntityProducer.class); protected String label; // This should always be set. protected String referenceRoot = "/gradebook"; // stupid default but OK since it is not used diff --git a/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sakai2impl/ContextManagementSakai2Impl.java b/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sakai2impl/ContextManagementSakai2Impl.java index 5cb5d324c3fd..25e533e5a0a7 100644 --- a/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sakai2impl/ContextManagementSakai2Impl.java +++ b/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sakai2impl/ContextManagementSakai2Impl.java @@ -22,8 +22,8 @@ package org.sakaiproject.tool.gradebook.facades.sakai2impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.api.Placement; import org.sakaiproject.tool.cover.ToolManager; import org.sakaiproject.tool.gradebook.facades.ContextManagement; @@ -34,7 +34,7 @@ * @author Josh Holtzman */ public class ContextManagementSakai2Impl implements ContextManagement { - private static final Log log = LogFactory.getLog(ContextManagementSakai2Impl.class); + private static final Logger log = LoggerFactory.getLogger(ContextManagementSakai2Impl.class); private static final String DEFAULT_GRADEBOOK_NAME = "QA_6"; /** diff --git a/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sakai2impl/GradebookConfigurationSakai.java b/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sakai2impl/GradebookConfigurationSakai.java index 9f4930ca4172..d4a1bfb86849 100644 --- a/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sakai2impl/GradebookConfigurationSakai.java +++ b/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sakai2impl/GradebookConfigurationSakai.java @@ -21,8 +21,8 @@ **********************************************************************************/ package org.sakaiproject.tool.gradebook.facades.sakai2impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.db.api.SqlService; @@ -36,7 +36,7 @@ * issue HHH-1012.) */ public class GradebookConfigurationSakai extends GradebookConfiguration { - private static final Log log = LogFactory.getLog(GradebookConfigurationSakai.class); + private static final Logger log = LoggerFactory.getLogger(GradebookConfigurationSakai.class); private SqlService sqlService; private boolean autoDdl; diff --git a/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sakai2impl/GradebookEntityProducer.java b/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sakai2impl/GradebookEntityProducer.java index 91956944e548..407b0a0dc453 100644 --- a/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sakai2impl/GradebookEntityProducer.java +++ b/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sakai2impl/GradebookEntityProducer.java @@ -26,8 +26,8 @@ import java.util.Iterator; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.entity.api.ContextObserver; import org.sakaiproject.entity.api.EntityTransferrer; @@ -48,7 +48,7 @@ */ @Deprecated public class GradebookEntityProducer extends BaseEntityProducer implements ContextObserver, EntityTransferrer, HandlesImportable { - private static final Log log = LogFactory.getLog(GradebookEntityProducer.class); + private static final Logger log = LoggerFactory.getLogger(GradebookEntityProducer.class); private String[] toolIdArray; private GradebookFrameworkService gradebookFrameworkService; @@ -100,7 +100,7 @@ public void contextDeleted(String context, boolean toolPlacement) { try { gradebookFrameworkService.deleteGradebook(context); } catch (GradebookNotFoundException e) { - if (log.isWarnEnabled()) log.warn(e); + log.warn(e.getMessage()); } } } diff --git a/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sakai2impl/UserDirectoryServiceSakai2Impl.java b/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sakai2impl/UserDirectoryServiceSakai2Impl.java index ea2c0a59e909..2d732cd8ccf3 100644 --- a/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sakai2impl/UserDirectoryServiceSakai2Impl.java +++ b/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sakai2impl/UserDirectoryServiceSakai2Impl.java @@ -22,8 +22,8 @@ package org.sakaiproject.tool.gradebook.facades.sakai2impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.user.api.UserNotDefinedException; @@ -34,7 +34,7 @@ * Sakai2 implementation of the gradebook UserDirectoryService API. */ public class UserDirectoryServiceSakai2Impl implements UserDirectoryService { - private static final Log log = LogFactory.getLog(UserDirectoryServiceSakai2Impl.class); + private static final Logger log = LoggerFactory.getLogger(UserDirectoryServiceSakai2Impl.class); public String getUserDisplayName(String userUid) throws UnknownUserException { try { diff --git a/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sections/AuthzSectionsImpl.java b/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sections/AuthzSectionsImpl.java index 75b07947269d..bfc7b43fcb2f 100644 --- a/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sections/AuthzSectionsImpl.java +++ b/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sections/AuthzSectionsImpl.java @@ -29,8 +29,8 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.exception.IdUnusedException; import org.sakaiproject.section.api.SectionAwareness; import org.sakaiproject.section.api.coursemanagement.CourseSection; @@ -47,7 +47,7 @@ * on the shared Section Awareness API. */ public class AuthzSectionsImpl implements Authz { - private static final Log log = LogFactory.getLog(AuthzSectionsImpl.class); + private static final Logger log = LoggerFactory.getLogger(AuthzSectionsImpl.class); private Authn authn; private SectionAwareness sectionAwareness; diff --git a/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sections/UserDirectoryServiceStandaloneSectionsImpl.java b/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sections/UserDirectoryServiceStandaloneSectionsImpl.java index d8b7676a5013..0b13bd19db64 100644 --- a/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sections/UserDirectoryServiceStandaloneSectionsImpl.java +++ b/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/sections/UserDirectoryServiceStandaloneSectionsImpl.java @@ -22,8 +22,8 @@ package org.sakaiproject.tool.gradebook.facades.sections; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.coursemanagement.User; import org.sakaiproject.component.section.support.UserManager; import org.sakaiproject.service.gradebook.shared.UnknownUserException; @@ -31,7 +31,7 @@ import org.sakaiproject.user.api.UserNotDefinedException; public class UserDirectoryServiceStandaloneSectionsImpl implements UserDirectoryService { - private static final Log log = LogFactory.getLog(UserDirectoryServiceStandaloneSectionsImpl.class); + private static final Logger log = LoggerFactory.getLogger(UserDirectoryServiceStandaloneSectionsImpl.class); private UserManager userManager; public String getUserDisplayName(final String userUid) throws UnknownUserException { diff --git a/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/standalone/AuthnStandaloneImpl.java b/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/standalone/AuthnStandaloneImpl.java index 0136eb2e1c92..c3f6c681f6e1 100644 --- a/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/standalone/AuthnStandaloneImpl.java +++ b/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/standalone/AuthnStandaloneImpl.java @@ -26,15 +26,15 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.gradebook.facades.Authn; /** * An implementation of the Authn facade to support demos and UI tests. */ public class AuthnStandaloneImpl implements Authn { - private static Log log = LogFactory.getLog(AuthnStandaloneImpl.class); + private static Logger log = LoggerFactory.getLogger(AuthnStandaloneImpl.class); private static String USER_ID_PARAMETER = "userUid"; diff --git a/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/standalone/ContextManagementStandaloneImpl.java b/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/standalone/ContextManagementStandaloneImpl.java index c338b182989f..aa8a2a8ec3ba 100644 --- a/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/standalone/ContextManagementStandaloneImpl.java +++ b/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/standalone/ContextManagementStandaloneImpl.java @@ -27,15 +27,15 @@ import javax.servlet.ServletRequest; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.gradebook.facades.ContextManagement; /** * An implementation of the ContextManagement facade to support demos and UI tests. */ public class ContextManagementStandaloneImpl implements ContextManagement { - private static Log logger = LogFactory.getLog(ContextManagementStandaloneImpl.class); + private static Logger logger = LoggerFactory.getLogger(ContextManagementStandaloneImpl.class); private static final String GRADEBOOK_UID_PARAM = "gradebookUid"; diff --git a/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/standalone/EventTrackingServiceStandaloneImpl.java b/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/standalone/EventTrackingServiceStandaloneImpl.java index 387ae3d4cf90..0acfe21eb34d 100644 --- a/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/standalone/EventTrackingServiceStandaloneImpl.java +++ b/edu-services/gradebook-service/impl/src/java/org/sakaiproject/tool/gradebook/facades/standalone/EventTrackingServiceStandaloneImpl.java @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * Copyright (c) 2006, 2007, 2008 The Sakai Foundation, The MIT Corporation * * Licensed under the Educational Community License, Version 2.0 (the "License"); @@ -12,32 +12,32 @@ * 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.sakaiproject.tool.gradebook.facades.standalone; - -import org.sakaiproject.tool.gradebook.facades.EventTrackingService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Author:Louis Majanja - * Date: Feb 22, 2007 - * Time: 3:36:22 PM - * - * - * an implementation of the EventTrackingService facade for the standalalone gradebook - */ -public class EventTrackingServiceStandaloneImpl implements EventTrackingService { - - private static final Log log = LogFactory.getLog(EventTrackingServiceStandaloneImpl.class); - - /** - * - * @param message - * @param referenceObject - */ - public void postEvent(String message, String referenceObject) { - if(log.isDebugEnabled()) log.debug("action: "+message + " object reference:"+referenceObject); - } -} + ******************************************************************************/ + +package org.sakaiproject.tool.gradebook.facades.standalone; + +import org.sakaiproject.tool.gradebook.facades.EventTrackingService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Author:Louis Majanja + * Date: Feb 22, 2007 + * Time: 3:36:22 PM + * + * + * an implementation of the EventTrackingService facade for the standalalone gradebook + */ +public class EventTrackingServiceStandaloneImpl implements EventTrackingService { + + private static final Logger log = LoggerFactory.getLogger(EventTrackingServiceStandaloneImpl.class); + + /** + * + * @param message + * @param referenceObject + */ + public void postEvent(String message, String referenceObject) { + if(log.isDebugEnabled()) log.debug("action: "+message + " object reference:"+referenceObject); + } +} diff --git a/edu-services/scoring-service/impl/src/java/org/sakaiproject/scoringservice/impl/ScoringServiceImpl.java b/edu-services/scoring-service/impl/src/java/org/sakaiproject/scoringservice/impl/ScoringServiceImpl.java index 3eed55c3e8fc..fc826aab4912 100644 --- a/edu-services/scoring-service/impl/src/java/org/sakaiproject/scoringservice/impl/ScoringServiceImpl.java +++ b/edu-services/scoring-service/impl/src/java/org/sakaiproject/scoringservice/impl/ScoringServiceImpl.java @@ -1,7 +1,7 @@ package org.sakaiproject.scoringservice.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.scoringservice.api.ScoringAgent; import org.sakaiproject.scoringservice.api.ScoringComponent; import org.sakaiproject.scoringservice.api.ScoringService; @@ -18,7 +18,7 @@ public class ScoringServiceImpl implements ScoringService { private ArrayList sortedScoringAgents = new ArrayList(); private ScoringAgent defaultScoringAgent; - private static final Log log = LogFactory.getLog(ScoringServiceImpl.class); + private static final Logger log = LoggerFactory.getLogger(ScoringServiceImpl.class); public void init(){ } diff --git a/edu-services/sections-service/sections-impl/integration-support/src/java/org/sakaiproject/component/section/support/IntegrationSupportImpl.java b/edu-services/sections-service/sections-impl/integration-support/src/java/org/sakaiproject/component/section/support/IntegrationSupportImpl.java index 90ac8622d700..8ced72b3d366 100644 --- a/edu-services/sections-service/sections-impl/integration-support/src/java/org/sakaiproject/component/section/support/IntegrationSupportImpl.java +++ b/edu-services/sections-service/sections-impl/integration-support/src/java/org/sakaiproject/component/section/support/IntegrationSupportImpl.java @@ -30,8 +30,8 @@ import org.hibernate.Query; import org.hibernate.Session; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.CourseManager; import org.sakaiproject.section.api.SectionManager; import org.sakaiproject.section.api.coursemanagement.Course; @@ -50,7 +50,7 @@ * Provides integration support using the standalone hibernate implementation. */ public class IntegrationSupportImpl extends HibernateDaoSupport implements IntegrationSupport { - private static final Log log = LogFactory.getLog(IntegrationSupportImpl.class); + private static final Logger log = LoggerFactory.getLogger(IntegrationSupportImpl.class); private CourseManager courseManager; private SectionManager sectionManager; diff --git a/edu-services/sections-service/sections-impl/integration-support/src/java/org/sakaiproject/component/section/support/UserManagerHibernateImpl.java b/edu-services/sections-service/sections-impl/integration-support/src/java/org/sakaiproject/component/section/support/UserManagerHibernateImpl.java index fb6028af4930..e04c2eefa4b6 100644 --- a/edu-services/sections-service/sections-impl/integration-support/src/java/org/sakaiproject/component/section/support/UserManagerHibernateImpl.java +++ b/edu-services/sections-service/sections-impl/integration-support/src/java/org/sakaiproject/component/section/support/UserManagerHibernateImpl.java @@ -26,15 +26,15 @@ import org.hibernate.Query; import org.hibernate.Session; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.coursemanagement.User; import org.sakaiproject.component.section.UserImpl; import org.springframework.orm.hibernate3.HibernateCallback; import org.springframework.orm.hibernate3.support.HibernateDaoSupport; public class UserManagerHibernateImpl extends HibernateDaoSupport implements UserManager { - private static Log log = LogFactory.getLog(UserManagerHibernateImpl.class); + private static Logger log = LoggerFactory.getLogger(UserManagerHibernateImpl.class); public User createUser(final String userUid, final String displayName, final String sortName, final String displayId) { diff --git a/edu-services/sections-service/sections-impl/integration-support/src/test/org/sakaiproject/test/section/integration/IntegrationSupportTest.java b/edu-services/sections-service/sections-impl/integration-support/src/test/org/sakaiproject/test/section/integration/IntegrationSupportTest.java index b71957569b92..0f8e4013a1f1 100644 --- a/edu-services/sections-service/sections-impl/integration-support/src/test/org/sakaiproject/test/section/integration/IntegrationSupportTest.java +++ b/edu-services/sections-service/sections-impl/integration-support/src/test/org/sakaiproject/test/section/integration/IntegrationSupportTest.java @@ -23,8 +23,8 @@ import java.util.List; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.HibernateException; import org.hibernate.SQLQuery; import org.hibernate.Session; @@ -52,7 +52,7 @@ "classpath:org/sakaiproject/component/section/support/spring-integrationSupport.xml" }) public class IntegrationSupportTest extends AbstractJUnit4SpringContextTests { - private static final Log log = LogFactory.getLog(IntegrationSupportTest.class); + private static final Logger log = LoggerFactory.getLogger(IntegrationSupportTest.class); private static String SITE_1 = "site_1"; private static String USER_1 = "integration_user_1"; private static String USER_2 = "integration_user_2"; diff --git a/edu-services/sections-service/sections-impl/integration-test/src/java/org/sakaiproject/test/section/SectionAwarenessImplTest.java b/edu-services/sections-service/sections-impl/integration-test/src/java/org/sakaiproject/test/section/SectionAwarenessImplTest.java index c228faa8e0fb..cc7182b4a4cc 100644 --- a/edu-services/sections-service/sections-impl/integration-test/src/java/org/sakaiproject/test/section/SectionAwarenessImplTest.java +++ b/edu-services/sections-service/sections-impl/integration-test/src/java/org/sakaiproject/test/section/SectionAwarenessImplTest.java @@ -24,10 +24,10 @@ import junit.framework.Assert; -//import org.apache.commons.logging.Log; -//import org.apache.commons.logging.LogFactory; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +//import org.slf4j.Logger; +//import org.slf4j.LoggerFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.SectionAwareness; import org.sakaiproject.section.api.coursemanagement.CourseSection; import org.sakaiproject.section.api.coursemanagement.ParticipationRecord; @@ -41,7 +41,7 @@ import org.sakaiproject.user.api.UserEdit; public class SectionAwarenessImplTest extends SakaiTestBase { - private static final Log log = LogFactory.getLog(SectionAwarenessImplTest.class); + private static final Logger log = LoggerFactory.getLogger(SectionAwarenessImplTest.class); // Services private SectionAwareness sectionAwareness; diff --git a/edu-services/sections-service/sections-impl/integration-test/src/test/org/sakaiproject/test/section/SectionIntegrationTestSuite.java b/edu-services/sections-service/sections-impl/integration-test/src/test/org/sakaiproject/test/section/SectionIntegrationTestSuite.java index ba2798226df9..bc4399702b00 100644 --- a/edu-services/sections-service/sections-impl/integration-test/src/test/org/sakaiproject/test/section/SectionIntegrationTestSuite.java +++ b/edu-services/sections-service/sections-impl/integration-test/src/test/org/sakaiproject/test/section/SectionIntegrationTestSuite.java @@ -20,8 +20,8 @@ **********************************************************************************/ package org.sakaiproject.test.section; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.test.SakaiTestBase; import junit.extensions.TestSetup; @@ -30,7 +30,7 @@ public class SectionIntegrationTestSuite extends SakaiTestBase { - private static final Log log = LogFactory.getLog(SectionIntegrationTestSuite.class); + private static final Logger log = LoggerFactory.getLogger(SectionIntegrationTestSuite.class); /** * Runs only once for the entire TestSuite, so we can keep the same component manager diff --git a/edu-services/sections-service/sections-impl/sakai/impl/src/java/org/sakaiproject/component/section/sakai/CourseManagerImpl.java b/edu-services/sections-service/sections-impl/sakai/impl/src/java/org/sakaiproject/component/section/sakai/CourseManagerImpl.java index 861bdd6e822e..912f9e15db5a 100644 --- a/edu-services/sections-service/sections-impl/sakai/impl/src/java/org/sakaiproject/component/section/sakai/CourseManagerImpl.java +++ b/edu-services/sections-service/sections-impl/sakai/impl/src/java/org/sakaiproject/component/section/sakai/CourseManagerImpl.java @@ -20,8 +20,8 @@ **********************************************************************************/ package org.sakaiproject.component.section.sakai; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.CourseManager; import org.sakaiproject.section.api.coursemanagement.Course; import org.sakaiproject.section.api.coursemanagement.ParticipationRecord; @@ -40,7 +40,7 @@ */ public class CourseManagerImpl implements CourseManager { - private static final Log log = LogFactory.getLog(CourseManagerImpl.class); + private static final Logger log = LoggerFactory.getLogger(CourseManagerImpl.class); /** * @inheritDoc diff --git a/edu-services/sections-service/sections-impl/sakai/impl/src/java/org/sakaiproject/component/section/sakai/SectionAwarenessImpl.java b/edu-services/sections-service/sections-impl/sakai/impl/src/java/org/sakaiproject/component/section/sakai/SectionAwarenessImpl.java index f5d8765fbfb9..9326c22e4813 100644 --- a/edu-services/sections-service/sections-impl/sakai/impl/src/java/org/sakaiproject/component/section/sakai/SectionAwarenessImpl.java +++ b/edu-services/sections-service/sections-impl/sakai/impl/src/java/org/sakaiproject/component/section/sakai/SectionAwarenessImpl.java @@ -29,8 +29,8 @@ import java.util.Locale; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.SectionAwareness; import org.sakaiproject.section.api.coursemanagement.Course; import org.sakaiproject.section.api.coursemanagement.CourseSection; @@ -63,7 +63,7 @@ */ public class SectionAwarenessImpl implements SectionAwareness { - private static final Log log = LogFactory.getLog(SectionAwarenessImpl.class); + private static final Logger log = LoggerFactory.getLogger(SectionAwarenessImpl.class); // Sakai services protected SiteService siteService; diff --git a/edu-services/sections-service/sections-impl/sakai/impl/src/java/org/sakaiproject/component/section/sakai/SectionCmMetadataSynchronizer.java b/edu-services/sections-service/sections-impl/sakai/impl/src/java/org/sakaiproject/component/section/sakai/SectionCmMetadataSynchronizer.java index 544e44feee84..3393dd05f304 100644 --- a/edu-services/sections-service/sections-impl/sakai/impl/src/java/org/sakaiproject/component/section/sakai/SectionCmMetadataSynchronizer.java +++ b/edu-services/sections-service/sections-impl/sakai/impl/src/java/org/sakaiproject/component/section/sakai/SectionCmMetadataSynchronizer.java @@ -24,8 +24,8 @@ import java.util.Iterator; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; @@ -55,7 +55,7 @@ * */ public class SectionCmMetadataSynchronizer implements Job { - private static final Log log = LogFactory.getLog(SectionCmMetadataSynchronizer.class); + private static final Logger log = LoggerFactory.getLogger(SectionCmMetadataSynchronizer.class); public static final int PAGE_SIZE = 100; protected SiteService siteService; @@ -137,10 +137,8 @@ private void syncSite(Site site) { } try { siteService.save(site); - } catch (IdUnusedException e) { - log.error(e); - } catch (PermissionException e) { - log.error(e); + } catch (IdUnusedException | PermissionException e) { + log.error(e.getMessage(), e); } } diff --git a/edu-services/sections-service/sections-impl/sakai/impl/src/java/org/sakaiproject/component/section/sakai/SectionManagerImpl.java b/edu-services/sections-service/sections-impl/sakai/impl/src/java/org/sakaiproject/component/section/sakai/SectionManagerImpl.java index fc9a285bd3fe..79fc3edbdf2d 100644 --- a/edu-services/sections-service/sections-impl/sakai/impl/src/java/org/sakaiproject/component/section/sakai/SectionManagerImpl.java +++ b/edu-services/sections-service/sections-impl/sakai/impl/src/java/org/sakaiproject/component/section/sakai/SectionManagerImpl.java @@ -34,8 +34,8 @@ import java.util.Calendar; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.thread_local.api.ThreadLocalManager; import org.sakaiproject.tool.api.SessionManager; import org.sakaiproject.section.api.SectionAwareness; @@ -87,7 +87,7 @@ */ public abstract class SectionManagerImpl implements SectionManager, SiteAdvisor { - private static final Log log = LogFactory.getLog(SectionManagerImpl.class); + private static final Logger log = LoggerFactory.getLogger(SectionManagerImpl.class); // Sakai services set by method injection protected abstract SiteService siteService(); @@ -545,7 +545,7 @@ public List getSectionEnrollments(String sectionUuid) { try { studentRole = getSectionStudentRole(group); } catch (RoleConfigurationException rce) { - log.error(rce); + log.error(rce.getMessage()); return new ArrayList(); } diff --git a/edu-services/sections-service/sections-impl/sakai/model/src/java/org/sakaiproject/component/section/sakai/CourseImpl.java b/edu-services/sections-service/sections-impl/sakai/model/src/java/org/sakaiproject/component/section/sakai/CourseImpl.java index fc482d4b27d6..ce6ed1fe490b 100644 --- a/edu-services/sections-service/sections-impl/sakai/model/src/java/org/sakaiproject/component/section/sakai/CourseImpl.java +++ b/edu-services/sections-service/sections-impl/sakai/model/src/java/org/sakaiproject/component/section/sakai/CourseImpl.java @@ -23,14 +23,14 @@ import java.io.Serializable; import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.coursemanagement.Course; import org.sakaiproject.entity.api.ResourceProperties; import org.sakaiproject.site.api.Site; public class CourseImpl implements Course, Serializable { - private static final Log log = LogFactory.getLog(CourseImpl.class); + private static final Logger log = LoggerFactory.getLogger(CourseImpl.class); private static final long serialVersionUID = 1L; public static final String EXTERNALLY_MAINTAINED = "sections_externally_maintained"; diff --git a/edu-services/sections-service/sections-impl/sakai/model/src/java/org/sakaiproject/component/section/sakai/CourseSectionImpl.java b/edu-services/sections-service/sections-impl/sakai/model/src/java/org/sakaiproject/component/section/sakai/CourseSectionImpl.java index 42c83919be87..6cf285c2e999 100644 --- a/edu-services/sections-service/sections-impl/sakai/model/src/java/org/sakaiproject/component/section/sakai/CourseSectionImpl.java +++ b/edu-services/sections-service/sections-impl/sakai/model/src/java/org/sakaiproject/component/section/sakai/CourseSectionImpl.java @@ -34,8 +34,8 @@ import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.coursemanagement.Course; import org.sakaiproject.section.api.coursemanagement.CourseSection; import org.sakaiproject.section.api.coursemanagement.Meeting; @@ -49,7 +49,7 @@ public class CourseSectionImpl implements CourseSection, ComparableJosh Holtzman */ public class AssignmentGradeValidator implements Validator, Serializable { - private static Log logger = LogFactory.getLog(AssignmentGradeValidator.class); + private static Logger logger = LoggerFactory.getLogger(AssignmentGradeValidator.class); /** * @see javax.faces.validator.Validator#validate(javax.faces.context.FacesContext, diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/AssignmentPointsConverter.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/AssignmentPointsConverter.java index 9296dd5057a5..84680a745318 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/AssignmentPointsConverter.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/AssignmentPointsConverter.java @@ -25,8 +25,8 @@ import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.service.gradebook.shared.GradebookService; import org.sakaiproject.tool.gradebook.AbstractGradeRecord; @@ -44,7 +44,7 @@ * displayed in a special way with a tooltip "title" attribute. */ public class AssignmentPointsConverter extends PointsConverter { - private static final Log log = LogFactory.getLog(AssignmentPointsConverter.class); + private static final Logger log = LoggerFactory.getLogger(AssignmentPointsConverter.class); public String getAsString(FacesContext context, UIComponent component, Object value) { if (log.isDebugEnabled()) log.debug("getAsString(" + context + ", " + component + ", " + value + ")"); diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/CategoryPointsConverter.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/CategoryPointsConverter.java index f786195a7e80..ecd80e621157 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/CategoryPointsConverter.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/CategoryPointsConverter.java @@ -27,8 +27,8 @@ import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.service.gradebook.shared.GradebookService; import org.sakaiproject.tool.gradebook.AbstractGradeRecord; @@ -44,7 +44,7 @@ * displayed in a special way with a tooltip "title" attribute. */ public class CategoryPointsConverter extends PointsConverter { - private static final Log log = LogFactory.getLog(CategoryPointsConverter.class); + private static final Logger log = LoggerFactory.getLogger(CategoryPointsConverter.class); public String getAsString(FacesContext context, UIComponent component, Object value) { if (log.isDebugEnabled()) log.debug("getAsString(" + context + ", " + component + ", " + value + ")"); diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/ClassAvgConverter.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/ClassAvgConverter.java index 14d91b108dd4..041d6c42f7d4 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/ClassAvgConverter.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/ClassAvgConverter.java @@ -25,8 +25,8 @@ import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.gradebook.ui.AssignmentGradeRow; import org.sakaiproject.tool.gradebook.ui.GradebookBean; import org.sakaiproject.tool.gradebook.Assignment; @@ -47,7 +47,7 @@ * also changes based upon the grade entry method. */ public class ClassAvgConverter extends PointsConverter { - private static final Log log = LogFactory.getLog(ClassAvgConverter.class); + private static final Logger log = LoggerFactory.getLogger(ClassAvgConverter.class); private int averageDecimalPlaces = 0; diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/ClassAvgConverterBasicDisplay.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/ClassAvgConverterBasicDisplay.java index 829e6a3de483..9af5766dd401 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/ClassAvgConverterBasicDisplay.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/ClassAvgConverterBasicDisplay.java @@ -25,8 +25,8 @@ import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.gradebook.ui.AssignmentGradeRow; import org.sakaiproject.tool.gradebook.ui.GradebookBean; import org.sakaiproject.tool.gradebook.Assignment; @@ -42,7 +42,7 @@ * grade entry method for this gradebook. Truncates with 0 decimals or uses the config setting. */ public class ClassAvgConverterBasicDisplay extends PointsConverter { - private static final Log log = LogFactory.getLog(ClassAvgConverterBasicDisplay.class); + private static final Logger log = LoggerFactory.getLogger(ClassAvgConverterBasicDisplay.class); private int averageDecimalPlaces = 0; diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/DivMessageRenderer.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/DivMessageRenderer.java index cf06e5e965b7..a5ef22b41e54 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/DivMessageRenderer.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/DivMessageRenderer.java @@ -30,8 +30,8 @@ import javax.faces.component.UIMessage; import javax.faces.context.FacesContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Put the message in a "div" instead of a "span", allowing for much more @@ -39,7 +39,7 @@ */ public class DivMessageRenderer extends DivMessageRendererBase { - private static final Log logger = LogFactory.getLog(DivMessageRenderer.class); + private static final Logger logger = LoggerFactory.getLogger(DivMessageRenderer.class); public void encodeEnd(FacesContext context, UIComponent component) throws IOException { // Note our complete disregard for class cast and null exceptions.... diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/DivMessageRendererBase.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/DivMessageRendererBase.java index 412c81f9b117..199bccb786c3 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/DivMessageRendererBase.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/DivMessageRendererBase.java @@ -32,11 +32,11 @@ import javax.faces.context.ResponseWriter; import javax.faces.render.Renderer; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public abstract class DivMessageRendererBase extends Renderer { - private static final Log logger = LogFactory.getLog(DivMessageRendererBase.class); + private static final Logger logger = LoggerFactory.getLogger(DivMessageRendererBase.class); public static String INNER_TAG = "div"; diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/DivMessagesRenderer.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/DivMessagesRenderer.java index 71b9d4b2ce08..d66ca5db709b 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/DivMessagesRenderer.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/DivMessagesRenderer.java @@ -33,8 +33,8 @@ import javax.faces.component.UIMessages; import javax.faces.context.FacesContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.gradebook.ui.MessagingBean; /** @@ -75,7 +75,7 @@ * */ public class DivMessagesRenderer extends DivMessageRendererBase { - private static final Log logger = LogFactory.getLog(DivMessagesRenderer.class); + private static final Logger logger = LoggerFactory.getLogger(DivMessagesRenderer.class); diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/FacesPhaseListener.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/FacesPhaseListener.java index 5c158763885b..8106e312f018 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/FacesPhaseListener.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/FacesPhaseListener.java @@ -26,11 +26,11 @@ import javax.faces.event.PhaseId; import javax.faces.event.PhaseListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class FacesPhaseListener implements PhaseListener { - private static final Log logger = LogFactory.getLog(FacesPhaseListener.class); + private static final Logger logger = LoggerFactory.getLogger(FacesPhaseListener.class); public PhaseId getPhaseId() { return PhaseId.ANY_PHASE; diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/FacesUtil.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/FacesUtil.java index 83f0be0a6594..3deb538a9ceb 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/FacesUtil.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/FacesUtil.java @@ -37,8 +37,8 @@ import javax.faces.context.FacesContext; import javax.faces.event.FacesEvent; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.jsf.util.LocaleUtil; import org.sakaiproject.tool.gradebook.ui.MessagingBean; @@ -46,7 +46,7 @@ * A noninstantiable utility class, because every JSF project needs one. */ public class FacesUtil { - private static final Log logger = LogFactory.getLog(FacesUtil.class); + private static final Logger logger = LoggerFactory.getLogger(FacesUtil.class); /** * Before display, scores are rounded at this number of decimal diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/HtmlSortHeaderRenderer.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/HtmlSortHeaderRenderer.java index c931fef7c08e..a07ec6574253 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/HtmlSortHeaderRenderer.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/HtmlSortHeaderRenderer.java @@ -53,8 +53,8 @@ import javax.faces.context.ResponseWriter; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.myfaces.component.UserRoleUtils; import org.apache.myfaces.component.html.ext.HtmlDataTable; import org.apache.myfaces.custom.sortheader.HtmlCommandSortHeader; @@ -69,8 +69,7 @@ * @author Josh Holtzman */ public class HtmlSortHeaderRenderer extends HtmlLinkRendererBase { - private static final Log log = LogFactory - .getLog(HtmlSortHeaderRenderer.class); + private static final Logger log = LoggerFactory.getLogger(HtmlSortHeaderRenderer.class); public final static String CURRENT_SORT_STYLE = "currentSort"; public final static String NOT_CURRENT_SORT_STYLE = "notCurrentSort"; diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/NontrailingDoubleConverter.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/NontrailingDoubleConverter.java index 917c3c6922ac..61878e566483 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/NontrailingDoubleConverter.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/NontrailingDoubleConverter.java @@ -25,8 +25,8 @@ import javax.faces.context.FacesContext; import javax.faces.convert.NumberConverter; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.util.ResourceLoader; @@ -41,7 +41,7 @@ * values to Double values before passing them to the backing bean. */ public class NontrailingDoubleConverter extends NumberConverter { - private static final Log log = LogFactory.getLog(NontrailingDoubleConverter.class); + private static final Logger log = LoggerFactory.getLogger(NontrailingDoubleConverter.class); public NontrailingDoubleConverter() { setType("number"); diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/PercentageConverter.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/PercentageConverter.java index a8ecce0e3866..322befaaaeaa 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/PercentageConverter.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/PercentageConverter.java @@ -26,8 +26,8 @@ import javax.faces.context.FacesContext; import javax.faces.convert.NumberConverter; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.util.ResourceLoader; @@ -38,7 +38,7 @@ * decimal places, and then returns it as an integer percentage. */ public class PercentageConverter extends NumberConverter { - private static final Log log = LogFactory.getLog(PercentageConverter.class); + private static final Logger log = LoggerFactory.getLogger(PercentageConverter.class); public PercentageConverter() { setType("percent"); diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/PointsConverter.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/PointsConverter.java index d7fa1df773bf..573bd6ad4738 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/PointsConverter.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/PointsConverter.java @@ -26,8 +26,8 @@ import javax.faces.context.FacesContext; import javax.faces.convert.NumberConverter; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.util.ResourceLoader; @@ -38,7 +38,7 @@ * decimal places, and then returns it with a maximum of two decimal places. */ public class PointsConverter extends NumberConverter { - private static final Log log = LogFactory.getLog(PointsConverter.class); + private static final Logger log = LoggerFactory.getLogger(PointsConverter.class); public PointsConverter() { setType("number"); diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/PrecisePercentageConverter.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/PrecisePercentageConverter.java index 10d94a451906..a8e04317ca4a 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/PrecisePercentageConverter.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/PrecisePercentageConverter.java @@ -26,8 +26,8 @@ import javax.faces.context.FacesContext; import javax.faces.convert.NumberConverter; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.util.ResourceLoader; @@ -44,7 +44,7 @@ * */ public class PrecisePercentageConverter extends NumberConverter { - private static final Log log = LogFactory.getLog(PrecisePercentageConverter.class); + private static final Logger log = LoggerFactory.getLogger(PrecisePercentageConverter.class); public PrecisePercentageConverter() { setType("percent"); diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/ScoreConverter.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/ScoreConverter.java index 98d4a52e5608..ee921d3923cf 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/ScoreConverter.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/ScoreConverter.java @@ -25,8 +25,8 @@ import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.gradebook.ui.AssignmentGradeRow; import org.sakaiproject.tool.gradebook.Gradebook; import org.sakaiproject.service.gradebook.shared.GradebookService; @@ -37,7 +37,7 @@ * changes based upon the grade entry method. */ public class ScoreConverter extends PointsConverter { - private static final Log log = LogFactory.getLog(ScoreConverter.class); + private static final Logger log = LoggerFactory.getLogger(ScoreConverter.class); public String getAsString(FacesContext context, UIComponent component, Object value) { if (log.isDebugEnabled()) log.debug("getAsString(" + context + ", " + component + ", " + value + ")"); diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/TotalPointsConverter.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/TotalPointsConverter.java index 579b4d9ef5fb..eacb02f03061 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/TotalPointsConverter.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/TotalPointsConverter.java @@ -28,8 +28,8 @@ import javax.faces.context.FacesContext; import javax.faces.convert.NumberConverter; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.util.ResourceLoader; /** @@ -40,7 +40,7 @@ * Example: 10.0 -> 10, 10.50 -> 10.5 */ public class TotalPointsConverter extends NumberConverter { - private static final Log log = LogFactory.getLog(TotalPointsConverter.class); + private static final Logger log = LoggerFactory.getLogger(TotalPointsConverter.class); public TotalPointsConverter() { setType("number"); diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/dhtmlpopup/DhtmlPopupComponent.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/dhtmlpopup/DhtmlPopupComponent.java index 47db7ce7fac0..219e2de1da52 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/dhtmlpopup/DhtmlPopupComponent.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/dhtmlpopup/DhtmlPopupComponent.java @@ -31,8 +31,8 @@ import javax.faces.context.FacesContext; import javax.faces.context.ResponseWriter; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.gradebook.jsf.iterator.IteratorComponent; /* @@ -48,7 +48,7 @@ */ public class DhtmlPopupComponent extends IteratorComponent implements NamingContainer { - private static final Log log = LogFactory.getLog(DhtmlPopupComponent.class); + private static final Logger log = LoggerFactory.getLogger(DhtmlPopupComponent.class); public final static String COMPONENT_TYPE = "org.sakaiproject.tool.gradebook.jsf.dhtmlpopup"; diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/gradebookItemTable/GradebookItemTableRenderer.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/gradebookItemTable/GradebookItemTableRenderer.java index 894236817067..4f5118a17c0e 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/gradebookItemTable/GradebookItemTableRenderer.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/gradebookItemTable/GradebookItemTableRenderer.java @@ -14,8 +14,8 @@ import javax.faces.el.ValueBinding; import javax.faces.render.Renderer; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.myfaces.shared_impl.renderkit.html.HTML; import org.sakaiproject.tool.gradebook.jsf.FacesUtil; @@ -26,7 +26,7 @@ public class GradebookItemTableRenderer extends Renderer { - protected static final Log log = LogFactory.getLog(GradebookItemTableRenderer.class); + protected static final Logger log = LoggerFactory.getLogger(GradebookItemTableRenderer.class); private static final String CURSOR = "cursor:pointer"; private static final String EXPANDED_IMG = "/images/expand.gif"; diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/iterator/IteratorComponent.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/iterator/IteratorComponent.java index 42421680f56b..2f7bad4165a0 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/iterator/IteratorComponent.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/iterator/IteratorComponent.java @@ -33,8 +33,8 @@ import javax.faces.context.FacesContext; import javax.faces.el.ValueBinding; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * A simple looping component which encodes all its children for every record in @@ -46,7 +46,7 @@ */ public class IteratorComponent extends UIComponentBase implements NamingContainer { - private static final Log log = LogFactory.getLog(IteratorComponent.class); + private static final Logger log = LoggerFactory.getLogger(IteratorComponent.class); public final static String COMPONENT_TYPE = "org.sakaiproject.tool.gradebook.jsf.iterator"; public final static String COMPONENT_FAMILY = "javax.faces.Data"; diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/spreadsheetUI/SpreadsheetUITag.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/spreadsheetUI/SpreadsheetUITag.java index f0b8ea80df90..6a0d2264daff 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/spreadsheetUI/SpreadsheetUITag.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/jsf/spreadsheetUI/SpreadsheetUITag.java @@ -25,8 +25,8 @@ import javax.faces.context.ResponseWriter; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.myfaces.component.UserRoleUtils; import org.apache.myfaces.taglib.html.HtmlDataTableTag; import org.apache.myfaces.component.html.ext.HtmlDataTable; @@ -125,4 +125,4 @@ public void setValue(java.lang.String value) { public void setVar(java.lang.String _var) { this._var = _var; } -} \ No newline at end of file +} diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/AssignmentBean.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/AssignmentBean.java index 39f6defb5791..63ca4d4f8217 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/AssignmentBean.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/AssignmentBean.java @@ -38,8 +38,8 @@ import javax.faces.validator.ValidatorException; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.coursemanagement.EnrollmentRecord; import org.sakaiproject.section.api.facade.Role; import org.sakaiproject.service.gradebook.shared.ConflictingAssignmentNameException; @@ -54,7 +54,7 @@ import org.sakaiproject.service.gradebook.shared.GradebookService; public class AssignmentBean extends GradebookDependentBean implements Serializable { - private static final Log logger = LogFactory.getLog(AssignmentBean.class); + private static final Logger logger = LoggerFactory.getLogger(AssignmentBean.class); private Long assignmentId; private Assignment assignment; @@ -462,11 +462,11 @@ else if (getGradeEntryByLetter()) } } catch (ConflictingAssignmentNameException e) { - logger.error(e); + logger.error(e.getMessage()); FacesUtil.addErrorMessage(getLocalizedString("edit_assignment_name_conflict_failure")); return "failure"; } catch (StaleObjectModificationException e) { - logger.error(e); + logger.error(e.getMessage()); FacesUtil.addErrorMessage(getLocalizedString("edit_assignment_locking_failure")); return "failure"; } diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/AssignmentDetailsBean.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/AssignmentDetailsBean.java index 9e328bc56987..e263f40815ab 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/AssignmentDetailsBean.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/AssignmentDetailsBean.java @@ -34,8 +34,8 @@ import javax.faces.event.ActionEvent; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.coursemanagement.EnrollmentRecord; import org.sakaiproject.service.gradebook.shared.GradebookService; import org.sakaiproject.service.gradebook.shared.StaleObjectModificationException; @@ -51,7 +51,7 @@ import org.sakaiproject.tool.gradebook.jsf.FacesUtil; public class AssignmentDetailsBean extends EnrollmentTableBean { - private static final Log logger = LogFactory.getLog(AssignmentDetailsBean.class); + private static final Logger logger = LoggerFactory.getLogger(AssignmentDetailsBean.class); /** * The following variable keeps bean initialization from overwriting diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/ConfigurationBean.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/ConfigurationBean.java index 69183c497802..4634f9a83c4a 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/ConfigurationBean.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/ConfigurationBean.java @@ -25,8 +25,8 @@ import java.util.Map; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ServerConfigurationService; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; @@ -40,7 +40,7 @@ * there might be a more straightforward way to deliver this capability.) */ public class ConfigurationBean implements ApplicationContextAware{ - private static final Log log = LogFactory.getLog(ConfigurationBean.class); + private static final Logger log = LoggerFactory.getLogger(ConfigurationBean.class); private ApplicationContext applicationContext; diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/CourseGradeDetailsBean.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/CourseGradeDetailsBean.java index 72e450c794a2..656234d683a3 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/CourseGradeDetailsBean.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/CourseGradeDetailsBean.java @@ -41,8 +41,8 @@ import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.jsf.spreadsheet.SpreadsheetDataFileWriterCsv; import org.sakaiproject.jsf.spreadsheet.SpreadsheetDataFileWriterXls; @@ -61,7 +61,7 @@ import org.sakaiproject.tool.gradebook.jsf.FacesUtil; public class CourseGradeDetailsBean extends EnrollmentTableBean { - private static final Log logger = LogFactory.getLog(CourseGradeDetailsBean.class); + private static final Logger logger = LoggerFactory.getLogger(CourseGradeDetailsBean.class); // View maintenance fields - serializable. private List scoreRows; @@ -371,7 +371,7 @@ public void processUpdateGrades(ActionEvent event) { try { saveGrades(); } catch (StaleObjectModificationException e) { - logger.error(e); + logger.error(e.getMessage()); FacesUtil.addErrorMessage(getLocalizedString("course_grade_details_locking_failure")); } } @@ -383,7 +383,7 @@ public String processCalculateCourseGrades() { try { calculateCourseGrades(); } catch (StaleObjectModificationException e) { - logger.error(e); + logger.error(e.getMessage()); FacesUtil.addErrorMessage(getLocalizedString("course_grade_details_locking_failure")); } return "courseGradeDetails"; diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/CourseGradesToSpreadsheetConverterDefault.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/CourseGradesToSpreadsheetConverterDefault.java index a373ef1be333..a229fbe4f85d 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/CourseGradesToSpreadsheetConverterDefault.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/CourseGradesToSpreadsheetConverterDefault.java @@ -26,8 +26,8 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.coursemanagement.EnrollmentRecord; import org.sakaiproject.section.api.coursemanagement.User; import org.sakaiproject.tool.gradebook.CourseGrade; @@ -41,7 +41,7 @@ */ public class CourseGradesToSpreadsheetConverterDefault implements CourseGradesToSpreadsheetConverter { - private static final Log log = LogFactory.getLog(CourseGradesToSpreadsheetConverterDefault.class); + private static final Logger log = LoggerFactory.getLogger(CourseGradesToSpreadsheetConverterDefault.class); /* (non-Javadoc) * @see org.sakaiproject.tool.gradebook.CourseGradesConverter#getSpreadsheetData(java.util.List, org.sakaiproject.tool.gradebook.CourseGrade, java.util.Map) diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/CourseGradesToSpreadsheetCustomConverter.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/CourseGradesToSpreadsheetCustomConverter.java index b2fcd12f4b28..d4ccb383364d 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/CourseGradesToSpreadsheetCustomConverter.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/CourseGradesToSpreadsheetCustomConverter.java @@ -26,8 +26,8 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.section.api.coursemanagement.EnrollmentRecord; import org.sakaiproject.section.api.coursemanagement.User; @@ -43,7 +43,7 @@ */ public class CourseGradesToSpreadsheetCustomConverter implements CourseGradesToSpreadsheetConverter { - private static final Log log = LogFactory.getLog(CourseGradesToSpreadsheetCustomConverter.class); + private static final Logger log = LoggerFactory.getLogger(CourseGradesToSpreadsheetCustomConverter.class); /* diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/EnrollmentTableBean.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/EnrollmentTableBean.java index 93cb10b0b8bc..22945fbfbe7d 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/EnrollmentTableBean.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/EnrollmentTableBean.java @@ -43,8 +43,8 @@ import javax.faces.event.ValueChangeEvent; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.coursemanagement.CourseSection; import org.sakaiproject.section.api.coursemanagement.EnrollmentRecord; import org.sakaiproject.service.gradebook.shared.UnknownUserException; @@ -58,7 +58,7 @@ */ public abstract class EnrollmentTableBean extends GradebookDependentBean implements Paging, Serializable { - private static final Log log = LogFactory.getLog(EnrollmentTableBean.class); + private static final Logger log = LoggerFactory.getLogger(EnrollmentTableBean.class); /** * A comparator that sorts enrollments by student sortName diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/EntryServlet.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/EntryServlet.java index 1f5c7d95c03f..5f3ffdb76bae 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/EntryServlet.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/EntryServlet.java @@ -34,8 +34,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.WebApplicationContextUtils; @@ -48,7 +48,7 @@ * Redirects the request to the role-appropriate initial view of the gradebook. */ public class EntryServlet extends HttpServlet { - private static final Log logger = LogFactory.getLog(EntryServlet.class); + private static final Logger logger = LoggerFactory.getLogger(EntryServlet.class); public static final String INIT_SECRET = "org.apache.myfaces.secret"; public static final String GENERATE_RANDOM_SECRET = "GENERATE_RANDOM_SECRET"; @@ -110,7 +110,7 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) { response.sendRedirect(path.toString()); } } catch (IOException ioe) { - logger.fatal("Could not redirect user: " + ioe); + logger.error("Could not redirect user: {}", ioe.getMessage(), ioe); } } diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/FeedbackOptionsBean.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/FeedbackOptionsBean.java index 7f7c6b473a88..40d7cfda565f 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/FeedbackOptionsBean.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/FeedbackOptionsBean.java @@ -32,8 +32,8 @@ import javax.faces.event.ActionEvent; import javax.faces.model.SelectItem; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.service.gradebook.shared.StaleObjectModificationException; import org.sakaiproject.tool.gradebook.GradeMapping; import org.sakaiproject.tool.gradebook.Gradebook; @@ -45,7 +45,7 @@ * grade-to-percentage mappings for the gradebook. */ public class FeedbackOptionsBean extends GradebookDependentBean implements Serializable { - private static final Log log = LogFactory.getLog(FeedbackOptionsBean.class); + private static final Logger log = LoggerFactory.getLogger(FeedbackOptionsBean.class); // View maintenance fields - serializable. @@ -204,7 +204,7 @@ public String save() { FacesUtil.addErrorMessage(getLocalizedString("feedback_options_illegal_change", new String[] {localGradebook.getSelectedGradeMapping().getName()})); return null; } catch (StaleObjectModificationException e) { - log.error(e); + log.error(e.getMessage()); FacesUtil.addErrorMessage(getLocalizedString("feedback_options_locking_failure")); return null; } diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/GradebookBean.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/GradebookBean.java index 8a6e02aa8513..f5f898924eae 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/GradebookBean.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/GradebookBean.java @@ -27,8 +27,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.SectionAwareness; @@ -49,7 +49,7 @@ * configuration of and access to those services. */ public class GradebookBean extends InitializableBean { - private static final Log logger = LogFactory.getLog(GradebookBean.class); + private static final Logger logger = LoggerFactory.getLogger(GradebookBean.class); private Long gradebookId; private String gradebookUid; diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/GradebookSetupBean.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/GradebookSetupBean.java index a277826b435c..11d9afbb7e2b 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/GradebookSetupBean.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/GradebookSetupBean.java @@ -34,8 +34,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ValueChangeEvent; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.gradebook.Assignment; import org.sakaiproject.tool.gradebook.Category; @@ -51,7 +51,7 @@ public class GradebookSetupBean extends GradebookDependentBean implements Serializable { - private static final Log logger = LogFactory.getLog(GradebookSetupBean.class); + private static final Logger logger = LoggerFactory.getLogger(GradebookSetupBean.class); private String gradeEntryMethod; private String categorySetting; @@ -679,7 +679,7 @@ else if (categorySetting.equals(CATEGORY_OPT_CAT_AND_WEIGHT)) return "failure"; } catch (StaleObjectModificationException e) { - logger.error(e); + logger.error(e.getMessage()); FacesUtil.addErrorMessage(getLocalizedString("cat_locking_failure")); return "failure"; } diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/GraderRulesBean.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/GraderRulesBean.java index cab82be546ff..6c037290772c 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/GraderRulesBean.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/GraderRulesBean.java @@ -34,8 +34,8 @@ import javax.faces.model.SelectItem; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.gradebook.Category; import org.sakaiproject.tool.gradebook.jsf.FacesUtil; import org.sakaiproject.tool.gradebook.Permission; @@ -49,7 +49,7 @@ public class GraderRulesBean extends GradebookDependentBean implements Serializable { - private static final Log logger = LogFactory.getLog(GraderRulesBean.class); + private static final Logger logger = LoggerFactory.getLogger(GraderRulesBean.class); private List graderList; private String selectedGraderId; diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/InitializableBean.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/InitializableBean.java index 24bb2e631010..8166b859bbf3 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/InitializableBean.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/InitializableBean.java @@ -22,12 +22,12 @@ package org.sakaiproject.tool.gradebook.ui; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.jsf.model.PhaseAware; public abstract class InitializableBean implements PhaseAware { - private static final Log logger = LogFactory.getLog(InitializableBean.class); + private static final Logger logger = LoggerFactory.getLogger(InitializableBean.class); private transient boolean notValidated; diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/InstructorViewBean.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/InstructorViewBean.java index 68e8f1130841..e28092db50ec 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/InstructorViewBean.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/InstructorViewBean.java @@ -27,8 +27,8 @@ import javax.faces.event.ActionEvent; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.coursemanagement.EnrollmentRecord; import org.sakaiproject.service.gradebook.shared.StaleObjectModificationException; @@ -46,7 +46,7 @@ * Provides data for the instructor's view of a student's grades in the gradebook. */ public class InstructorViewBean extends ViewByStudentBean implements Serializable { - private static Log logger = LogFactory.getLog(InstructorViewBean.class); + private static Logger logger = LoggerFactory.getLogger(InstructorViewBean.class); private EnrollmentRecord previousStudent; private EnrollmentRecord nextStudent; diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/OverviewBean.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/OverviewBean.java index 957e128441d2..b0ebf2e154e7 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/OverviewBean.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/OverviewBean.java @@ -36,8 +36,8 @@ import javax.faces.context.FacesContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.service.gradebook.shared.GradebookService; import org.sakaiproject.tool.api.ToolSession; @@ -53,7 +53,7 @@ * Backing bean for the visible list of assignments in the gradebook. */ public class OverviewBean extends GradebookDependentBean implements Serializable { - private static final Log logger = LogFactory.getLog(OverviewBean.class); + private static final Logger logger = LoggerFactory.getLogger(OverviewBean.class); private static final Map columnSortMap; diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/RemoveAssignmentBean.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/RemoveAssignmentBean.java index 0727258366e0..593d4b23b3c3 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/RemoveAssignmentBean.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/RemoveAssignmentBean.java @@ -24,8 +24,8 @@ import java.io.Serializable; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.service.gradebook.shared.StaleObjectModificationException; import org.sakaiproject.tool.gradebook.Assignment; import org.sakaiproject.tool.gradebook.jsf.FacesUtil; @@ -36,7 +36,7 @@ * @author Josh Holtzman */ public class RemoveAssignmentBean extends GradebookDependentBean implements Serializable { - private static final Log logger = LogFactory.getLog(RemoveAssignmentBean.class); + private static final Logger logger = LoggerFactory.getLogger(RemoveAssignmentBean.class); // View maintenance fields - serializable. private Long assignmentId; diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/RoleFilter.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/RoleFilter.java index 0eed7717f86c..7ab13628176b 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/RoleFilter.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/RoleFilter.java @@ -33,8 +33,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.gradebook.facades.Authn; import org.sakaiproject.tool.gradebook.facades.Authz; import org.sakaiproject.tool.gradebook.facades.ContextManagement; @@ -63,7 +63,7 @@ * other URLs (e.g., "/test/login.jsf") pass through. */ public class RoleFilter implements Filter { - private static Log logger = LogFactory.getLog(RoleFilter.class); + private static Logger logger = LoggerFactory.getLogger(RoleFilter.class); private String authnServiceBeanName; private String authzServiceBeanName; diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/RosterBean.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/RosterBean.java index 7b28a97d56ba..5e92aa23ac0e 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/RosterBean.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/RosterBean.java @@ -48,8 +48,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ValueChangeEvent; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.myfaces.component.html.ext.HtmlDataTable; import org.apache.myfaces.custom.sortheader.HtmlCommandSortHeader; import org.sakaiproject.jsf.spreadsheet.SpreadsheetDataFileWriterCsv; @@ -79,7 +79,7 @@ * Backing bean for the visible list of assignments in the gradebook. */ public class RosterBean extends EnrollmentTableBean implements Serializable, Paging { - private static final Log logger = LogFactory.getLog(RosterBean.class); + private static final Logger logger = LoggerFactory.getLogger(RosterBean.class); // Used to generate IDs for the dynamically created assignment columns. private static final String ASSIGNMENT_COLUMN_PREFIX = "asg_"; diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/SpreadsheetRemoveBean.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/SpreadsheetRemoveBean.java index 78b7abc3145c..0a05508f2dcd 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/SpreadsheetRemoveBean.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/SpreadsheetRemoveBean.java @@ -19,8 +19,8 @@ import org.sakaiproject.tool.gradebook.Spreadsheet; import org.sakaiproject.tool.gradebook.jsf.FacesUtil; import org.sakaiproject.service.gradebook.shared.StaleObjectModificationException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.Serializable; @@ -31,7 +31,7 @@ */ public class SpreadsheetRemoveBean extends GradebookDependentBean implements Serializable { - private static final Log logger = LogFactory.getLog(SpreadsheetRemoveBean.class); + private static final Logger logger = LoggerFactory.getLogger(SpreadsheetRemoveBean.class); private Long spreadsheetId; private boolean removeConfirmed; diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/SpreadsheetUploadBean.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/SpreadsheetUploadBean.java index faf579e20d49..fd1618e399da 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/SpreadsheetUploadBean.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/SpreadsheetUploadBean.java @@ -42,8 +42,8 @@ import javax.faces.model.SelectItem; import javax.servlet.http.HttpServletRequest; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.myfaces.custom.fileupload.UploadedFile; import org.apache.poi.hssf.OldExcelFormatException; import org.apache.poi.hssf.usermodel.HSSFCell; @@ -89,7 +89,7 @@ public class SpreadsheetUploadBean extends GradebookDependentBean implements Ser private UploadedFile upFile; private String pickedFileReference; private String pickedFileDesc; - private static final Log logger = LogFactory.getLog(SpreadsheetUploadBean.class); + private static final Logger logger = LoggerFactory.getLogger(SpreadsheetUploadBean.class); private Spreadsheet spreadsheet; private Map rosterMap; private List assignmentList; @@ -1149,7 +1149,7 @@ public String saveFile(){ try{ getGradebookManager().createSpreadsheet(getGradebookId(),spreadsheet.getTitle(),this.getUserDirectoryService().getUserDisplayName(getUserUid()),new Date(),sb.toString()); }catch(ConflictingSpreadsheetNameException e){ - if(logger.isDebugEnabled())logger.debug(e); + logger.debug(e.getMessage()); FacesUtil.addErrorMessage(getLocalizedString("upload_preview_save_failure")); return null; } @@ -1208,7 +1208,7 @@ public String importData(){ points = ""; } }catch(NumberFormatException e){ - if(logger.isDebugEnabled())logger.debug(e); + logger.debug(e.getMessage()); points = ""; } if(logger.isDebugEnabled())logger.debug("user "+user + " userid " + userid +" points "+points); @@ -1837,11 +1837,11 @@ public String saveGrades(){ AssignmentGradeRecord asnGradeRecord = new AssignmentGradeRecord(assignment,uid,scoreAsDouble); asnGradeRecord.setPercentEarned(scoreAsDouble); // in case gb entry by % - sorted out in manager gradeRecords.add(asnGradeRecord); - if(logger.isDebugEnabled())logger.debug("added grades for " + uid + " - score " + scoreAsString); + logger.debug("added grades for {} - score {}", uid, scoreAsString); } catch (ParseException pe) { // the score should have already been validated at this point, so // there is something wrong - logger.error("ParseException encountered while parsing value: " + scoreAsString + " Score was not updated."); + logger.error("ParseException encountered while parsing value: {} Score was not updated.", scoreAsString); } } else if (getGradeEntryByLetter()) { AssignmentGradeRecord asnGradeRecord = new AssignmentGradeRecord(assignment,uid,null); @@ -1858,7 +1858,7 @@ public String saveGrades(){ return "spreadsheetListing"; } catch (ConflictingAssignmentNameException e) { - if(logger.isErrorEnabled())logger.error(e); + logger.error(e.getMessage()); FacesUtil.addErrorMessage(getLocalizedString("add_assignment_name_conflict_failure")); } @@ -2505,7 +2505,7 @@ private InputStream getPickedFileStream(ContentResource resource) { inStream = resource.streamContent(); } catch(ServerOverloadException soe) { - logger.error(soe.getStackTrace()); + logger.error(soe.getMessage(), soe); } } diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/StudentViewBean.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/StudentViewBean.java index 3545f031eecd..0c5459c5b577 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/StudentViewBean.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/StudentViewBean.java @@ -18,8 +18,8 @@ import java.io.Serializable; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.event.api.EventTrackingService; @@ -30,7 +30,7 @@ * @author Josh Holtzman */ public class StudentViewBean extends ViewByStudentBean implements Serializable { - private static Log logger = LogFactory.getLog(StudentViewBean.class); + private static Logger logger = LoggerFactory.getLogger(StudentViewBean.class); private String studentUidToView; private String instViewReturnToPage; diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/ViewByStudentBean.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/ViewByStudentBean.java index 6103f8a5ab49..1a772eaa84e2 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/ViewByStudentBean.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/ViewByStudentBean.java @@ -30,8 +30,8 @@ import java.util.Map; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.service.gradebook.shared.GradebookService; import org.sakaiproject.service.gradebook.shared.GradebookExternalAssessmentService; import org.sakaiproject.service.gradebook.shared.StaleObjectModificationException; @@ -55,7 +55,7 @@ * */ public class ViewByStudentBean extends EnrollmentTableBean implements Serializable { - private static Log logger = LogFactory.getLog(ViewByStudentBean.class); + private static Logger logger = LoggerFactory.getLogger(ViewByStudentBean.class); // View maintenance fields - serializable. private String userDisplayName; diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/standalone/AuthnFilter.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/standalone/AuthnFilter.java index 3a29154af200..f9d78df8c53f 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/standalone/AuthnFilter.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/standalone/AuthnFilter.java @@ -34,8 +34,8 @@ import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.gradebook.facades.Authn; import org.springframework.web.context.support.WebApplicationContextUtils; @@ -43,7 +43,7 @@ * An authentication filter for standalone use in demos and UI tests. */ public class AuthnFilter implements Filter { - private static Log logger = LogFactory.getLog(AuthnFilter.class); + private static Logger logger = LoggerFactory.getLogger(AuthnFilter.class); private String authnRedirect; private String authnServiceBean; diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/standalone/FrameworkManagerSectionsImpl.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/standalone/FrameworkManagerSectionsImpl.java index 095e7f7f17d2..5199c445d776 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/standalone/FrameworkManagerSectionsImpl.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/standalone/FrameworkManagerSectionsImpl.java @@ -26,8 +26,8 @@ import java.util.Iterator; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.coursemanagement.Course; import org.sakaiproject.section.api.coursemanagement.ParticipationRecord; import org.sakaiproject.component.section.support.IntegrationSupport; @@ -36,7 +36,7 @@ import org.sakaiproject.tool.gradebook.business.GradebookManager; public class FrameworkManagerSectionsImpl implements FrameworkManager { - private static Log log = LogFactory.getLog(FrameworkManagerSectionsImpl.class); + private static Logger log = LoggerFactory.getLogger(FrameworkManagerSectionsImpl.class); private IntegrationSupport integrationSupport; private GradebookManager gradebookManager; @@ -73,4 +73,4 @@ public void setGradebookManager(GradebookManager gradebookManager) { this.gradebookManager = gradebookManager; } -} \ No newline at end of file +} diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/standalone/SelectGradebookBean.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/standalone/SelectGradebookBean.java index 773a47d6d702..9ac5a09e8497 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/standalone/SelectGradebookBean.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/standalone/SelectGradebookBean.java @@ -28,14 +28,14 @@ import java.util.Iterator; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.gradebook.Gradebook; import org.sakaiproject.tool.gradebook.facades.Authn; import org.sakaiproject.tool.gradebook.ui.InitializableBean; public class SelectGradebookBean extends InitializableBean { - private static final Log logger = LogFactory.getLog(SelectGradebookBean.class); + private static final Logger logger = LoggerFactory.getLogger(SelectGradebookBean.class); private Authn authnService; private FrameworkManager frameworkManager; diff --git a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/test/LoginAsBean.java b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/test/LoginAsBean.java index 6c552ba37922..0736c7e913ca 100644 --- a/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/test/LoginAsBean.java +++ b/gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/test/LoginAsBean.java @@ -27,12 +27,12 @@ import java.util.ArrayList; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.gradebook.ui.InitializableBean; public class LoginAsBean extends InitializableBean { - private static final Log logger = LogFactory.getLog(LoginAsBean.class); + private static final Logger logger = LoggerFactory.getLogger(LoginAsBean.class); private List loginChoices; diff --git a/gradebook/grades-rest/src/main/java/org/sakaiproject/gradebook/logic/ExternalLogic.java b/gradebook/grades-rest/src/main/java/org/sakaiproject/gradebook/logic/ExternalLogic.java index caa560cf65c8..d77e100f9c51 100644 --- a/gradebook/grades-rest/src/main/java/org/sakaiproject/gradebook/logic/ExternalLogic.java +++ b/gradebook/grades-rest/src/main/java/org/sakaiproject/gradebook/logic/ExternalLogic.java @@ -23,8 +23,8 @@ import java.util.concurrent.ConcurrentHashMap; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroupService; import org.sakaiproject.authz.api.Member; import org.sakaiproject.authz.api.SecurityService; @@ -71,7 +71,7 @@ public class ExternalLogic { public String serverId = "UNKNOWN_SERVER_ID"; public final static String NO_LOCATION = "noLocationAvailable"; - private final static Log log = LogFactory.getLog(ExternalLogic.class); + private final static Logger log = LoggerFactory.getLogger(ExternalLogic.class); protected AuthzGroupService authzGroupService; public void setAuthzGroupService(AuthzGroupService authzGroupService) { diff --git a/help/help-component/src/java/org/sakaiproject/component/app/help/DefaultGlossary.java b/help/help-component/src/java/org/sakaiproject/component/app/help/DefaultGlossary.java index 8ac135f1e86a..8cea069f33a7 100644 --- a/help/help-component/src/java/org/sakaiproject/component/app/help/DefaultGlossary.java +++ b/help/help-component/src/java/org/sakaiproject/component/app/help/DefaultGlossary.java @@ -28,8 +28,8 @@ import java.util.Properties; import java.util.TreeMap; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.help.Glossary; import org.sakaiproject.api.app.help.GlossaryEntry; import org.sakaiproject.component.app.help.model.GlossaryEntryBean; @@ -45,7 +45,7 @@ public class DefaultGlossary implements Glossary private String url; private Map glossary = new TreeMap(); private boolean initialized = false; - protected final Log logger = LogFactory.getLog(getClass()); + protected final Logger logger = LoggerFactory.getLogger(getClass()); /** * initialize glossary @@ -67,7 +67,7 @@ protected void init() } catch (IOException e) { - logger.error(e); + logger.error(e.getMessage()); } } diff --git a/help/help-component/src/java/org/sakaiproject/component/app/help/HelpManagerImpl.java b/help/help-component/src/java/org/sakaiproject/component/app/help/HelpManagerImpl.java index 3454b3a0df8f..1a34ab704ec4 100644 --- a/help/help-component/src/java/org/sakaiproject/component/app/help/HelpManagerImpl.java +++ b/help/help-component/src/java/org/sakaiproject/component/app/help/HelpManagerImpl.java @@ -51,8 +51,8 @@ import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.document.Document; @@ -158,7 +158,7 @@ public class HelpManagerImpl extends HibernateDaoSupport implements HelpManager private ToolManager toolManager; private HibernateTransactionManager txManager; - private static final Log LOG = LogFactory.getLog(HelpManagerImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(HelpManagerImpl.class); /** * @see org.sakaiproject.api.app.help.HelpManager#getServerConfigurationService() @@ -344,7 +344,7 @@ public Map getResourcesForActiveContexts(Map session) } catch (Exception e) { - LOG.error(e); + LOG.error(e.getMessage()); } } return resourceMap; @@ -434,7 +434,7 @@ protected Set searchResources(Query query) } catch (Exception e) { - LOG.error(e); + LOG.error(e.getMessage()); } finally { diff --git a/help/help-component/src/java/org/sakaiproject/component/app/help/RestConfigurationImpl.java b/help/help-component/src/java/org/sakaiproject/component/app/help/RestConfigurationImpl.java index 77b1a5a8f10b..b2fe4444ad59 100644 --- a/help/help-component/src/java/org/sakaiproject/component/app/help/RestConfigurationImpl.java +++ b/help/help-component/src/java/org/sakaiproject/component/app/help/RestConfigurationImpl.java @@ -32,8 +32,8 @@ import javax.xml.parsers.DocumentBuilderFactory; import org.apache.commons.codec.binary.Base64; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.help.RestConfiguration; import org.w3c.dom.Node; import org.w3c.dom.NodeList; @@ -60,7 +60,7 @@ public class RestConfigurationImpl implements RestConfiguration private static String REST_DOMAIN_URL; private static String REST_CORPUS_URL; - private final static Log LOG = LogFactory.getLog(RestConfigurationImpl.class); + private final static Logger LOG = LoggerFactory.getLogger(RestConfigurationImpl.class); /** * @see org.sakaiproject.api.app.help.RestConfiguration#getOrganization() diff --git a/help/help-component/src/java/org/sakaiproject/component/app/help/TutorialEntityProviderImpl.java b/help/help-component/src/java/org/sakaiproject/component/app/help/TutorialEntityProviderImpl.java index aaa24971075f..2accc6c05989 100644 --- a/help/help-component/src/java/org/sakaiproject/component/app/help/TutorialEntityProviderImpl.java +++ b/help/help-component/src/java/org/sakaiproject/component/app/help/TutorialEntityProviderImpl.java @@ -8,8 +8,8 @@ import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.configuration.PropertiesConfiguration; import org.apache.commons.configuration.reloading.InvariantReloadingStrategy; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.help.TutorialEntityProvider; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.entitybroker.EntityReference; @@ -22,7 +22,7 @@ public class TutorialEntityProviderImpl implements TutorialEntityProvider, AutoRegisterEntityProvider, RESTful{ - protected final Log log = LogFactory.getLog(getClass()); + protected final Logger log = LoggerFactory.getLogger(getClass()); private ResourceLoader msgs = new ResourceLoader("TutorialMessages"); private static PropertiesConfiguration tutorialProps; diff --git a/help/help-tool/src/java/org/sakaiproject/tool/help/ContentServlet.java b/help/help-tool/src/java/org/sakaiproject/tool/help/ContentServlet.java index 1d3ac2d5b45d..1c5beb87f2f3 100644 --- a/help/help-tool/src/java/org/sakaiproject/tool/help/ContentServlet.java +++ b/help/help-tool/src/java/org/sakaiproject/tool/help/ContentServlet.java @@ -34,8 +34,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.help.HelpManager; import org.sakaiproject.component.api.ServerConfigurationService; @@ -55,7 +55,7 @@ public class ContentServlet extends HttpServlet private static final long serialVersionUID = 1L; /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(ContentServlet.class); + private static Logger M_log = LoggerFactory.getLogger(ContentServlet.class); private static final String DOC_ID = "docId"; diff --git a/help/help-tool/src/java/org/sakaiproject/tool/help/HelpJsfTool.java b/help/help-tool/src/java/org/sakaiproject/tool/help/HelpJsfTool.java index d02810e65cab..82134a818239 100644 --- a/help/help-tool/src/java/org/sakaiproject/tool/help/HelpJsfTool.java +++ b/help/help-tool/src/java/org/sakaiproject/tool/help/HelpJsfTool.java @@ -29,8 +29,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.jsf.util.JsfTool; import org.sakaiproject.util.Web; @@ -47,7 +47,7 @@ public class HelpJsfTool extends JsfTool { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(HelpJsfTool.class); + private static Logger M_log = LoggerFactory.getLogger(HelpJsfTool.class); private static String HELP_DOC_REGEXP = org.sakaiproject.api.app.help.HelpManager.HELP_DOC_REGEXP; diff --git a/help/help-tool/src/java/org/sakaiproject/tool/help/QuestionTool.java b/help/help-tool/src/java/org/sakaiproject/tool/help/QuestionTool.java index c3925121f257..1ebe4f510a4a 100644 --- a/help/help-tool/src/java/org/sakaiproject/tool/help/QuestionTool.java +++ b/help/help-tool/src/java/org/sakaiproject/tool/help/QuestionTool.java @@ -21,7 +21,8 @@ package org.sakaiproject.tool.help; -import org.apache.commons.logging.Log; +import lombok.extern.slf4j.Slf4j; +import org.slf4j.Logger; import org.sakaiproject.api.app.help.HelpManager; import org.sakaiproject.component.cover.ServerConfigurationService; @@ -33,6 +34,7 @@ * question tool * @version $Id$ */ +@Slf4j public class QuestionTool { @@ -45,7 +47,6 @@ public class QuestionTool private String toEmailAddress; private EmailService emailService; - private Log logger; private HelpManager helpManager; /** @@ -280,10 +281,7 @@ private void sendEmail() } catch (Exception e) { - logger - .error( - "email service is not set up correctly, can't send user question to support consultant!", - e); + log.error("email service is not set up correctly, can't send user question to support consultant!", e); } } @@ -304,22 +302,4 @@ public void setContent(String content) { this.content = content; } - - /** - * get logger - * @return Returns the logger. - */ - public Log getLogger() - { - return logger; - } - - /** - * set logger - * @param logger The logger to set. - */ - public void setLogger(Log logger) - { - this.logger = logger; - } -} \ No newline at end of file +} diff --git a/help/help-tool/src/java/org/sakaiproject/tool/help/RestContentProvider.java b/help/help-tool/src/java/org/sakaiproject/tool/help/RestContentProvider.java index ae0316f6be24..da96f5a994e7 100644 --- a/help/help-tool/src/java/org/sakaiproject/tool/help/RestContentProvider.java +++ b/help/help-tool/src/java/org/sakaiproject/tool/help/RestContentProvider.java @@ -46,8 +46,8 @@ import javax.xml.transform.stream.StreamResult; import org.apache.commons.codec.binary.Base64; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.help.HelpManager; import org.sakaiproject.api.app.help.Resource; import org.sakaiproject.component.cover.ServerConfigurationService; @@ -73,8 +73,7 @@ public class RestContentProvider private static Document xslDocumentPreprocess; private static Document xslDocumentAllInOne; - private static final Log LOG = LogFactory - .getLog(RestContentProvider.class); + private static final Logger LOG = LoggerFactory.getLogger(RestContentProvider.class); /** * @param htmlDocument @@ -141,7 +140,7 @@ private static String serializeDocument(Document document) tf = TransformerFactory.newInstance().newTransformer(); tf.transform(xmlSource, outputTarget); } catch (TransformerException e) { - LOG.warn(e); + LOG.warn(e.getMessage()); } return out.toString(); } diff --git a/help/help-tool/src/java/org/sakaiproject/tool/help/TableOfContentsTool.java b/help/help-tool/src/java/org/sakaiproject/tool/help/TableOfContentsTool.java index 0220d5df4941..64653acb39c8 100644 --- a/help/help-tool/src/java/org/sakaiproject/tool/help/TableOfContentsTool.java +++ b/help/help-tool/src/java/org/sakaiproject/tool/help/TableOfContentsTool.java @@ -24,8 +24,8 @@ import javax.faces.context.FacesContext; import javax.servlet.http.HttpServletRequest; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.help.HelpManager; import org.sakaiproject.api.app.help.TableOfContents; @@ -41,7 +41,7 @@ public class TableOfContentsTool private HelpManager helpManager; private String baseUrl = null; - private static final Log LOG = LogFactory.getLog(TableOfContentsTool.class); + private static final Logger LOG = LoggerFactory.getLogger(TableOfContentsTool.class); /** * get table of contents @@ -102,4 +102,4 @@ private String getBaseUrl() return baseUrl; } -} \ No newline at end of file +} diff --git a/hierarchy/impl/src/java/org/sakaiproject/hierarchy/dao/HierarchyDaoImpl.java b/hierarchy/impl/src/java/org/sakaiproject/hierarchy/dao/HierarchyDaoImpl.java index f9c93ef888c8..6e76cd51aeb3 100644 --- a/hierarchy/impl/src/java/org/sakaiproject/hierarchy/dao/HierarchyDaoImpl.java +++ b/hierarchy/impl/src/java/org/sakaiproject/hierarchy/dao/HierarchyDaoImpl.java @@ -1,50 +1,50 @@ -/* -* Licensed to The Apereo Foundation under one or more contributor license -* agreements. See the NOTICE file distributed with this work for -* additional information regarding copyright ownership. -* -* The Apereo Foundation licenses this file to you 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: -* -* http://opensource.org/licenses/ecl2.txt -* -* 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.sakaiproject.hierarchy.dao; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.sakaiproject.genericdao.api.search.Restriction; -import org.sakaiproject.genericdao.api.search.Search; -import org.sakaiproject.genericdao.hibernate.HibernateGeneralGenericDao; - -import org.sakaiproject.hierarchy.dao.model.HierarchyNodeMetaData; - -/** - * Implementation of DAO - * - * @author Aaron Zeckoski (aaronz@vt.edu) - */ -public class HierarchyDaoImpl extends HibernateGeneralGenericDao implements HierarchyDao { - - private static Log log = LogFactory.getLog(HierarchyDaoImpl.class); - - public void fixupDatabase() { - // fix up some of the null fields - long count = 0; - count = countBySearch(HierarchyNodeMetaData.class, new Search("isDisabled","", Restriction.NULL) ); - if (count > 0) { - int counter = 0; - counter += getHibernateTemplate().bulkUpdate("update HierarchyNodeMetaData nm set nm.isDisabled = false where nm.isDisabled is null"); - log.info("Updated " + counter + " HierarchyNodeMetaData.isDisabled fields from null to boolean false"); - } - } -} +/* +* Licensed to The Apereo Foundation under one or more contributor license +* agreements. See the NOTICE file distributed with this work for +* additional information regarding copyright ownership. +* +* The Apereo Foundation licenses this file to you 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: +* +* http://opensource.org/licenses/ecl2.txt +* +* 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.sakaiproject.hierarchy.dao; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.sakaiproject.genericdao.api.search.Restriction; +import org.sakaiproject.genericdao.api.search.Search; +import org.sakaiproject.genericdao.hibernate.HibernateGeneralGenericDao; + +import org.sakaiproject.hierarchy.dao.model.HierarchyNodeMetaData; + +/** + * Implementation of DAO + * + * @author Aaron Zeckoski (aaronz@vt.edu) + */ +public class HierarchyDaoImpl extends HibernateGeneralGenericDao implements HierarchyDao { + + private static Logger log = LoggerFactory.getLogger(HierarchyDaoImpl.class); + + public void fixupDatabase() { + // fix up some of the null fields + long count = 0; + count = countBySearch(HierarchyNodeMetaData.class, new Search("isDisabled","", Restriction.NULL) ); + if (count > 0) { + int counter = 0; + counter += getHibernateTemplate().bulkUpdate("update HierarchyNodeMetaData nm set nm.isDisabled = false where nm.isDisabled is null"); + log.info("Updated " + counter + " HierarchyNodeMetaData.isDisabled fields from null to boolean false"); + } + } +} diff --git a/hierarchy/impl/src/java/org/sakaiproject/hierarchy/impl/HierarchyServiceImpl.java b/hierarchy/impl/src/java/org/sakaiproject/hierarchy/impl/HierarchyServiceImpl.java index 69b4be927fa5..55f13b328104 100644 --- a/hierarchy/impl/src/java/org/sakaiproject/hierarchy/impl/HierarchyServiceImpl.java +++ b/hierarchy/impl/src/java/org/sakaiproject/hierarchy/impl/HierarchyServiceImpl.java @@ -1,1138 +1,1138 @@ -/* -* Licensed to The Apereo Foundation under one or more contributor license -* agreements. See the NOTICE file distributed with this work for -* additional information regarding copyright ownership. -* -* The Apereo Foundation licenses this file to you 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: -* -* http://opensource.org/licenses/ecl2.txt -* -* 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.sakaiproject.hierarchy.impl; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.sakaiproject.genericdao.api.search.Order; -import org.sakaiproject.genericdao.api.search.Restriction; -import org.sakaiproject.genericdao.api.search.Search; -import org.sakaiproject.hierarchy.HierarchyService; -import org.sakaiproject.hierarchy.dao.HierarchyDao; -import org.sakaiproject.hierarchy.dao.model.HierarchyNodeMetaData; -import org.sakaiproject.hierarchy.dao.model.HierarchyNodePermission; -import org.sakaiproject.hierarchy.dao.model.HierarchyPersistentNode; -import org.sakaiproject.hierarchy.impl.utils.HierarchyImplUtils; -import org.sakaiproject.hierarchy.model.HierarchyNode; -import org.sakaiproject.db.api.SqlService; - -/** - * The default implementation of the Hierarchy interface - * - * @author Aaron Zeckoski (aaronz@vt.edu) - */ -public class HierarchyServiceImpl implements HierarchyService { - - private static Log log = LogFactory.getLog(HierarchyServiceImpl.class); - - private static int ORACLE_IN_CLAUSE_SIZE_LIMIT = 1000; - private boolean oracle = false; - - private HierarchyDao dao; - - public void setDao(HierarchyDao dao) { - this.dao = dao; - } - - private SqlService sqlService; - - public void setSqlService(SqlService sqlService) { - this.sqlService = sqlService; - } - - // private SessionManager sessionManager; - // public void setSessionManager(SessionManager sessionManager) { - // this.sessionManager = sessionManager; - // } - - public void init() { - log.info("init"); - - if(sqlService != null && "oracle".equalsIgnoreCase(sqlService.getVendor())){ - this.oracle = true; - } - - // handle any DB migration/cleanup which needs to happen (mostly for upgrades) - dao.fixupDatabase(); - } - - public HierarchyNode createHierarchy(String hierarchyId) { - if (hierarchyId.length() < 1 || hierarchyId.length() > 250) { - throw new IllegalArgumentException("Invalid hierarchyId (" + hierarchyId - + "): length must be 1 to 250 chars"); - } - - long count = dao.countBySearch(HierarchyNodeMetaData.class, - new Search("hierarchyId", hierarchyId) ); - if (count > 0) { - throw new IllegalArgumentException("Invalid hierarchyId (" + hierarchyId - + "): this id is already in use, you must use a unique id when creating a new hierarchy"); - } - - HierarchyPersistentNode pNode = new HierarchyPersistentNode(); // no children or parents to - // start - HierarchyNodeMetaData metaData = new HierarchyNodeMetaData(pNode, hierarchyId, Boolean.TRUE, null); // getCurrentUserId()); - saveNodeAndMetaData(pNode, metaData); - - return HierarchyImplUtils.makeNode(pNode, metaData); - } - - public HierarchyNode setHierarchyRootNode(String hierarchyId, String nodeId) { - HierarchyNodeMetaData metaData = getNodeMeta(nodeId); - HierarchyNodeMetaData rootMetaData = getRootNodeMetaByHierarchy(hierarchyId); - - Set entities = new HashSet(); - - if (rootMetaData != null) { - if (metaData.getId().equals(rootMetaData.getId())) { - // this node is already the root node - return HierarchyImplUtils.makeNode(metaData); - } else if (!metaData.getHierarchyId().equals(rootMetaData.getHierarchyId())) { - throw new IllegalArgumentException("Cannot move a node from one hierarchy (" - + metaData.getHierarchyId() + ") to another (" + hierarchyId - + ") and replace the root node, this could orphan nodes"); - } - rootMetaData.setIsRootNode(Boolean.FALSE); - entities.add(metaData); - } - - if (metaData.getNode().getParentIds() != null) { - throw new IllegalArgumentException("Cannot assign a node (" + nodeId - + ") to the hierarchy rootNode when it has parents"); - } - - metaData.setIsRootNode(Boolean.TRUE); - entities.add(metaData); - - dao.saveSet(entities); - return HierarchyImplUtils.makeNode(metaData); - } - - @SuppressWarnings("rawtypes") - public void destroyHierarchy(String hierarchyId) { - List l = dao.findBySearch(HierarchyNodeMetaData.class, - new Search("hierarchyId", hierarchyId) ); - if (l.isEmpty()) { - throw new IllegalArgumentException("Could not find hierarchy to remove with the following id: " - + hierarchyId); - } - - Set nodes = new HashSet(); - Set nodesMetaData = new HashSet(); - for (int i = 0; i < l.size(); i++) { - HierarchyNodeMetaData nmd = (HierarchyNodeMetaData) l.get(i); - nodesMetaData.add(nmd); - nodes.add(nmd.getNode()); - } - - Set[] entitySets = new Set[] { nodesMetaData, nodes }; - dao.deleteMixedSet(entitySets); - } - - public HierarchyNode getRootNode(String hierarchyId) { - HierarchyNodeMetaData metaData = getRootNodeMetaByHierarchy(hierarchyId); - if (metaData == null) { - return null; - } - return HierarchyImplUtils.makeNode(metaData); - } - - public HierarchyNode getNodeById(String nodeId) { - HierarchyNodeMetaData metaData = getNodeMeta(nodeId); - return HierarchyImplUtils.makeNode(metaData); - } - - - public Map getNodesByIds(String[] nodeIds) { - List nodeMetas = getNodeMetas(nodeIds); - Map m = new HashMap(); - for (HierarchyNodeMetaData metaData : nodeMetas) { - HierarchyNode node = HierarchyImplUtils.makeNode(metaData); - m.put(node.id, node); - } - return m; - } - - public Set getChildNodes(String nodeId, boolean directOnly) { - Set children = new HashSet(); - - HierarchyNodeMetaData parentMetaData = getNodeMeta(nodeId); - String childIdString = null; - if (directOnly) { - childIdString = parentMetaData.getNode().getDirectChildIds(); - } else { - childIdString = parentMetaData.getNode().getChildIds(); - } - - if (childIdString == null) { - return children; - } - - Set childrenIds = HierarchyImplUtils.makeNodeIdSet(childIdString); - List childNodeMetas = getNodeMetas(childrenIds); - for (HierarchyNodeMetaData metaData : childNodeMetas) { - children.add(HierarchyImplUtils.makeNode(metaData)); - } - return children; - } - - public Set getParentNodes(String nodeId, boolean directOnly) { - Set parents = new HashSet(); - - HierarchyNodeMetaData parentMetaData = getNodeMeta(nodeId); - String parentIdString = null; - if (directOnly) { - parentIdString = parentMetaData.getNode().getDirectParentIds(); - } else { - parentIdString = parentMetaData.getNode().getParentIds(); - } - - if (parentIdString == null) { - return parents; - } - - Set parentsIds = HierarchyImplUtils.makeNodeIdSet(parentIdString); - List parentNodeMetas = getNodeMetas(parentsIds); - for (HierarchyNodeMetaData metaData : parentNodeMetas) { - parents.add(HierarchyImplUtils.makeNode(metaData)); - } - - - return parents; - } - - public HierarchyNode addNode(String hierarchyId, String parentNodeId) { - if (parentNodeId == null) { - throw new RuntimeException("Setting parentNodeId to null is not yet supported"); - } - - // validate the parent node and hierarchy (this needs to be cached for sure) - HierarchyNodeMetaData parentNodeMeta = getNodeMeta(parentNodeId); - if (parentNodeMeta == null) { - throw new IllegalArgumentException("Invalid parent node id, cannot find node with id: " - + parentNodeId); - } - if (!parentNodeMeta.getHierarchyId().equals(hierarchyId)) { - throw new IllegalArgumentException("Invalid hierarchy id, cannot find node (" + parentNodeId - + ") in this hierarchy: " + hierarchyId); - } - - // get the set of all nodes above the new node (these will have to be updated) - Set parentNodeIds = HierarchyImplUtils.makeNodeIdSet(parentNodeMeta.getNode().getParentIds()); - parentNodeIds.add(parentNodeId); - - // create the new node and assign the new parents from our parent - HierarchyPersistentNode pNode = new HierarchyPersistentNode(HierarchyImplUtils - .makeSingleEncodedNodeIdString(parentNodeId), HierarchyImplUtils - .makeEncodedNodeIdString(parentNodeIds)); - HierarchyNodeMetaData metaData = new HierarchyNodeMetaData(pNode, hierarchyId, Boolean.FALSE, null); // getCurrentUserId()); - // save this new node (perhaps we should be saving all of these in one massive update?) -AZ - saveNodeAndMetaData(pNode, metaData); - String newNodeId = pNode.getId().toString(); - - // update all the links in the tree for this new node - List pNodesList = getNodes(parentNodeIds); - Set pNodes = new HashSet(); - for (HierarchyPersistentNode node : pNodesList) { - if (node.getId().toString().equals(parentNodeId)) { - // special case for our parent, update direct children - node.setDirectChildIds( - HierarchyImplUtils.addSingleNodeIdToEncodedString( - node.getDirectChildIds(), newNodeId)); - } - - // update the children for each node - node.setChildIds( - HierarchyImplUtils.addSingleNodeIdToEncodedString(node.getChildIds(), newNodeId)); - - // add to the set of node to be saved - pNodes.add(node); - } - dao.saveSet(pNodes); - - return HierarchyImplUtils.makeNode(pNode, metaData); - } - - public HierarchyNode removeNode(String nodeId) { - if (nodeId == null) { - throw new NullPointerException("nodeId to remove cannot be null"); - } - - // validate the node - HierarchyNodeMetaData metaData = getNodeMeta(nodeId); - if (metaData == null) { - throw new IllegalArgumentException("Invalid node id, cannot find node with id: " + nodeId); - } - if (metaData.getIsRootNode().booleanValue()) { - throw new IllegalArgumentException("Cannot remove the root node (" + nodeId + "), " - + "you must remove the entire hierarchy (" + metaData.getHierarchyId() - + ") to remove this root node"); - } - - // get the set of all nodes above the current node (these will have to be updated) - HierarchyNode currentNode = HierarchyImplUtils.makeNode(metaData); - if (currentNode.childNodeIds.size() != 0) { - throw new IllegalArgumentException("Cannot remove a node with children nodes, " - + "reduce the children on this node from " + currentNode.childNodeIds.size() - + " to 0 before attempting to remove it"); - } - - if (currentNode.directParentNodeIds.size() > 1) { - throw new IllegalArgumentException("Cannot remove a node with multiple parents, " - + "reduce the parents on this node to 1 before attempting to remove it"); - } - - // get the "main" parent node - String currentParentNodeId = getParentNodeId(currentNode); - - // update all the links in the tree for this removed node - List pNodesList = getNodes(currentNode.parentNodeIds); - Set pNodes = new HashSet(); - for (HierarchyPersistentNode pNode : pNodesList) { - if (pNode.getId().toString().equals(currentParentNodeId)) { - // special case for our parent, update direct children - Set nodeChildren = HierarchyImplUtils.makeNodeIdSet(pNode.getDirectChildIds()); - nodeChildren.remove(nodeId); - pNode.setDirectChildIds(HierarchyImplUtils.makeEncodedNodeIdString(nodeChildren)); - } - - // update the children for each node - Set nodeChildren = HierarchyImplUtils.makeNodeIdSet(pNode.getChildIds()); - nodeChildren.remove(nodeId); - pNode.setChildIds(HierarchyImplUtils.makeEncodedNodeIdString(nodeChildren)); - - // add to the set of nodes to be saved - pNodes.add(pNode); - } - dao.saveSet(pNodes); - - return HierarchyImplUtils.makeNode(getNodeMeta(currentParentNodeId)); - } - - public HierarchyNode saveNodeMetaData(String nodeId, String title, String description, String permToken) { - if (nodeId == null) { - throw new NullPointerException("nodeId to remove cannot be null"); - } - - // validate the node - HierarchyNodeMetaData metaData = getNodeMeta(nodeId); - if (metaData == null) { - throw new IllegalArgumentException("Invalid node id, cannot find node with id: " + nodeId); - } - - // update the node meta data - if (title != null) { - if (title.equals("")) { - metaData.setTitle(null); - } else { - metaData.setTitle(title); - } - } - if (description != null) { - if (description.equals("")) { - metaData.setDescription(null); - } else { - metaData.setDescription(description); - } - } - if (permToken != null) { - if (permToken.equals("")) { - metaData.setPermToken(null); - } else { - metaData.setPermToken(permToken); - } - } - - // save the node meta data - dao.save(metaData); - - return HierarchyImplUtils.makeNode(metaData); - } - - public HierarchyNode setNodeDisabled(String nodeId, Boolean isDisabled) { - - if (nodeId == null) { - throw new NullPointerException("nodeId cannot be null"); - } - - // validate the node - HierarchyNodeMetaData metaData = getNodeMeta(nodeId); - - if (metaData == null) { - throw new IllegalArgumentException("Invalid node id, cannot find node with id: " + nodeId); - } - - // update the node's isDisabled setting - if (isDisabled != null) { - metaData.setIsDisabled(isDisabled); - } - - // save the node meta data - dao.save(metaData); - - return HierarchyImplUtils.makeNode(metaData); - - } - - public HierarchyNode addChildRelation(String nodeId, String childNodeId) { - if (nodeId == null || childNodeId == null) { - throw new NullPointerException("nodeId (" + nodeId + ") and childNodeId (" + childNodeId - + ") cannot be null"); - } - - if (nodeId.equals(childNodeId)) { - throw new IllegalArgumentException("nodeId and childNodeId cannot be the same: " + nodeId); - } - - HierarchyNodeMetaData metaData = getNodeMeta(nodeId); - if (metaData == null) { - throw new IllegalArgumentException("Invalid nodeId: " + nodeId); - } - - HierarchyNodeMetaData addMetaData = getNodeMeta(childNodeId); - if (addMetaData == null) { - throw new IllegalArgumentException("Invalid childNodeId: " + childNodeId); - } - - HierarchyNode currentNode = HierarchyImplUtils.makeNode(metaData); - // only add this if it is not already in there - if (!currentNode.directChildNodeIds.contains(childNodeId)) { - // first check for a cycle - if (currentNode.childNodeIds.contains(childNodeId) - || currentNode.parentNodeIds.contains(childNodeId)) { - throw new IllegalArgumentException("Cannot add " + childNodeId + " as a child of " + nodeId - + " because it is already in the node tree directly above or below this node"); - } - - // now we go ahead and update this node and all the related nodes - HierarchyNode addNode = HierarchyImplUtils.makeNode(addMetaData); - Set pNodes = new HashSet(); - - // update the current node - metaData.getNode().setDirectChildIds( - HierarchyImplUtils.addSingleNodeIdToEncodedString( - metaData.getNode().getDirectChildIds(), childNodeId)); - metaData.getNode().setChildIds( - HierarchyImplUtils.addSingleNodeIdToEncodedString( - metaData.getNode().getChildIds(), childNodeId)); - pNodes.add(metaData.getNode()); - - // update the add node - addMetaData.getNode().setDirectParentIds( - HierarchyImplUtils.addSingleNodeIdToEncodedString( - addMetaData.getNode().getDirectParentIds(), nodeId)); - addMetaData.getNode().setParentIds( - HierarchyImplUtils.addSingleNodeIdToEncodedString( - addMetaData.getNode().getParentIds(),nodeId)); - pNodes.add(addMetaData.getNode()); - - // update the parents of the current node (they have new children) - List pNodesList = getNodes(currentNode.parentNodeIds); - Set nodesToAdd = addNode.childNodeIds; - nodesToAdd.add(addNode.id); - for (HierarchyPersistentNode pNode : pNodesList) { - // update the children for each node - Set nodeChildren = HierarchyImplUtils.makeNodeIdSet(pNode.getChildIds()); - nodeChildren.addAll(nodesToAdd); - pNode.setChildIds(HierarchyImplUtils.makeEncodedNodeIdString(nodeChildren)); - - // add to the set of nodes to be saved - pNodes.add(pNode); - } - - // update the children of the add node (they have new parants) - pNodesList = getNodes(addNode.childNodeIds); - nodesToAdd = currentNode.parentNodeIds; - nodesToAdd.add(currentNode.id); - for (HierarchyPersistentNode pNode : pNodesList) { - // update the parents for each node - Set parents = HierarchyImplUtils.makeNodeIdSet(pNode.getParentIds()); - parents.addAll(nodesToAdd); - pNode.setParentIds(HierarchyImplUtils.makeEncodedNodeIdString(parents)); - - // add to the set of nodes to be saved - pNodes.add(pNode); - } - - dao.saveSet(pNodes); - } - - return HierarchyImplUtils.makeNode(metaData); - } - - public HierarchyNode removeChildRelation(String nodeId, String childNodeId) { - if (nodeId == null || childNodeId == null) { - throw new NullPointerException("nodeId (" + nodeId + ") and childNodeId (" + childNodeId - + ") cannot be null"); - } - - if (nodeId.equals(childNodeId)) { - throw new IllegalArgumentException("nodeId and childNodeId cannot be the same: " + nodeId); - } - - HierarchyNodeMetaData metaData = getNodeMeta(nodeId); - if (metaData == null) { - throw new IllegalArgumentException("Invalid nodeId: " + nodeId); - } - - HierarchyNodeMetaData removeMetaData = getNodeMeta(childNodeId); - if (removeMetaData == null) { - throw new IllegalArgumentException("Invalid childNodeId: " + childNodeId); - } - - HierarchyNode currentNode = HierarchyImplUtils.makeNode(metaData); - // only do something if this child is a direct child of this node - if (currentNode.directChildNodeIds.contains(childNodeId)) { - // first check for orphaning - HierarchyNode removeNode = HierarchyImplUtils.makeNode(removeMetaData); - if (removeNode.directParentNodeIds.size() <= 1) { - throw new IllegalArgumentException("Cannot remove " + childNodeId + " as a child of " + nodeId - + " because it would orphan the child node, you need to use the remove method" + - "if you want to remove a node or add this node as the child of another node first"); - } - - // now we go ahead and update this node and all the related nodes - Set pNodes = new HashSet(); - Set nodes = null; - - // update the current node - nodes = HierarchyImplUtils.makeNodeIdSet(metaData.getNode().getChildIds()); - nodes.remove(childNodeId); - metaData.getNode().setChildIds(HierarchyImplUtils.makeEncodedNodeIdString(nodes)); - nodes = HierarchyImplUtils.makeNodeIdSet(metaData.getNode().getDirectChildIds()); - nodes.remove(childNodeId); - metaData.getNode().setDirectChildIds(HierarchyImplUtils.makeEncodedNodeIdString(nodes)); - pNodes.add(metaData.getNode()); - - // update the remove node - nodes = HierarchyImplUtils.makeNodeIdSet(removeMetaData.getNode().getParentIds()); - nodes.remove(nodeId); - removeMetaData.getNode().setParentIds(HierarchyImplUtils.makeEncodedNodeIdString(nodes)); - nodes = HierarchyImplUtils.makeNodeIdSet(removeMetaData.getNode().getDirectParentIds()); - nodes.remove(nodeId); - removeMetaData.getNode().setDirectParentIds(HierarchyImplUtils.makeEncodedNodeIdString(nodes)); - pNodes.add(removeMetaData.getNode()); - - // update the parents of the current node (they have less children) - List pNodesList = getNodes(currentNode.parentNodeIds); - Set nodesToRemove = removeNode.childNodeIds; - nodesToRemove.add(removeNode.id); - for (HierarchyPersistentNode pNode : pNodesList) { - // update the children for each node - Set children = HierarchyImplUtils.makeNodeIdSet(pNode.getChildIds()); - children.removeAll(nodesToRemove); - // add back in all the children of the currentNode because we may have - // taken out part of the tree below where if it connects to the children of removeNode - children.addAll(currentNode.childNodeIds); - pNode.setChildIds(HierarchyImplUtils.makeEncodedNodeIdString(children)); - - // add to the set of nodes to be saved - pNodes.add(pNode); - } - - // update the children of the remove node (they have lost parents) - pNodesList = getNodes(removeNode.childNodeIds); - nodesToRemove = currentNode.parentNodeIds; - nodesToRemove.add(currentNode.id); - for (HierarchyPersistentNode pNode : pNodesList) { - // update the parents for each node - Set parents = HierarchyImplUtils.makeNodeIdSet(pNode.getParentIds()); - parents.removeAll(nodesToRemove); - // add back in all the parents of the removeNode because we will have - // taken out part of the tree above where it reconnects on the way to the root - parents.addAll(removeNode.parentNodeIds); - pNode.setParentIds(HierarchyImplUtils.makeEncodedNodeIdString(parents)); - - // add to the set of nodes to be saved - pNodes.add(pNode); - } - - dao.saveSet(pNodes); - - } - - return HierarchyImplUtils.makeNode(metaData); - } - - public HierarchyNode addParentRelation(String nodeId, String parentNodeId) { - // TODO Not implemented yet - not sure we even want to allow this - throw new RuntimeException("This method is not implemented yet"); - } - - public HierarchyNode removeParentRelation(String nodeId, String parentNodeId) { - // TODO Not implemented yet - not sure this is even a good idea - throw new RuntimeException("This method is not implemented yet"); - } - - - public Set getNodesWithToken(String hierarchyId, String permToken) { - if (permToken == null || permToken.equals("")) { - throw new NullPointerException("permToken cannot be null or empty string"); - } - - List l = dao.findBySearch(HierarchyNodeMetaData.class, - new Search("hierarchyId", hierarchyId) ); - if (l.isEmpty()) { - throw new IllegalArgumentException("Could not find hierarchy with the following id: " - + hierarchyId); - } - - List nodeIdsList = dao.findBySearch(HierarchyNodeMetaData.class, - new Search(new Restriction[] { - new Restriction("hierarchyId", hierarchyId), - new Restriction("permToken", permToken) - }, new Order("node.id"))); - - Set nodeIds = new TreeSet(); - for (Iterator iter = nodeIdsList.iterator(); iter.hasNext();) { - HierarchyNodeMetaData metaData = iter.next(); - nodeIds.add(metaData.getNode().getId().toString()); - } - - return nodeIds; - } - - public Map> getNodesWithTokens(String hierarchyId, String[] permTokens) { - // it would be better if this were more efficient... - if (permTokens == null) { - throw new NullPointerException("permTokens cannot be null"); - } - - Map> tokenNodes = new HashMap>(); - for (int i = 0; i < permTokens.length; i++) { - Set nodeIds = getNodesWithToken(hierarchyId, permTokens[i]); - tokenNodes.put(permTokens[i], nodeIds); - } - - return tokenNodes; - } - - // PERMISSIONS - - public void assignUserNodePerm(String userId, String nodeId, String hierarchyPermission, boolean cascade) { - if (userId == null || "".equals(userId) - || nodeId == null || "".equals(nodeId) - || hierarchyPermission == null || "".equals(hierarchyPermission)) { - throw new IllegalArgumentException("Invalid arguments to assignUserNodePerm, no arguments can be null or blank: userId="+userId+", nodeId="+nodeId+", hierarchyPermission="+hierarchyPermission); - } - HierarchyNodePermission nodePerm = dao.findOneBySearch(HierarchyNodePermission.class, new Search( - new Restriction[] { - new Restriction("userId", userId), - new Restriction("nodeId", nodeId), - new Restriction("permission", hierarchyPermission) - })); - if (nodePerm == null) { - // validate the nodeId - Long nodeIdeNum; - try { - nodeIdeNum = new Long(nodeId); - } catch (NumberFormatException e) { - throw new IllegalArgumentException("Node id ("+nodeId+") provided is invalid, must be a valid identifier from an existing node"); - } - // check it exists - HierarchyPersistentNode pNode = dao.findById(HierarchyPersistentNode.class, nodeIdeNum); - if (pNode == null) { - throw new IllegalArgumentException("Node id ("+nodeId+") provided is invalid, node does not exist"); - } - // create the perm - dao.create( new HierarchyNodePermission(userId, nodeId, hierarchyPermission) ); - } else { - // permission already set, do nothing - } - if (cascade) { - // cascade the permission creation - HierarchyNode node = getNodeById(nodeId); - if (node != null - && node.childNodeIds != null - && node.childNodeIds.size() > 0) { - List nodeIdsList = new ArrayList(node.childNodeIds); - - int i = 0; - List nodePerms = new ArrayList(); - do{ - int arraySize = nodeIdsList.size() - i; - if(oracle && arraySize > ORACLE_IN_CLAUSE_SIZE_LIMIT){ - arraySize = ORACLE_IN_CLAUSE_SIZE_LIMIT; - } - // get all the permissions which are related to the nodes under this one - List nodePermsItteration = dao.findBySearch(HierarchyNodePermission.class, new Search( - new Restriction[] { - new Restriction("userId", userId), - new Restriction("permission", hierarchyPermission), - new Restriction("nodeId", nodeIdsList.subList(i, i + arraySize).toArray()) - })); - nodePerms.addAll(nodePermsItteration); - i += arraySize; - }while(i < nodeIdsList.size()); - - Set allPerms = new HashSet(); - if (nodePerms.size() == 0) { - // add all new ones - for (String childNodeId : node.childNodeIds) { - allPerms.add( new HierarchyNodePermission(userId, childNodeId, hierarchyPermission) ); - } - } else { - // only add the missing ones - Set existingPermNodeIds = new HashSet(); - for (HierarchyNodePermission hierNodePerm : nodePerms) { - existingPermNodeIds.add( hierNodePerm.getNodeId() ); - } - for (String childNodeId : node.childNodeIds) { - if (! existingPermNodeIds.contains(nodeId)) { - allPerms.add( new HierarchyNodePermission(userId, childNodeId, hierarchyPermission) ); - } - } - } - if (nodePerms.size() == node.childNodeIds.size() - || allPerms.size() == 0) { - // nothing to do here, all permissions already exist or there are none to add - } else { - // save the new permissions - dao.saveSet( new HashSet(allPerms) ); - } - } - } - } - - public void removeUserNodePerm(String userId, String nodeId, String hierarchyPermission, boolean cascade) { - if (userId == null || "".equals(userId) - || nodeId == null || "".equals(nodeId) - || hierarchyPermission == null || "".equals(hierarchyPermission)) { - throw new IllegalArgumentException("Invalid arguments to removeUserNodePerm, no arguments can be null or blank: userId="+userId+", nodeId="+nodeId+", hierarchyPermission="+hierarchyPermission); - } - if (! cascade) { - // delete the current permission if it can be found - HierarchyNodePermission nodePerm = dao.findOneBySearch(HierarchyNodePermission.class, new Search( - new Restriction[] { - new Restriction("userId", userId), - new Restriction("nodeId", nodeId), - new Restriction("permission", hierarchyPermission) - })); - if (nodePerm == null) { - // not found, nothing to do - } else { - dao.delete(nodePerm); - } - } else { - // cascade the permission removal and delete current one as well - HierarchyNode node = getNodeById(nodeId); - if (node != null) { - HashSet nodeIdsSet = new HashSet(); - nodeIdsSet.add(nodeId); - // add in child nodes if there are any - if (node.childNodeIds != null - && node.childNodeIds.size() > 0) { - nodeIdsSet.addAll(node.childNodeIds); - } - List nodeIdsList = new ArrayList(nodeIdsSet); - int i = 0; - do{ - int arraySize = nodeIdsList.size() - i; - if(oracle && arraySize > ORACLE_IN_CLAUSE_SIZE_LIMIT){ - arraySize = ORACLE_IN_CLAUSE_SIZE_LIMIT; - } - // get all the permissions which are related to the nodes under this one - List nodePerms = dao.findBySearch(HierarchyNodePermission.class, new Search( - new Restriction[] { - new Restriction("userId", userId), - new Restriction("permission", hierarchyPermission), - new Restriction("nodeId", nodeIdsList.subList(i, i + arraySize).toArray()) - })); - if (nodePerms.size() > 0) { - // delete all as one operation - dao.deleteSet( new HashSet(nodePerms) ); - } - i += arraySize; - }while(i < nodeIdsList.size()); - } - } - } - - public boolean checkUserNodePerm(String userId, String nodeId, String hierarchyPermission) { - if (userId == null || "".equals(userId) - || nodeId == null || "".equals(nodeId) - || hierarchyPermission == null || "".equals(hierarchyPermission)) { - throw new IllegalArgumentException("Invalid arguments to checkUserNodePerm, no arguments can be null or blank: userId="+userId+", nodeId="+nodeId+", hierarchyPermission="+hierarchyPermission); - } - boolean allowed = false; - HierarchyNodePermission nodePerm = dao.findOneBySearch(HierarchyNodePermission.class, new Search( - new Restriction[] { - new Restriction("userId", userId), - new Restriction("nodeId", nodeId), - new Restriction("permission", hierarchyPermission) - })); - if (nodePerm != null) { - allowed = true; - } - return allowed; - } - - public Set getNodesForUserPerm(String userId, String hierarchyPermission) { - if (userId == null || "".equals(userId) - || hierarchyPermission == null || "".equals(hierarchyPermission)) { - throw new IllegalArgumentException("Invalid arguments to getNodesForUserPerm, no arguments can be null or blank: userId="+userId+", hierarchyPermission="+hierarchyPermission); - } - Set nodes = new HashSet(); - List nodePerms = dao.findBySearch(HierarchyNodePermission.class, new Search( - new Restriction[] { - new Restriction("userId", userId), - new Restriction("permission", hierarchyPermission) - })); - Set nodeIds = new HashSet(); - for (HierarchyNodePermission nodePerm : nodePerms) { - nodeIds.add( nodePerm.getNodeId() ); - } - List nodeMetas = getNodeMetas(nodeIds); - for (HierarchyNodeMetaData metaData : nodeMetas) { - nodes.add( HierarchyImplUtils.makeNode(metaData) ); - } - return nodes; - } - - public Set getUserIdsForNodesPerm(String[] nodeIds, String hierarchyPermission) { - if (nodeIds == null - || hierarchyPermission == null || "".equals(hierarchyPermission)) { - throw new IllegalArgumentException("Invalid arguments to getUserIdsForNodesPerm, no arguments can be null or blank: hierarchyPermission="+hierarchyPermission); - } - Set userIds = new HashSet(); - if (nodeIds.length > 0) { - List nodeIdsList = new ArrayList(Arrays.asList(nodeIds)); - int i = 0; - do{ - int arraySize = nodeIdsList.size() - i; - if(oracle && arraySize > ORACLE_IN_CLAUSE_SIZE_LIMIT){ - arraySize = ORACLE_IN_CLAUSE_SIZE_LIMIT; - } - List nodePerms = dao.findBySearch(HierarchyNodePermission.class, new Search( - new Restriction[] { - new Restriction("nodeId", nodeIdsList.subList(i, i + arraySize).toArray()), - new Restriction("permission", hierarchyPermission) - })); - for (HierarchyNodePermission nodePerm : nodePerms) { - userIds.add( nodePerm.getUserId() ); - } - i += arraySize; - }while(i < nodeIdsList.size()); - } - return userIds; - } - - public Set getPermsForUserNodes(String userId, String[] nodeIds) { - if (userId == null || "".equals(userId) - || nodeIds == null ) { - throw new IllegalArgumentException("Invalid arguments to getPermsForUserNodes, no arguments can be null or blank: userId="+userId); - } - Set perms = new HashSet(); - if (nodeIds.length > 0) { - List nodeIdsList = new ArrayList(Arrays.asList(nodeIds)); - int i = 0; - do{ - int arraySize = nodeIdsList.size() - i; - if(oracle && arraySize > ORACLE_IN_CLAUSE_SIZE_LIMIT){ - arraySize = ORACLE_IN_CLAUSE_SIZE_LIMIT; - } - List nodePerms = dao.findBySearch(HierarchyNodePermission.class, new Search( - new Restriction[] { - new Restriction("userId", userId), - new Restriction("nodeId", nodeIdsList.subList(i, i + arraySize).toArray()) - })); - for (HierarchyNodePermission nodePerm : nodePerms) { - perms.add( nodePerm.getPermission() ); - } - i += arraySize; - }while(i < nodeIdsList.size()); - } - return perms; - } - - public Map>> getUsersAndPermsForNodes(String... nodeIds) { - if (nodeIds == null || nodeIds.length == 0) { - throw new IllegalArgumentException("Invalid arguments to getUsersAndPermsForNodes, no arguments can be null or blank: nodeIds="+nodeIds); - } - Map>> m = new HashMap>>(); - for (String nodeId : nodeIds) { - m.put(nodeId, new HashMap>()); - } - List nodePerms = new ArrayList(); - List nodeIdsList = new ArrayList(Arrays.asList(nodeIds)); - int i = 0; - do{ - int arraySize = nodeIdsList.size() - i; - if(oracle && arraySize > ORACLE_IN_CLAUSE_SIZE_LIMIT){ - arraySize = ORACLE_IN_CLAUSE_SIZE_LIMIT; - } - List nodePermsItteration = dao.findBySearch(HierarchyNodePermission.class, - new Search("nodeId", nodeIdsList.subList(i, i + arraySize).toArray())); - nodePerms.addAll(nodePermsItteration); - i += arraySize; - }while(i < nodeIdsList.size()); - - // nodeId -> (map of userId -> Set(permission)) - for (HierarchyNodePermission nodePerm : nodePerms) { - String nodeId = nodePerm.getNodeId(); - if (! m.containsKey(nodeId)) { - continue; // this should not really happen but better safe than sorry - } - String userId = nodePerm.getUserId(); - if (! m.get(nodeId).containsKey(userId) ) { - m.get(nodeId).put(userId, new HashSet() ); - } - m.get(nodeId).get(userId).add( nodePerm.getPermission() ); - } - return m; - } - - public Map>> getNodesAndPermsForUser(String... userIds) { - if (userIds == null || userIds.length == 0) { - throw new IllegalArgumentException("Invalid arguments to getNodesAndPermsForUser, no arguments can be null or blank: userIds="+userIds); - } - Map>> m = new HashMap>>(); - for (String userId : userIds) { - m.put(userId, new HashMap>()); - } - List userIdsList = new ArrayList(Arrays.asList(userIds)); - int i = 0; - List nodePerms = new ArrayList(); - do{ - int arraySize = userIdsList.size() - i; - if(oracle && arraySize > ORACLE_IN_CLAUSE_SIZE_LIMIT){ - arraySize = ORACLE_IN_CLAUSE_SIZE_LIMIT; - } - List nodePermsItteration = dao.findBySearch(HierarchyNodePermission.class, - new Search("userId", userIdsList.subList(i, i + arraySize).toArray())); - nodePerms.addAll(nodePermsItteration); - i += arraySize; - }while(i < userIdsList.size()); - - // userId -> (map of nodeId -> Set(permission)) - for (HierarchyNodePermission nodePerm : nodePerms) { - String userId = nodePerm.getUserId(); - if (! m.containsKey(userId)) { - continue; // this should not really happen but better safe than sorry - } - String nodeId = nodePerm.getNodeId(); - if (! m.get(userId).containsKey(nodeId) ) { - m.get(userId).put(nodeId, new HashSet() ); - } - m.get(userId).get(nodeId).add( nodePerm.getPermission() ); - } - return m; - } - - // PRIVATE - - - /** - * Convenience method to save a node and metadata in one transaction - * - * @param pNode - * @param metaData - */ - @SuppressWarnings("rawtypes") - private void saveNodeAndMetaData(HierarchyPersistentNode pNode, HierarchyNodeMetaData metaData) { - Set pNodes = new HashSet(); - pNodes.add(pNode); - Set metaDatas = new HashSet(); - metaDatas.add(metaData); - Set[] entitySets = new Set[] { pNodes, metaDatas }; - dao.saveMixedSet(entitySets); - /* NORMALLY the code below should not be needed, however, - * we are seeing weird cases where the line above fails to create the metadata - * so the code below is meant to detect that case and correct it by saving - * each separately and realigning the ids manually - */ - if (metaData.getId() == null) { - // something went wrong and we're not sure what so delete pNode - if (pNode.getId() != null) { - dao.delete(pNode); - } - throw new RuntimeException("Metadata didn't save, node was removed: "+pNode); - } else if (pNode.getId() == null) { - // something went wrong and we're not sure what so delete metadata - if (metaData.getId() != null) { - dao.delete(metaData); - } - throw new RuntimeException("Metadata didn't save, metaData was removed: "+metaData); - } else if (!metaData.getId().equals(pNode.getId())) { - // the indexes are off... let's try to get them back in sync - int i = 0; - if (pNode.getId() > metaData.getId()) { - while (i < 100 && metaData.getId() != null && pNode.getId() != metaData.getId()) { - // need to keep saving metaData until it's sequence has caught up - dao.delete(metaData); - // set ID back to null to make it save with a new incremented ID - metaData.setId(null); - dao.save(metaData); - i++; - } - } else { - while (i < 100 && pNode.getId() != null && pNode.getId() != metaData.getId()) { - // need to keep saving node until it's sequence has caught up - dao.delete(pNode); - // set ID back to null to make it save with a new incremented ID - pNode.setId(null); - dao.save(pNode); - i++; - } - } - if (pNode.getId() == null || metaData.getId() == null || pNode.getId() != metaData.getId()) { - // ok we tried, it didn't work, so throw the exception - throw new RuntimeException("Node ID: " + pNode.getId() + " doesn't match Metadata ID: " + metaData.getId()); - } - } - } - - /** - * Fetch node data from storage - * - * @param nodeId - * @return a {@link HierarchyNodeMetaData} or null if not found - */ - private HierarchyNodeMetaData getNodeMeta(String nodeId) { - List l = dao.findBySearch(HierarchyNodeMetaData.class, - new Search("node.id", new Long(nodeId))); - if (l.size() > 1) { - throw new IllegalStateException("Invalid hierarchy state: more than one node with id: " + nodeId); - } else if (l.size() == 1) { - return l.get(0); - } else { - return null; - } - } - - /** - * Find the current root node - * - * @param hierarchyId - * @return the root {@link HierarchyNodeMetaData} of the hierarchy - */ - private HierarchyNodeMetaData getRootNodeMetaByHierarchy(String hierarchyId) { - List l = dao.findBySearch(HierarchyNodeMetaData.class, - new Search(new Restriction[] { - new Restriction("hierarchyId", hierarchyId), - new Restriction("isRootNode", Boolean.TRUE) - }) ); - if (l.size() > 1) { - throw new IllegalStateException("Invalid hierarchy state: more than one root node for hierarchyId: " - + hierarchyId); - } else if (l.size() == 1) { - return l.get(0); - } else { - return null; - } - } - - /** - * Get all nodes and meta data based on a set of nodeIds - * - * @param nodeIds - * @return - */ - private List getNodeMetas(Set nodeIds) { - return getNodeMetas(nodeIds.toArray(new String[] {})); - } - - private List getNodeMetas(String[] nodeIds) { - List l = null; - if (nodeIds == null || nodeIds.length == 0) { - l = new ArrayList(); - } else { - Long[] pNodeIds = new Long[nodeIds.length]; - for (int i = 0; i < nodeIds.length; i++) { - pNodeIds[i] = new Long(nodeIds[i]); - } - l = new ArrayList(); - List nodeIdsList = new ArrayList(Arrays.asList(pNodeIds)); - int i = 0; - do{ - int arraySize = nodeIdsList.size() - i; - if(oracle && arraySize > ORACLE_IN_CLAUSE_SIZE_LIMIT){ - arraySize = ORACLE_IN_CLAUSE_SIZE_LIMIT; - } - List lIterration = dao.findBySearch(HierarchyNodeMetaData.class, - new Search("node.id", nodeIdsList.subList(i, i + arraySize).toArray()) ); - l.addAll(lIterration); - i += arraySize; - }while(i < nodeIdsList.size()); - } - return l; - } - - /** - * Get all nodes only based on a set of nodeIds - * - * @param nodeIds - * @return - */ - private List getNodes(Set nodeIds) { - return getNodes(nodeIds.toArray(new String[] {})); - } - - private List getNodes(String[] nodeIds) { - List l = null; - if (nodeIds == null || nodeIds.length == 0) { - l = new ArrayList(); - } else { - Long[] pNodeIds = new Long[nodeIds.length]; - for (int i = 0; i < nodeIds.length; i++) { - pNodeIds[i] = new Long(nodeIds[i]); - } - l = new ArrayList(); - List nodeIdsList = new ArrayList(Arrays.asList(pNodeIds)); - int i = 0; - do{ - int arraySize = nodeIdsList.size() - i; - if(oracle && arraySize > ORACLE_IN_CLAUSE_SIZE_LIMIT){ - arraySize = ORACLE_IN_CLAUSE_SIZE_LIMIT; - } - List lIterration = dao.findBySearch(HierarchyPersistentNode.class, - new Search("id", nodeIdsList.subList(i, i + arraySize).toArray()) ); - l.addAll(lIterration); - i += arraySize; - }while(i < nodeIdsList.size()); - } - return l; - } - - /** - * Find the direct parent node id for a node - * @param node - * @return the node if or null if none exists - */ - private String getParentNodeId(HierarchyNode node) { - String parentNodeId = null; - if (node.directParentNodeIds != null && - node.directParentNodeIds.size() > 0) { - parentNodeId = node.directParentNodeIds.iterator().next(); - } - return parentNodeId; - } - -} +/* +* Licensed to The Apereo Foundation under one or more contributor license +* agreements. See the NOTICE file distributed with this work for +* additional information regarding copyright ownership. +* +* The Apereo Foundation licenses this file to you 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: +* +* http://opensource.org/licenses/ecl2.txt +* +* 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.sakaiproject.hierarchy.impl; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sakaiproject.genericdao.api.search.Order; +import org.sakaiproject.genericdao.api.search.Restriction; +import org.sakaiproject.genericdao.api.search.Search; +import org.sakaiproject.hierarchy.HierarchyService; +import org.sakaiproject.hierarchy.dao.HierarchyDao; +import org.sakaiproject.hierarchy.dao.model.HierarchyNodeMetaData; +import org.sakaiproject.hierarchy.dao.model.HierarchyNodePermission; +import org.sakaiproject.hierarchy.dao.model.HierarchyPersistentNode; +import org.sakaiproject.hierarchy.impl.utils.HierarchyImplUtils; +import org.sakaiproject.hierarchy.model.HierarchyNode; +import org.sakaiproject.db.api.SqlService; + +/** + * The default implementation of the Hierarchy interface + * + * @author Aaron Zeckoski (aaronz@vt.edu) + */ +public class HierarchyServiceImpl implements HierarchyService { + + private static Logger log = LoggerFactory.getLogger(HierarchyServiceImpl.class); + + private static int ORACLE_IN_CLAUSE_SIZE_LIMIT = 1000; + private boolean oracle = false; + + private HierarchyDao dao; + + public void setDao(HierarchyDao dao) { + this.dao = dao; + } + + private SqlService sqlService; + + public void setSqlService(SqlService sqlService) { + this.sqlService = sqlService; + } + + // private SessionManager sessionManager; + // public void setSessionManager(SessionManager sessionManager) { + // this.sessionManager = sessionManager; + // } + + public void init() { + log.info("init"); + + if(sqlService != null && "oracle".equalsIgnoreCase(sqlService.getVendor())){ + this.oracle = true; + } + + // handle any DB migration/cleanup which needs to happen (mostly for upgrades) + dao.fixupDatabase(); + } + + public HierarchyNode createHierarchy(String hierarchyId) { + if (hierarchyId.length() < 1 || hierarchyId.length() > 250) { + throw new IllegalArgumentException("Invalid hierarchyId (" + hierarchyId + + "): length must be 1 to 250 chars"); + } + + long count = dao.countBySearch(HierarchyNodeMetaData.class, + new Search("hierarchyId", hierarchyId) ); + if (count > 0) { + throw new IllegalArgumentException("Invalid hierarchyId (" + hierarchyId + + "): this id is already in use, you must use a unique id when creating a new hierarchy"); + } + + HierarchyPersistentNode pNode = new HierarchyPersistentNode(); // no children or parents to + // start + HierarchyNodeMetaData metaData = new HierarchyNodeMetaData(pNode, hierarchyId, Boolean.TRUE, null); // getCurrentUserId()); + saveNodeAndMetaData(pNode, metaData); + + return HierarchyImplUtils.makeNode(pNode, metaData); + } + + public HierarchyNode setHierarchyRootNode(String hierarchyId, String nodeId) { + HierarchyNodeMetaData metaData = getNodeMeta(nodeId); + HierarchyNodeMetaData rootMetaData = getRootNodeMetaByHierarchy(hierarchyId); + + Set entities = new HashSet(); + + if (rootMetaData != null) { + if (metaData.getId().equals(rootMetaData.getId())) { + // this node is already the root node + return HierarchyImplUtils.makeNode(metaData); + } else if (!metaData.getHierarchyId().equals(rootMetaData.getHierarchyId())) { + throw new IllegalArgumentException("Cannot move a node from one hierarchy (" + + metaData.getHierarchyId() + ") to another (" + hierarchyId + + ") and replace the root node, this could orphan nodes"); + } + rootMetaData.setIsRootNode(Boolean.FALSE); + entities.add(metaData); + } + + if (metaData.getNode().getParentIds() != null) { + throw new IllegalArgumentException("Cannot assign a node (" + nodeId + + ") to the hierarchy rootNode when it has parents"); + } + + metaData.setIsRootNode(Boolean.TRUE); + entities.add(metaData); + + dao.saveSet(entities); + return HierarchyImplUtils.makeNode(metaData); + } + + @SuppressWarnings("rawtypes") + public void destroyHierarchy(String hierarchyId) { + List l = dao.findBySearch(HierarchyNodeMetaData.class, + new Search("hierarchyId", hierarchyId) ); + if (l.isEmpty()) { + throw new IllegalArgumentException("Could not find hierarchy to remove with the following id: " + + hierarchyId); + } + + Set nodes = new HashSet(); + Set nodesMetaData = new HashSet(); + for (int i = 0; i < l.size(); i++) { + HierarchyNodeMetaData nmd = (HierarchyNodeMetaData) l.get(i); + nodesMetaData.add(nmd); + nodes.add(nmd.getNode()); + } + + Set[] entitySets = new Set[] { nodesMetaData, nodes }; + dao.deleteMixedSet(entitySets); + } + + public HierarchyNode getRootNode(String hierarchyId) { + HierarchyNodeMetaData metaData = getRootNodeMetaByHierarchy(hierarchyId); + if (metaData == null) { + return null; + } + return HierarchyImplUtils.makeNode(metaData); + } + + public HierarchyNode getNodeById(String nodeId) { + HierarchyNodeMetaData metaData = getNodeMeta(nodeId); + return HierarchyImplUtils.makeNode(metaData); + } + + + public Map getNodesByIds(String[] nodeIds) { + List nodeMetas = getNodeMetas(nodeIds); + Map m = new HashMap(); + for (HierarchyNodeMetaData metaData : nodeMetas) { + HierarchyNode node = HierarchyImplUtils.makeNode(metaData); + m.put(node.id, node); + } + return m; + } + + public Set getChildNodes(String nodeId, boolean directOnly) { + Set children = new HashSet(); + + HierarchyNodeMetaData parentMetaData = getNodeMeta(nodeId); + String childIdString = null; + if (directOnly) { + childIdString = parentMetaData.getNode().getDirectChildIds(); + } else { + childIdString = parentMetaData.getNode().getChildIds(); + } + + if (childIdString == null) { + return children; + } + + Set childrenIds = HierarchyImplUtils.makeNodeIdSet(childIdString); + List childNodeMetas = getNodeMetas(childrenIds); + for (HierarchyNodeMetaData metaData : childNodeMetas) { + children.add(HierarchyImplUtils.makeNode(metaData)); + } + return children; + } + + public Set getParentNodes(String nodeId, boolean directOnly) { + Set parents = new HashSet(); + + HierarchyNodeMetaData parentMetaData = getNodeMeta(nodeId); + String parentIdString = null; + if (directOnly) { + parentIdString = parentMetaData.getNode().getDirectParentIds(); + } else { + parentIdString = parentMetaData.getNode().getParentIds(); + } + + if (parentIdString == null) { + return parents; + } + + Set parentsIds = HierarchyImplUtils.makeNodeIdSet(parentIdString); + List parentNodeMetas = getNodeMetas(parentsIds); + for (HierarchyNodeMetaData metaData : parentNodeMetas) { + parents.add(HierarchyImplUtils.makeNode(metaData)); + } + + + return parents; + } + + public HierarchyNode addNode(String hierarchyId, String parentNodeId) { + if (parentNodeId == null) { + throw new RuntimeException("Setting parentNodeId to null is not yet supported"); + } + + // validate the parent node and hierarchy (this needs to be cached for sure) + HierarchyNodeMetaData parentNodeMeta = getNodeMeta(parentNodeId); + if (parentNodeMeta == null) { + throw new IllegalArgumentException("Invalid parent node id, cannot find node with id: " + + parentNodeId); + } + if (!parentNodeMeta.getHierarchyId().equals(hierarchyId)) { + throw new IllegalArgumentException("Invalid hierarchy id, cannot find node (" + parentNodeId + + ") in this hierarchy: " + hierarchyId); + } + + // get the set of all nodes above the new node (these will have to be updated) + Set parentNodeIds = HierarchyImplUtils.makeNodeIdSet(parentNodeMeta.getNode().getParentIds()); + parentNodeIds.add(parentNodeId); + + // create the new node and assign the new parents from our parent + HierarchyPersistentNode pNode = new HierarchyPersistentNode(HierarchyImplUtils + .makeSingleEncodedNodeIdString(parentNodeId), HierarchyImplUtils + .makeEncodedNodeIdString(parentNodeIds)); + HierarchyNodeMetaData metaData = new HierarchyNodeMetaData(pNode, hierarchyId, Boolean.FALSE, null); // getCurrentUserId()); + // save this new node (perhaps we should be saving all of these in one massive update?) -AZ + saveNodeAndMetaData(pNode, metaData); + String newNodeId = pNode.getId().toString(); + + // update all the links in the tree for this new node + List pNodesList = getNodes(parentNodeIds); + Set pNodes = new HashSet(); + for (HierarchyPersistentNode node : pNodesList) { + if (node.getId().toString().equals(parentNodeId)) { + // special case for our parent, update direct children + node.setDirectChildIds( + HierarchyImplUtils.addSingleNodeIdToEncodedString( + node.getDirectChildIds(), newNodeId)); + } + + // update the children for each node + node.setChildIds( + HierarchyImplUtils.addSingleNodeIdToEncodedString(node.getChildIds(), newNodeId)); + + // add to the set of node to be saved + pNodes.add(node); + } + dao.saveSet(pNodes); + + return HierarchyImplUtils.makeNode(pNode, metaData); + } + + public HierarchyNode removeNode(String nodeId) { + if (nodeId == null) { + throw new NullPointerException("nodeId to remove cannot be null"); + } + + // validate the node + HierarchyNodeMetaData metaData = getNodeMeta(nodeId); + if (metaData == null) { + throw new IllegalArgumentException("Invalid node id, cannot find node with id: " + nodeId); + } + if (metaData.getIsRootNode().booleanValue()) { + throw new IllegalArgumentException("Cannot remove the root node (" + nodeId + "), " + + "you must remove the entire hierarchy (" + metaData.getHierarchyId() + + ") to remove this root node"); + } + + // get the set of all nodes above the current node (these will have to be updated) + HierarchyNode currentNode = HierarchyImplUtils.makeNode(metaData); + if (currentNode.childNodeIds.size() != 0) { + throw new IllegalArgumentException("Cannot remove a node with children nodes, " + + "reduce the children on this node from " + currentNode.childNodeIds.size() + + " to 0 before attempting to remove it"); + } + + if (currentNode.directParentNodeIds.size() > 1) { + throw new IllegalArgumentException("Cannot remove a node with multiple parents, " + + "reduce the parents on this node to 1 before attempting to remove it"); + } + + // get the "main" parent node + String currentParentNodeId = getParentNodeId(currentNode); + + // update all the links in the tree for this removed node + List pNodesList = getNodes(currentNode.parentNodeIds); + Set pNodes = new HashSet(); + for (HierarchyPersistentNode pNode : pNodesList) { + if (pNode.getId().toString().equals(currentParentNodeId)) { + // special case for our parent, update direct children + Set nodeChildren = HierarchyImplUtils.makeNodeIdSet(pNode.getDirectChildIds()); + nodeChildren.remove(nodeId); + pNode.setDirectChildIds(HierarchyImplUtils.makeEncodedNodeIdString(nodeChildren)); + } + + // update the children for each node + Set nodeChildren = HierarchyImplUtils.makeNodeIdSet(pNode.getChildIds()); + nodeChildren.remove(nodeId); + pNode.setChildIds(HierarchyImplUtils.makeEncodedNodeIdString(nodeChildren)); + + // add to the set of nodes to be saved + pNodes.add(pNode); + } + dao.saveSet(pNodes); + + return HierarchyImplUtils.makeNode(getNodeMeta(currentParentNodeId)); + } + + public HierarchyNode saveNodeMetaData(String nodeId, String title, String description, String permToken) { + if (nodeId == null) { + throw new NullPointerException("nodeId to remove cannot be null"); + } + + // validate the node + HierarchyNodeMetaData metaData = getNodeMeta(nodeId); + if (metaData == null) { + throw new IllegalArgumentException("Invalid node id, cannot find node with id: " + nodeId); + } + + // update the node meta data + if (title != null) { + if (title.equals("")) { + metaData.setTitle(null); + } else { + metaData.setTitle(title); + } + } + if (description != null) { + if (description.equals("")) { + metaData.setDescription(null); + } else { + metaData.setDescription(description); + } + } + if (permToken != null) { + if (permToken.equals("")) { + metaData.setPermToken(null); + } else { + metaData.setPermToken(permToken); + } + } + + // save the node meta data + dao.save(metaData); + + return HierarchyImplUtils.makeNode(metaData); + } + + public HierarchyNode setNodeDisabled(String nodeId, Boolean isDisabled) { + + if (nodeId == null) { + throw new NullPointerException("nodeId cannot be null"); + } + + // validate the node + HierarchyNodeMetaData metaData = getNodeMeta(nodeId); + + if (metaData == null) { + throw new IllegalArgumentException("Invalid node id, cannot find node with id: " + nodeId); + } + + // update the node's isDisabled setting + if (isDisabled != null) { + metaData.setIsDisabled(isDisabled); + } + + // save the node meta data + dao.save(metaData); + + return HierarchyImplUtils.makeNode(metaData); + + } + + public HierarchyNode addChildRelation(String nodeId, String childNodeId) { + if (nodeId == null || childNodeId == null) { + throw new NullPointerException("nodeId (" + nodeId + ") and childNodeId (" + childNodeId + + ") cannot be null"); + } + + if (nodeId.equals(childNodeId)) { + throw new IllegalArgumentException("nodeId and childNodeId cannot be the same: " + nodeId); + } + + HierarchyNodeMetaData metaData = getNodeMeta(nodeId); + if (metaData == null) { + throw new IllegalArgumentException("Invalid nodeId: " + nodeId); + } + + HierarchyNodeMetaData addMetaData = getNodeMeta(childNodeId); + if (addMetaData == null) { + throw new IllegalArgumentException("Invalid childNodeId: " + childNodeId); + } + + HierarchyNode currentNode = HierarchyImplUtils.makeNode(metaData); + // only add this if it is not already in there + if (!currentNode.directChildNodeIds.contains(childNodeId)) { + // first check for a cycle + if (currentNode.childNodeIds.contains(childNodeId) + || currentNode.parentNodeIds.contains(childNodeId)) { + throw new IllegalArgumentException("Cannot add " + childNodeId + " as a child of " + nodeId + + " because it is already in the node tree directly above or below this node"); + } + + // now we go ahead and update this node and all the related nodes + HierarchyNode addNode = HierarchyImplUtils.makeNode(addMetaData); + Set pNodes = new HashSet(); + + // update the current node + metaData.getNode().setDirectChildIds( + HierarchyImplUtils.addSingleNodeIdToEncodedString( + metaData.getNode().getDirectChildIds(), childNodeId)); + metaData.getNode().setChildIds( + HierarchyImplUtils.addSingleNodeIdToEncodedString( + metaData.getNode().getChildIds(), childNodeId)); + pNodes.add(metaData.getNode()); + + // update the add node + addMetaData.getNode().setDirectParentIds( + HierarchyImplUtils.addSingleNodeIdToEncodedString( + addMetaData.getNode().getDirectParentIds(), nodeId)); + addMetaData.getNode().setParentIds( + HierarchyImplUtils.addSingleNodeIdToEncodedString( + addMetaData.getNode().getParentIds(),nodeId)); + pNodes.add(addMetaData.getNode()); + + // update the parents of the current node (they have new children) + List pNodesList = getNodes(currentNode.parentNodeIds); + Set nodesToAdd = addNode.childNodeIds; + nodesToAdd.add(addNode.id); + for (HierarchyPersistentNode pNode : pNodesList) { + // update the children for each node + Set nodeChildren = HierarchyImplUtils.makeNodeIdSet(pNode.getChildIds()); + nodeChildren.addAll(nodesToAdd); + pNode.setChildIds(HierarchyImplUtils.makeEncodedNodeIdString(nodeChildren)); + + // add to the set of nodes to be saved + pNodes.add(pNode); + } + + // update the children of the add node (they have new parants) + pNodesList = getNodes(addNode.childNodeIds); + nodesToAdd = currentNode.parentNodeIds; + nodesToAdd.add(currentNode.id); + for (HierarchyPersistentNode pNode : pNodesList) { + // update the parents for each node + Set parents = HierarchyImplUtils.makeNodeIdSet(pNode.getParentIds()); + parents.addAll(nodesToAdd); + pNode.setParentIds(HierarchyImplUtils.makeEncodedNodeIdString(parents)); + + // add to the set of nodes to be saved + pNodes.add(pNode); + } + + dao.saveSet(pNodes); + } + + return HierarchyImplUtils.makeNode(metaData); + } + + public HierarchyNode removeChildRelation(String nodeId, String childNodeId) { + if (nodeId == null || childNodeId == null) { + throw new NullPointerException("nodeId (" + nodeId + ") and childNodeId (" + childNodeId + + ") cannot be null"); + } + + if (nodeId.equals(childNodeId)) { + throw new IllegalArgumentException("nodeId and childNodeId cannot be the same: " + nodeId); + } + + HierarchyNodeMetaData metaData = getNodeMeta(nodeId); + if (metaData == null) { + throw new IllegalArgumentException("Invalid nodeId: " + nodeId); + } + + HierarchyNodeMetaData removeMetaData = getNodeMeta(childNodeId); + if (removeMetaData == null) { + throw new IllegalArgumentException("Invalid childNodeId: " + childNodeId); + } + + HierarchyNode currentNode = HierarchyImplUtils.makeNode(metaData); + // only do something if this child is a direct child of this node + if (currentNode.directChildNodeIds.contains(childNodeId)) { + // first check for orphaning + HierarchyNode removeNode = HierarchyImplUtils.makeNode(removeMetaData); + if (removeNode.directParentNodeIds.size() <= 1) { + throw new IllegalArgumentException("Cannot remove " + childNodeId + " as a child of " + nodeId + + " because it would orphan the child node, you need to use the remove method" + + "if you want to remove a node or add this node as the child of another node first"); + } + + // now we go ahead and update this node and all the related nodes + Set pNodes = new HashSet(); + Set nodes = null; + + // update the current node + nodes = HierarchyImplUtils.makeNodeIdSet(metaData.getNode().getChildIds()); + nodes.remove(childNodeId); + metaData.getNode().setChildIds(HierarchyImplUtils.makeEncodedNodeIdString(nodes)); + nodes = HierarchyImplUtils.makeNodeIdSet(metaData.getNode().getDirectChildIds()); + nodes.remove(childNodeId); + metaData.getNode().setDirectChildIds(HierarchyImplUtils.makeEncodedNodeIdString(nodes)); + pNodes.add(metaData.getNode()); + + // update the remove node + nodes = HierarchyImplUtils.makeNodeIdSet(removeMetaData.getNode().getParentIds()); + nodes.remove(nodeId); + removeMetaData.getNode().setParentIds(HierarchyImplUtils.makeEncodedNodeIdString(nodes)); + nodes = HierarchyImplUtils.makeNodeIdSet(removeMetaData.getNode().getDirectParentIds()); + nodes.remove(nodeId); + removeMetaData.getNode().setDirectParentIds(HierarchyImplUtils.makeEncodedNodeIdString(nodes)); + pNodes.add(removeMetaData.getNode()); + + // update the parents of the current node (they have less children) + List pNodesList = getNodes(currentNode.parentNodeIds); + Set nodesToRemove = removeNode.childNodeIds; + nodesToRemove.add(removeNode.id); + for (HierarchyPersistentNode pNode : pNodesList) { + // update the children for each node + Set children = HierarchyImplUtils.makeNodeIdSet(pNode.getChildIds()); + children.removeAll(nodesToRemove); + // add back in all the children of the currentNode because we may have + // taken out part of the tree below where if it connects to the children of removeNode + children.addAll(currentNode.childNodeIds); + pNode.setChildIds(HierarchyImplUtils.makeEncodedNodeIdString(children)); + + // add to the set of nodes to be saved + pNodes.add(pNode); + } + + // update the children of the remove node (they have lost parents) + pNodesList = getNodes(removeNode.childNodeIds); + nodesToRemove = currentNode.parentNodeIds; + nodesToRemove.add(currentNode.id); + for (HierarchyPersistentNode pNode : pNodesList) { + // update the parents for each node + Set parents = HierarchyImplUtils.makeNodeIdSet(pNode.getParentIds()); + parents.removeAll(nodesToRemove); + // add back in all the parents of the removeNode because we will have + // taken out part of the tree above where it reconnects on the way to the root + parents.addAll(removeNode.parentNodeIds); + pNode.setParentIds(HierarchyImplUtils.makeEncodedNodeIdString(parents)); + + // add to the set of nodes to be saved + pNodes.add(pNode); + } + + dao.saveSet(pNodes); + + } + + return HierarchyImplUtils.makeNode(metaData); + } + + public HierarchyNode addParentRelation(String nodeId, String parentNodeId) { + // TODO Not implemented yet - not sure we even want to allow this + throw new RuntimeException("This method is not implemented yet"); + } + + public HierarchyNode removeParentRelation(String nodeId, String parentNodeId) { + // TODO Not implemented yet - not sure this is even a good idea + throw new RuntimeException("This method is not implemented yet"); + } + + + public Set getNodesWithToken(String hierarchyId, String permToken) { + if (permToken == null || permToken.equals("")) { + throw new NullPointerException("permToken cannot be null or empty string"); + } + + List l = dao.findBySearch(HierarchyNodeMetaData.class, + new Search("hierarchyId", hierarchyId) ); + if (l.isEmpty()) { + throw new IllegalArgumentException("Could not find hierarchy with the following id: " + + hierarchyId); + } + + List nodeIdsList = dao.findBySearch(HierarchyNodeMetaData.class, + new Search(new Restriction[] { + new Restriction("hierarchyId", hierarchyId), + new Restriction("permToken", permToken) + }, new Order("node.id"))); + + Set nodeIds = new TreeSet(); + for (Iterator iter = nodeIdsList.iterator(); iter.hasNext();) { + HierarchyNodeMetaData metaData = iter.next(); + nodeIds.add(metaData.getNode().getId().toString()); + } + + return nodeIds; + } + + public Map> getNodesWithTokens(String hierarchyId, String[] permTokens) { + // it would be better if this were more efficient... + if (permTokens == null) { + throw new NullPointerException("permTokens cannot be null"); + } + + Map> tokenNodes = new HashMap>(); + for (int i = 0; i < permTokens.length; i++) { + Set nodeIds = getNodesWithToken(hierarchyId, permTokens[i]); + tokenNodes.put(permTokens[i], nodeIds); + } + + return tokenNodes; + } + + // PERMISSIONS + + public void assignUserNodePerm(String userId, String nodeId, String hierarchyPermission, boolean cascade) { + if (userId == null || "".equals(userId) + || nodeId == null || "".equals(nodeId) + || hierarchyPermission == null || "".equals(hierarchyPermission)) { + throw new IllegalArgumentException("Invalid arguments to assignUserNodePerm, no arguments can be null or blank: userId="+userId+", nodeId="+nodeId+", hierarchyPermission="+hierarchyPermission); + } + HierarchyNodePermission nodePerm = dao.findOneBySearch(HierarchyNodePermission.class, new Search( + new Restriction[] { + new Restriction("userId", userId), + new Restriction("nodeId", nodeId), + new Restriction("permission", hierarchyPermission) + })); + if (nodePerm == null) { + // validate the nodeId + Long nodeIdeNum; + try { + nodeIdeNum = new Long(nodeId); + } catch (NumberFormatException e) { + throw new IllegalArgumentException("Node id ("+nodeId+") provided is invalid, must be a valid identifier from an existing node"); + } + // check it exists + HierarchyPersistentNode pNode = dao.findById(HierarchyPersistentNode.class, nodeIdeNum); + if (pNode == null) { + throw new IllegalArgumentException("Node id ("+nodeId+") provided is invalid, node does not exist"); + } + // create the perm + dao.create( new HierarchyNodePermission(userId, nodeId, hierarchyPermission) ); + } else { + // permission already set, do nothing + } + if (cascade) { + // cascade the permission creation + HierarchyNode node = getNodeById(nodeId); + if (node != null + && node.childNodeIds != null + && node.childNodeIds.size() > 0) { + List nodeIdsList = new ArrayList(node.childNodeIds); + + int i = 0; + List nodePerms = new ArrayList(); + do{ + int arraySize = nodeIdsList.size() - i; + if(oracle && arraySize > ORACLE_IN_CLAUSE_SIZE_LIMIT){ + arraySize = ORACLE_IN_CLAUSE_SIZE_LIMIT; + } + // get all the permissions which are related to the nodes under this one + List nodePermsItteration = dao.findBySearch(HierarchyNodePermission.class, new Search( + new Restriction[] { + new Restriction("userId", userId), + new Restriction("permission", hierarchyPermission), + new Restriction("nodeId", nodeIdsList.subList(i, i + arraySize).toArray()) + })); + nodePerms.addAll(nodePermsItteration); + i += arraySize; + }while(i < nodeIdsList.size()); + + Set allPerms = new HashSet(); + if (nodePerms.size() == 0) { + // add all new ones + for (String childNodeId : node.childNodeIds) { + allPerms.add( new HierarchyNodePermission(userId, childNodeId, hierarchyPermission) ); + } + } else { + // only add the missing ones + Set existingPermNodeIds = new HashSet(); + for (HierarchyNodePermission hierNodePerm : nodePerms) { + existingPermNodeIds.add( hierNodePerm.getNodeId() ); + } + for (String childNodeId : node.childNodeIds) { + if (! existingPermNodeIds.contains(nodeId)) { + allPerms.add( new HierarchyNodePermission(userId, childNodeId, hierarchyPermission) ); + } + } + } + if (nodePerms.size() == node.childNodeIds.size() + || allPerms.size() == 0) { + // nothing to do here, all permissions already exist or there are none to add + } else { + // save the new permissions + dao.saveSet( new HashSet(allPerms) ); + } + } + } + } + + public void removeUserNodePerm(String userId, String nodeId, String hierarchyPermission, boolean cascade) { + if (userId == null || "".equals(userId) + || nodeId == null || "".equals(nodeId) + || hierarchyPermission == null || "".equals(hierarchyPermission)) { + throw new IllegalArgumentException("Invalid arguments to removeUserNodePerm, no arguments can be null or blank: userId="+userId+", nodeId="+nodeId+", hierarchyPermission="+hierarchyPermission); + } + if (! cascade) { + // delete the current permission if it can be found + HierarchyNodePermission nodePerm = dao.findOneBySearch(HierarchyNodePermission.class, new Search( + new Restriction[] { + new Restriction("userId", userId), + new Restriction("nodeId", nodeId), + new Restriction("permission", hierarchyPermission) + })); + if (nodePerm == null) { + // not found, nothing to do + } else { + dao.delete(nodePerm); + } + } else { + // cascade the permission removal and delete current one as well + HierarchyNode node = getNodeById(nodeId); + if (node != null) { + HashSet nodeIdsSet = new HashSet(); + nodeIdsSet.add(nodeId); + // add in child nodes if there are any + if (node.childNodeIds != null + && node.childNodeIds.size() > 0) { + nodeIdsSet.addAll(node.childNodeIds); + } + List nodeIdsList = new ArrayList(nodeIdsSet); + int i = 0; + do{ + int arraySize = nodeIdsList.size() - i; + if(oracle && arraySize > ORACLE_IN_CLAUSE_SIZE_LIMIT){ + arraySize = ORACLE_IN_CLAUSE_SIZE_LIMIT; + } + // get all the permissions which are related to the nodes under this one + List nodePerms = dao.findBySearch(HierarchyNodePermission.class, new Search( + new Restriction[] { + new Restriction("userId", userId), + new Restriction("permission", hierarchyPermission), + new Restriction("nodeId", nodeIdsList.subList(i, i + arraySize).toArray()) + })); + if (nodePerms.size() > 0) { + // delete all as one operation + dao.deleteSet( new HashSet(nodePerms) ); + } + i += arraySize; + }while(i < nodeIdsList.size()); + } + } + } + + public boolean checkUserNodePerm(String userId, String nodeId, String hierarchyPermission) { + if (userId == null || "".equals(userId) + || nodeId == null || "".equals(nodeId) + || hierarchyPermission == null || "".equals(hierarchyPermission)) { + throw new IllegalArgumentException("Invalid arguments to checkUserNodePerm, no arguments can be null or blank: userId="+userId+", nodeId="+nodeId+", hierarchyPermission="+hierarchyPermission); + } + boolean allowed = false; + HierarchyNodePermission nodePerm = dao.findOneBySearch(HierarchyNodePermission.class, new Search( + new Restriction[] { + new Restriction("userId", userId), + new Restriction("nodeId", nodeId), + new Restriction("permission", hierarchyPermission) + })); + if (nodePerm != null) { + allowed = true; + } + return allowed; + } + + public Set getNodesForUserPerm(String userId, String hierarchyPermission) { + if (userId == null || "".equals(userId) + || hierarchyPermission == null || "".equals(hierarchyPermission)) { + throw new IllegalArgumentException("Invalid arguments to getNodesForUserPerm, no arguments can be null or blank: userId="+userId+", hierarchyPermission="+hierarchyPermission); + } + Set nodes = new HashSet(); + List nodePerms = dao.findBySearch(HierarchyNodePermission.class, new Search( + new Restriction[] { + new Restriction("userId", userId), + new Restriction("permission", hierarchyPermission) + })); + Set nodeIds = new HashSet(); + for (HierarchyNodePermission nodePerm : nodePerms) { + nodeIds.add( nodePerm.getNodeId() ); + } + List nodeMetas = getNodeMetas(nodeIds); + for (HierarchyNodeMetaData metaData : nodeMetas) { + nodes.add( HierarchyImplUtils.makeNode(metaData) ); + } + return nodes; + } + + public Set getUserIdsForNodesPerm(String[] nodeIds, String hierarchyPermission) { + if (nodeIds == null + || hierarchyPermission == null || "".equals(hierarchyPermission)) { + throw new IllegalArgumentException("Invalid arguments to getUserIdsForNodesPerm, no arguments can be null or blank: hierarchyPermission="+hierarchyPermission); + } + Set userIds = new HashSet(); + if (nodeIds.length > 0) { + List nodeIdsList = new ArrayList(Arrays.asList(nodeIds)); + int i = 0; + do{ + int arraySize = nodeIdsList.size() - i; + if(oracle && arraySize > ORACLE_IN_CLAUSE_SIZE_LIMIT){ + arraySize = ORACLE_IN_CLAUSE_SIZE_LIMIT; + } + List nodePerms = dao.findBySearch(HierarchyNodePermission.class, new Search( + new Restriction[] { + new Restriction("nodeId", nodeIdsList.subList(i, i + arraySize).toArray()), + new Restriction("permission", hierarchyPermission) + })); + for (HierarchyNodePermission nodePerm : nodePerms) { + userIds.add( nodePerm.getUserId() ); + } + i += arraySize; + }while(i < nodeIdsList.size()); + } + return userIds; + } + + public Set getPermsForUserNodes(String userId, String[] nodeIds) { + if (userId == null || "".equals(userId) + || nodeIds == null ) { + throw new IllegalArgumentException("Invalid arguments to getPermsForUserNodes, no arguments can be null or blank: userId="+userId); + } + Set perms = new HashSet(); + if (nodeIds.length > 0) { + List nodeIdsList = new ArrayList(Arrays.asList(nodeIds)); + int i = 0; + do{ + int arraySize = nodeIdsList.size() - i; + if(oracle && arraySize > ORACLE_IN_CLAUSE_SIZE_LIMIT){ + arraySize = ORACLE_IN_CLAUSE_SIZE_LIMIT; + } + List nodePerms = dao.findBySearch(HierarchyNodePermission.class, new Search( + new Restriction[] { + new Restriction("userId", userId), + new Restriction("nodeId", nodeIdsList.subList(i, i + arraySize).toArray()) + })); + for (HierarchyNodePermission nodePerm : nodePerms) { + perms.add( nodePerm.getPermission() ); + } + i += arraySize; + }while(i < nodeIdsList.size()); + } + return perms; + } + + public Map>> getUsersAndPermsForNodes(String... nodeIds) { + if (nodeIds == null || nodeIds.length == 0) { + throw new IllegalArgumentException("Invalid arguments to getUsersAndPermsForNodes, no arguments can be null or blank: nodeIds="+nodeIds); + } + Map>> m = new HashMap>>(); + for (String nodeId : nodeIds) { + m.put(nodeId, new HashMap>()); + } + List nodePerms = new ArrayList(); + List nodeIdsList = new ArrayList(Arrays.asList(nodeIds)); + int i = 0; + do{ + int arraySize = nodeIdsList.size() - i; + if(oracle && arraySize > ORACLE_IN_CLAUSE_SIZE_LIMIT){ + arraySize = ORACLE_IN_CLAUSE_SIZE_LIMIT; + } + List nodePermsItteration = dao.findBySearch(HierarchyNodePermission.class, + new Search("nodeId", nodeIdsList.subList(i, i + arraySize).toArray())); + nodePerms.addAll(nodePermsItteration); + i += arraySize; + }while(i < nodeIdsList.size()); + + // nodeId -> (map of userId -> Set(permission)) + for (HierarchyNodePermission nodePerm : nodePerms) { + String nodeId = nodePerm.getNodeId(); + if (! m.containsKey(nodeId)) { + continue; // this should not really happen but better safe than sorry + } + String userId = nodePerm.getUserId(); + if (! m.get(nodeId).containsKey(userId) ) { + m.get(nodeId).put(userId, new HashSet() ); + } + m.get(nodeId).get(userId).add( nodePerm.getPermission() ); + } + return m; + } + + public Map>> getNodesAndPermsForUser(String... userIds) { + if (userIds == null || userIds.length == 0) { + throw new IllegalArgumentException("Invalid arguments to getNodesAndPermsForUser, no arguments can be null or blank: userIds="+userIds); + } + Map>> m = new HashMap>>(); + for (String userId : userIds) { + m.put(userId, new HashMap>()); + } + List userIdsList = new ArrayList(Arrays.asList(userIds)); + int i = 0; + List nodePerms = new ArrayList(); + do{ + int arraySize = userIdsList.size() - i; + if(oracle && arraySize > ORACLE_IN_CLAUSE_SIZE_LIMIT){ + arraySize = ORACLE_IN_CLAUSE_SIZE_LIMIT; + } + List nodePermsItteration = dao.findBySearch(HierarchyNodePermission.class, + new Search("userId", userIdsList.subList(i, i + arraySize).toArray())); + nodePerms.addAll(nodePermsItteration); + i += arraySize; + }while(i < userIdsList.size()); + + // userId -> (map of nodeId -> Set(permission)) + for (HierarchyNodePermission nodePerm : nodePerms) { + String userId = nodePerm.getUserId(); + if (! m.containsKey(userId)) { + continue; // this should not really happen but better safe than sorry + } + String nodeId = nodePerm.getNodeId(); + if (! m.get(userId).containsKey(nodeId) ) { + m.get(userId).put(nodeId, new HashSet() ); + } + m.get(userId).get(nodeId).add( nodePerm.getPermission() ); + } + return m; + } + + // PRIVATE + + + /** + * Convenience method to save a node and metadata in one transaction + * + * @param pNode + * @param metaData + */ + @SuppressWarnings("rawtypes") + private void saveNodeAndMetaData(HierarchyPersistentNode pNode, HierarchyNodeMetaData metaData) { + Set pNodes = new HashSet(); + pNodes.add(pNode); + Set metaDatas = new HashSet(); + metaDatas.add(metaData); + Set[] entitySets = new Set[] { pNodes, metaDatas }; + dao.saveMixedSet(entitySets); + /* NORMALLY the code below should not be needed, however, + * we are seeing weird cases where the line above fails to create the metadata + * so the code below is meant to detect that case and correct it by saving + * each separately and realigning the ids manually + */ + if (metaData.getId() == null) { + // something went wrong and we're not sure what so delete pNode + if (pNode.getId() != null) { + dao.delete(pNode); + } + throw new RuntimeException("Metadata didn't save, node was removed: "+pNode); + } else if (pNode.getId() == null) { + // something went wrong and we're not sure what so delete metadata + if (metaData.getId() != null) { + dao.delete(metaData); + } + throw new RuntimeException("Metadata didn't save, metaData was removed: "+metaData); + } else if (!metaData.getId().equals(pNode.getId())) { + // the indexes are off... let's try to get them back in sync + int i = 0; + if (pNode.getId() > metaData.getId()) { + while (i < 100 && metaData.getId() != null && pNode.getId() != metaData.getId()) { + // need to keep saving metaData until it's sequence has caught up + dao.delete(metaData); + // set ID back to null to make it save with a new incremented ID + metaData.setId(null); + dao.save(metaData); + i++; + } + } else { + while (i < 100 && pNode.getId() != null && pNode.getId() != metaData.getId()) { + // need to keep saving node until it's sequence has caught up + dao.delete(pNode); + // set ID back to null to make it save with a new incremented ID + pNode.setId(null); + dao.save(pNode); + i++; + } + } + if (pNode.getId() == null || metaData.getId() == null || pNode.getId() != metaData.getId()) { + // ok we tried, it didn't work, so throw the exception + throw new RuntimeException("Node ID: " + pNode.getId() + " doesn't match Metadata ID: " + metaData.getId()); + } + } + } + + /** + * Fetch node data from storage + * + * @param nodeId + * @return a {@link HierarchyNodeMetaData} or null if not found + */ + private HierarchyNodeMetaData getNodeMeta(String nodeId) { + List l = dao.findBySearch(HierarchyNodeMetaData.class, + new Search("node.id", new Long(nodeId))); + if (l.size() > 1) { + throw new IllegalStateException("Invalid hierarchy state: more than one node with id: " + nodeId); + } else if (l.size() == 1) { + return l.get(0); + } else { + return null; + } + } + + /** + * Find the current root node + * + * @param hierarchyId + * @return the root {@link HierarchyNodeMetaData} of the hierarchy + */ + private HierarchyNodeMetaData getRootNodeMetaByHierarchy(String hierarchyId) { + List l = dao.findBySearch(HierarchyNodeMetaData.class, + new Search(new Restriction[] { + new Restriction("hierarchyId", hierarchyId), + new Restriction("isRootNode", Boolean.TRUE) + }) ); + if (l.size() > 1) { + throw new IllegalStateException("Invalid hierarchy state: more than one root node for hierarchyId: " + + hierarchyId); + } else if (l.size() == 1) { + return l.get(0); + } else { + return null; + } + } + + /** + * Get all nodes and meta data based on a set of nodeIds + * + * @param nodeIds + * @return + */ + private List getNodeMetas(Set nodeIds) { + return getNodeMetas(nodeIds.toArray(new String[] {})); + } + + private List getNodeMetas(String[] nodeIds) { + List l = null; + if (nodeIds == null || nodeIds.length == 0) { + l = new ArrayList(); + } else { + Long[] pNodeIds = new Long[nodeIds.length]; + for (int i = 0; i < nodeIds.length; i++) { + pNodeIds[i] = new Long(nodeIds[i]); + } + l = new ArrayList(); + List nodeIdsList = new ArrayList(Arrays.asList(pNodeIds)); + int i = 0; + do{ + int arraySize = nodeIdsList.size() - i; + if(oracle && arraySize > ORACLE_IN_CLAUSE_SIZE_LIMIT){ + arraySize = ORACLE_IN_CLAUSE_SIZE_LIMIT; + } + List lIterration = dao.findBySearch(HierarchyNodeMetaData.class, + new Search("node.id", nodeIdsList.subList(i, i + arraySize).toArray()) ); + l.addAll(lIterration); + i += arraySize; + }while(i < nodeIdsList.size()); + } + return l; + } + + /** + * Get all nodes only based on a set of nodeIds + * + * @param nodeIds + * @return + */ + private List getNodes(Set nodeIds) { + return getNodes(nodeIds.toArray(new String[] {})); + } + + private List getNodes(String[] nodeIds) { + List l = null; + if (nodeIds == null || nodeIds.length == 0) { + l = new ArrayList(); + } else { + Long[] pNodeIds = new Long[nodeIds.length]; + for (int i = 0; i < nodeIds.length; i++) { + pNodeIds[i] = new Long(nodeIds[i]); + } + l = new ArrayList(); + List nodeIdsList = new ArrayList(Arrays.asList(pNodeIds)); + int i = 0; + do{ + int arraySize = nodeIdsList.size() - i; + if(oracle && arraySize > ORACLE_IN_CLAUSE_SIZE_LIMIT){ + arraySize = ORACLE_IN_CLAUSE_SIZE_LIMIT; + } + List lIterration = dao.findBySearch(HierarchyPersistentNode.class, + new Search("id", nodeIdsList.subList(i, i + arraySize).toArray()) ); + l.addAll(lIterration); + i += arraySize; + }while(i < nodeIdsList.size()); + } + return l; + } + + /** + * Find the direct parent node id for a node + * @param node + * @return the node if or null if none exists + */ + private String getParentNodeId(HierarchyNode node) { + String parentNodeId = null; + if (node.directParentNodeIds != null && + node.directParentNodeIds.size() > 0) { + parentNodeId = node.directParentNodeIds.iterator().next(); + } + return parentNodeId; + } + +} diff --git a/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/ConnectionProviderDelegate.java b/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/ConnectionProviderDelegate.java index 123c2daf0c74..b2c0dfbea92d 100644 --- a/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/ConnectionProviderDelegate.java +++ b/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/ConnectionProviderDelegate.java @@ -26,15 +26,15 @@ import javax.sql.DataSource; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.utils.ConnectionProvider; import org.sakaiproject.component.cover.ComponentManager; public class ConnectionProviderDelegate implements ConnectionProvider { - private static final Log LOG = LogFactory.getLog(ConnectionProviderDelegate.class); + private static final Logger LOG = LoggerFactory.getLogger(ConnectionProviderDelegate.class); private static DataSource ds; @@ -68,4 +68,4 @@ public void shutdown() throws SQLException { public void initialize() throws SQLException { } -} \ No newline at end of file +} diff --git a/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/DelayedInvocationReader.java b/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/DelayedInvocationReader.java index fc8d217dbb51..88dc402d409c 100644 --- a/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/DelayedInvocationReader.java +++ b/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/DelayedInvocationReader.java @@ -1,4 +1,4 @@ -/****************************************************************************** +/****************************************************************************** * Copyright (c) 2007, 2008 The Sakai Foundation * * Licensed under the Educational Community License, Version 2.0 (the "License"); @@ -12,43 +12,43 @@ * 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.sakaiproject.component.app.scheduler; - -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.sakaiproject.api.app.scheduler.DelayedInvocation; -import org.sakaiproject.db.api.SqlReader; - -/** - * An SQLReader so we can get the info out of the DB reasonably - * - * @author Aaron Zeckoski (aaronz@vt.edu) - */ -public class DelayedInvocationReader implements SqlReader { - - private static final Log LOG = LogFactory.getLog(DelayedInvocationReader.class); - - public Object readSqlResultRecord(ResultSet result) { - - DelayedInvocation invocation = new DelayedInvocation(); - - try { - invocation.uuid = result.getString("INVOCATION_ID"); - invocation.date = result.getTimestamp("INVOCATION_TIME"); - invocation.componentId = result.getString("COMPONENT"); - invocation.contextId = result.getString("CONTEXT"); - } catch (SQLException e) { - LOG.error("SqlException: " + e); - return null; - } - - return invocation; - } - -} + * + *****************************************************************************/ + +package org.sakaiproject.component.app.scheduler; + +import java.sql.ResultSet; +import java.sql.SQLException; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sakaiproject.api.app.scheduler.DelayedInvocation; +import org.sakaiproject.db.api.SqlReader; + +/** + * An SQLReader so we can get the info out of the DB reasonably + * + * @author Aaron Zeckoski (aaronz@vt.edu) + */ +public class DelayedInvocationReader implements SqlReader { + + private static final Logger LOG = LoggerFactory.getLogger(DelayedInvocationReader.class); + + public Object readSqlResultRecord(ResultSet result) { + + DelayedInvocation invocation = new DelayedInvocation(); + + try { + invocation.uuid = result.getString("INVOCATION_ID"); + invocation.date = result.getTimestamp("INVOCATION_TIME"); + invocation.componentId = result.getString("COMPONENT"); + invocation.contextId = result.getString("CONTEXT"); + } catch (SQLException e) { + LOG.error("SqlException: " + e); + return null; + } + + return invocation; + } + +} diff --git a/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/NavigableEventLogListener.java b/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/NavigableEventLogListener.java index 0f9a9b14bbad..37423927194a 100644 --- a/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/NavigableEventLogListener.java +++ b/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/NavigableEventLogListener.java @@ -1,7 +1,7 @@ package org.sakaiproject.component.app.scheduler; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.JobDataMap; import org.quartz.JobDetail; import org.quartz.JobExecutionContext; @@ -22,8 +22,8 @@ */ public class NavigableEventLogListener implements TriggerListener, JobListener { - private final static Log - LOG = LogFactory.getLog(NavigableEventLogListener.class.getName() + ".jobExecutions"); + private final static Logger + LOG = LoggerFactory.getLogger(NavigableEventLogListener.class.getName() + ".jobExecutions"); private static enum EVENTTYPE { diff --git a/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/ScheduledInvocationManagerImpl.java b/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/ScheduledInvocationManagerImpl.java index e2daad52d32a..e72a2fa9f98a 100644 --- a/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/ScheduledInvocationManagerImpl.java +++ b/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/ScheduledInvocationManagerImpl.java @@ -3,8 +3,8 @@ import java.util.Date; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.JobBuilder; import org.quartz.JobDetail; import org.quartz.Scheduler; @@ -26,7 +26,7 @@ public class ScheduledInvocationManagerImpl implements ScheduledInvocationManager { - private static final Log LOG = LogFactory.getLog(ScheduledInvocationManagerImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(ScheduledInvocationManagerImpl.class); private static final String SCHEDULED_INVOCATION_RUNNER_DEFAULT_INTERVAL_PROPERTY = "jobscheduler.invocation.interval"; diff --git a/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/SchedulerManagerImpl.java b/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/SchedulerManagerImpl.java index 8b72f89b437e..c457bd1d4cf2 100644 --- a/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/SchedulerManagerImpl.java +++ b/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/SchedulerManagerImpl.java @@ -39,8 +39,8 @@ import javax.sql.DataSource; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.CronScheduleBuilder; import org.quartz.Job; import org.quartz.JobBuilder; @@ -71,7 +71,7 @@ public class SchedulerManagerImpl implements SchedulerManager { - private static final Log LOG = LogFactory.getLog(SchedulerManagerImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(SchedulerManagerImpl.class); public final static String SCHEDULER_LOADJOBS = "scheduler.loadjobs"; private DataSource dataSource; diff --git a/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/AuthzGroupProviderSync.java b/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/AuthzGroupProviderSync.java index e985659f1b63..49c3fa1d4c4a 100644 --- a/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/AuthzGroupProviderSync.java +++ b/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/AuthzGroupProviderSync.java @@ -5,8 +5,8 @@ import java.util.List; import java.util.NoSuchElementException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.quartz.StatefulJob; @@ -26,7 +26,7 @@ */ public class AuthzGroupProviderSync implements StatefulJob { - private static final Log log = LogFactory.getLog(AuthzGroupProviderSync.class); + private static final Logger log = LoggerFactory.getLogger(AuthzGroupProviderSync.class); // If it's been modified in the last hour ignore it. private long refreshAge = 3600000; diff --git a/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/ContentCheckJob.java b/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/ContentCheckJob.java index c85d4a071606..d6de73514cd3 100644 --- a/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/ContentCheckJob.java +++ b/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/ContentCheckJob.java @@ -4,8 +4,8 @@ import org.apache.commons.io.IOUtils; import org.apache.commons.io.input.CountingInputStream; import org.apache.commons.io.output.NullOutputStream; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; @@ -45,7 +45,7 @@ */ public class ContentCheckJob implements Job { - private final static Log log = LogFactory.getLog(ContentCheckJob.class); + private final static Logger log = LoggerFactory.getLogger(ContentCheckJob.class); public static final String ALGORITHM = "MD5"; private ContentHostingService chs; diff --git a/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/SakaiEventArchiveJob.java b/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/SakaiEventArchiveJob.java index ff8c95e7c293..74cd1320523f 100644 --- a/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/SakaiEventArchiveJob.java +++ b/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/SakaiEventArchiveJob.java @@ -5,8 +5,8 @@ import java.sql.SQLException; import java.sql.Timestamp; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; @@ -15,7 +15,7 @@ public class SakaiEventArchiveJob implements Job { - private static final Log LOG = LogFactory.getLog(SakaiEventArchiveJob.class); + private static final Logger LOG = LoggerFactory.getLogger(SakaiEventArchiveJob.class); private static final String DEFAULT_ARCHIVE_LENGTH = "86400000"; diff --git a/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/ScheduledInvocationRunner.java b/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/ScheduledInvocationRunner.java index 7b22d3d9cf62..183c06b5863d 100644 --- a/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/ScheduledInvocationRunner.java +++ b/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/ScheduledInvocationRunner.java @@ -3,8 +3,8 @@ import java.util.Iterator; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.StatefulJob; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; @@ -18,7 +18,7 @@ public class ScheduledInvocationRunner implements StatefulJob { - private static final Log LOG = LogFactory.getLog(ScheduledInvocationRunner.class); + private static final Logger LOG = LoggerFactory.getLogger(ScheduledInvocationRunner.class); /* (non-Javadoc) diff --git a/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/SoftSiteDeletionJob.java b/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/SoftSiteDeletionJob.java index 231095b99a0c..d924960a7dfa 100644 --- a/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/SoftSiteDeletionJob.java +++ b/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/SoftSiteDeletionJob.java @@ -7,8 +7,8 @@ import lombok.Setter; import lombok.extern.apachecommons.CommonsLog; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; diff --git a/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/backfillrole/BackFillRoleJob.java b/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/backfillrole/BackFillRoleJob.java index 2b80f3b554a5..33daac790d52 100644 --- a/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/backfillrole/BackFillRoleJob.java +++ b/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/backfillrole/BackFillRoleJob.java @@ -1,7 +1,7 @@ package org.sakaiproject.component.app.scheduler.jobs.backfillrole; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; @@ -26,7 +26,7 @@ public class BackFillRoleJob implements Job { private static final String TEMPLATE_PREFIX = "!site.template"; - private final Log log = LogFactory.getLog(BackFillRoleJob.class); + private final Logger log = LoggerFactory.getLogger(BackFillRoleJob.class); private SiteService siteService; @@ -124,7 +124,7 @@ protected void processSites(AuthzGroup defaultTemplate, String type, int interva continue; } examined++; - // Log progress + // Logger progress if (interval != 0 && examined % interval == 0) { log.info("Processed: "+ examined); } diff --git a/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/backfilltool/BackFillToolJob.java b/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/backfilltool/BackFillToolJob.java index 2dc424e4a544..57d5382699cf 100644 --- a/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/backfilltool/BackFillToolJob.java +++ b/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/backfilltool/BackFillToolJob.java @@ -1,7 +1,7 @@ package org.sakaiproject.component.app.scheduler.jobs.backfilltool; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; @@ -23,7 +23,7 @@ */ public class BackFillToolJob implements Job { - private final Log log = LogFactory.getLog(BackFillToolJob.class); + private final Logger log = LoggerFactory.getLogger(BackFillToolJob.class); private SiteService siteService; @@ -124,7 +124,7 @@ protected void processSites(JobExecutionContext context, String type, int interv continue; } examined++; - // Log progress + // Logger progress if (interval != 0 && examined % interval == 0) { log.info("Processed: " + examined); } diff --git a/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/coursepublish/CourseSitePublishJob.java b/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/coursepublish/CourseSitePublishJob.java index e46576d4dcd5..088f066f7093 100644 --- a/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/coursepublish/CourseSitePublishJob.java +++ b/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/coursepublish/CourseSitePublishJob.java @@ -15,8 +15,8 @@ */ package org.sakaiproject.component.app.scheduler.jobs.coursepublish; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.quartz.StatefulJob; @@ -35,7 +35,7 @@ public class CourseSitePublishJob implements StatefulJob { // logger - private final transient Log logger = LogFactory.getLog(getClass()); + private final transient Logger logger = LoggerFactory.getLogger(getClass()); // sakai.properties public final static String PROPERTY_COURSE_SITE_PUBLISH_USER = "course_site_publish_service.user"; @@ -126,7 +126,7 @@ public void execute(JobExecutionContext context) throws JobExecutionException { int numSitesPublished = courseSitePublishService.publishCourseSites(numDaysBeforeTermStarts); logger.info(numSitesPublished + " course sites were published."); } catch (Exception ex) { - logger.error(ex); + logger.error(ex.getMessage()); } } } diff --git a/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/coursepublish/CourseSiteRemovalJob.java b/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/coursepublish/CourseSiteRemovalJob.java index a6dda7bc9bb3..44c88f027884 100644 --- a/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/coursepublish/CourseSiteRemovalJob.java +++ b/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/coursepublish/CourseSiteRemovalJob.java @@ -15,8 +15,8 @@ */ package org.sakaiproject.component.app.scheduler.jobs.coursepublish; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.quartz.StatefulJob; @@ -34,7 +34,7 @@ */ public class CourseSiteRemovalJob implements StatefulJob { // logger - private final transient Log logger = LogFactory.getLog(getClass()); + private final transient Logger logger = LoggerFactory.getLogger(getClass()); // sakai.properties public final static String PROPERTY_COURSE_SITE_REMOVAL_ACTION = "course_site_removal_service.action"; @@ -146,7 +146,7 @@ public void execute(JobExecutionContext context) throws JobExecutionException { int numSitesRemoved = courseSiteRemovalService.removeCourseSites(action, numDaysAfterTermEnds); logger.info(numSitesRemoved + " course sites were removed."); } catch (Exception ex) { - logger.error(ex); + logger.error(ex.getMessage()); } } } diff --git a/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/logmessage/LogMessageJob.java b/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/logmessage/LogMessageJob.java index f01a9ae84f0a..09cda4f6e1f6 100644 --- a/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/logmessage/LogMessageJob.java +++ b/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/logmessage/LogMessageJob.java @@ -1,9 +1,11 @@ package org.sakaiproject.component.app.scheduler.jobs.logmessage; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.JobExecutionException; import org.sakaiproject.component.app.scheduler.jobs.AbstractConfigurableJob; +import org.slf4j.Marker; +import org.slf4j.MarkerFactory; /** * This is a simple Job that allows a message to be logged. @@ -11,12 +13,14 @@ */ public class LogMessageJob extends AbstractConfigurableJob { + private static final Marker fatal = MarkerFactory.getMarker("FATAL"); + @Override public void runJob() throws JobExecutionException { String level = getConfiguredProperty("level"); String message = getConfiguredProperty("message"); String logger = getConfiguredProperty("logger"); - Log log = LogFactory.getLog(logger); + Logger log = LoggerFactory.getLogger(logger); if ("trace".equalsIgnoreCase(level)) { log.trace(message); } else if ("debug".equalsIgnoreCase(level)) { @@ -28,7 +32,7 @@ public void runJob() throws JobExecutionException { } else if ("error".equalsIgnoreCase(level)) { log.error(message); } else if ("fatal".equalsIgnoreCase(level)) { - log.fatal(message); + log.error(fatal, message); } } } diff --git a/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/conditions/job/DatetimeEventJob.java b/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/conditions/job/DatetimeEventJob.java index 58cac0cc5a35..ae2284ab5f78 100644 --- a/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/conditions/job/DatetimeEventJob.java +++ b/jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/conditions/job/DatetimeEventJob.java @@ -20,8 +20,8 @@ **********************************************************************************/ package org.sakaiproject.conditions.job; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; @@ -33,7 +33,7 @@ public class DatetimeEventJob implements Job { - private static final Log LOG = LogFactory.getLog(DatetimeEventJob.class); + private static final Logger LOG = LoggerFactory.getLogger(DatetimeEventJob.class); /** * @see org.quartz.Job#execute(org.quartz.JobExecutionContext) @@ -44,4 +44,4 @@ public void execute(JobExecutionContext arg0) throws JobExecutionException EventTrackingService.post(EventTrackingService.newEvent("datetime.update", now.toString(), true)); } -} \ No newline at end of file +} diff --git a/jobscheduler/scheduler-component-shared/src/test/java/org/sakaiproject/component/app/scheduler/ScheduledInvocationTestCommand.java b/jobscheduler/scheduler-component-shared/src/test/java/org/sakaiproject/component/app/scheduler/ScheduledInvocationTestCommand.java index 95ed3fbd0bee..d1649db14ff7 100644 --- a/jobscheduler/scheduler-component-shared/src/test/java/org/sakaiproject/component/app/scheduler/ScheduledInvocationTestCommand.java +++ b/jobscheduler/scheduler-component-shared/src/test/java/org/sakaiproject/component/app/scheduler/ScheduledInvocationTestCommand.java @@ -1,13 +1,13 @@ package org.sakaiproject.component.app.scheduler; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.scheduler.ScheduledInvocationCommand; public class ScheduledInvocationTestCommand implements ScheduledInvocationCommand { - private static final Log LOG = LogFactory.getLog(ScheduledInvocationTestCommand.class); + private static final Logger LOG = LoggerFactory.getLogger(ScheduledInvocationTestCommand.class); public void execute(String opaqueContext) { diff --git a/jobscheduler/scheduler-component-shared/src/test/java/org/sakaiproject/component/app/scheduler/ScheduledInvocationTestJob.java b/jobscheduler/scheduler-component-shared/src/test/java/org/sakaiproject/component/app/scheduler/ScheduledInvocationTestJob.java index 81ac7bd1804f..360575090e1b 100644 --- a/jobscheduler/scheduler-component-shared/src/test/java/org/sakaiproject/component/app/scheduler/ScheduledInvocationTestJob.java +++ b/jobscheduler/scheduler-component-shared/src/test/java/org/sakaiproject/component/app/scheduler/ScheduledInvocationTestJob.java @@ -1,7 +1,7 @@ package org.sakaiproject.component.app.scheduler; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; @@ -10,7 +10,7 @@ public class ScheduledInvocationTestJob implements Job { - private static final Log LOG = LogFactory.getLog(ScheduledInvocationTestJob.class); + private static final Logger LOG = LoggerFactory.getLogger(ScheduledInvocationTestJob.class); /** Dependency: ScheduledInvocationManager */ protected ScheduledInvocationManager m_sim = null; diff --git a/jobscheduler/scheduler-component-shared/src/test/java/org/sakaiproject/component/app/scheduler/jobs/TestJob.java b/jobscheduler/scheduler-component-shared/src/test/java/org/sakaiproject/component/app/scheduler/jobs/TestJob.java index 8ff96423333b..1ca1c1d4d7ab 100644 --- a/jobscheduler/scheduler-component-shared/src/test/java/org/sakaiproject/component/app/scheduler/jobs/TestJob.java +++ b/jobscheduler/scheduler-component-shared/src/test/java/org/sakaiproject/component/app/scheduler/jobs/TestJob.java @@ -21,8 +21,8 @@ package org.sakaiproject.component.app.scheduler.jobs; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; @@ -30,7 +30,7 @@ public class TestJob implements Job { - private static final Log LOG = LogFactory.getLog(TestJob.class); + private static final Logger LOG = LoggerFactory.getLogger(TestJob.class); /** * @see org.quartz.Job#execute(org.quartz.JobExecutionContext) @@ -40,4 +40,4 @@ public void execute(JobExecutionContext arg0) throws JobExecutionException System.out.println("execute"); } -} \ No newline at end of file +} diff --git a/jobscheduler/scheduler-component-shared/src/test/java/org/sakaiproject/component/app/scheduler/jobs/TestJob2.java b/jobscheduler/scheduler-component-shared/src/test/java/org/sakaiproject/component/app/scheduler/jobs/TestJob2.java index 3e1332bbbddb..6831272e8d81 100644 --- a/jobscheduler/scheduler-component-shared/src/test/java/org/sakaiproject/component/app/scheduler/jobs/TestJob2.java +++ b/jobscheduler/scheduler-component-shared/src/test/java/org/sakaiproject/component/app/scheduler/jobs/TestJob2.java @@ -21,8 +21,8 @@ package org.sakaiproject.component.app.scheduler.jobs; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; @@ -30,7 +30,7 @@ public class TestJob2 implements Job { - private static final Log LOG = LogFactory.getLog(TestJob2.class); + private static final Logger LOG = LoggerFactory.getLogger(TestJob2.class); /** * @see org.quartz.Job#execute(org.quartz.JobExecutionContext) @@ -40,4 +40,4 @@ public void execute(JobExecutionContext arg0) throws JobExecutionException System.out.println("execute2"); } -} \ No newline at end of file +} diff --git a/jobscheduler/scheduler-test-component-shared/src/java/org/sakaiproject/component/app/scheduler/ScheduledInvocationTestCommand.java b/jobscheduler/scheduler-test-component-shared/src/java/org/sakaiproject/component/app/scheduler/ScheduledInvocationTestCommand.java index 95ed3fbd0bee..d1649db14ff7 100644 --- a/jobscheduler/scheduler-test-component-shared/src/java/org/sakaiproject/component/app/scheduler/ScheduledInvocationTestCommand.java +++ b/jobscheduler/scheduler-test-component-shared/src/java/org/sakaiproject/component/app/scheduler/ScheduledInvocationTestCommand.java @@ -1,13 +1,13 @@ package org.sakaiproject.component.app.scheduler; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.scheduler.ScheduledInvocationCommand; public class ScheduledInvocationTestCommand implements ScheduledInvocationCommand { - private static final Log LOG = LogFactory.getLog(ScheduledInvocationTestCommand.class); + private static final Logger LOG = LoggerFactory.getLogger(ScheduledInvocationTestCommand.class); public void execute(String opaqueContext) { diff --git a/jobscheduler/scheduler-test-component-shared/src/java/org/sakaiproject/component/app/scheduler/ScheduledInvocationTestJob.java b/jobscheduler/scheduler-test-component-shared/src/java/org/sakaiproject/component/app/scheduler/ScheduledInvocationTestJob.java index 81ac7bd1804f..360575090e1b 100644 --- a/jobscheduler/scheduler-test-component-shared/src/java/org/sakaiproject/component/app/scheduler/ScheduledInvocationTestJob.java +++ b/jobscheduler/scheduler-test-component-shared/src/java/org/sakaiproject/component/app/scheduler/ScheduledInvocationTestJob.java @@ -1,7 +1,7 @@ package org.sakaiproject.component.app.scheduler; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; @@ -10,7 +10,7 @@ public class ScheduledInvocationTestJob implements Job { - private static final Log LOG = LogFactory.getLog(ScheduledInvocationTestJob.class); + private static final Logger LOG = LoggerFactory.getLogger(ScheduledInvocationTestJob.class); /** Dependency: ScheduledInvocationManager */ protected ScheduledInvocationManager m_sim = null; diff --git a/jobscheduler/scheduler-test-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/TestConfigurableJob.java b/jobscheduler/scheduler-test-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/TestConfigurableJob.java index f058f9244705..61d88d739753 100644 --- a/jobscheduler/scheduler-test-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/TestConfigurableJob.java +++ b/jobscheduler/scheduler-test-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/TestConfigurableJob.java @@ -1,7 +1,7 @@ package org.sakaiproject.component.app.scheduler.jobs; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.JobExecutionException; /** @@ -13,8 +13,8 @@ */ public class TestConfigurableJob extends AbstractConfigurableJob { - private static final Log - LOG = LogFactory.getLog(TestConfigurableJob.class); + private static final Logger + LOG = LoggerFactory.getLogger(TestConfigurableJob.class); public static final String INTEGER_PROPERTY = "integer.property", diff --git a/jobscheduler/scheduler-test-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/TestEventGeneratorJob.java b/jobscheduler/scheduler-test-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/TestEventGeneratorJob.java index ef1ac5b3ebd4..294fa7aad656 100644 --- a/jobscheduler/scheduler-test-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/TestEventGeneratorJob.java +++ b/jobscheduler/scheduler-test-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/TestEventGeneratorJob.java @@ -1,7 +1,7 @@ package org.sakaiproject.component.app.scheduler.jobs; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.JobExecutionException; import org.quartz.JobKey; import org.quartz.TriggerKey; @@ -23,8 +23,8 @@ */ public class TestEventGeneratorJob extends AbstractConfigurableJob { - private static final Log - LOG = LogFactory.getLog(TestEventGeneratorJob.class); + private static final Logger + LOG = LoggerFactory.getLogger(TestEventGeneratorJob.class); public static final String STARTDATE_PROPERTY = "startDate.property", diff --git a/jobscheduler/scheduler-test-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/TestJob.java b/jobscheduler/scheduler-test-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/TestJob.java index 8ff96423333b..1ca1c1d4d7ab 100644 --- a/jobscheduler/scheduler-test-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/TestJob.java +++ b/jobscheduler/scheduler-test-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/TestJob.java @@ -21,8 +21,8 @@ package org.sakaiproject.component.app.scheduler.jobs; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; @@ -30,7 +30,7 @@ public class TestJob implements Job { - private static final Log LOG = LogFactory.getLog(TestJob.class); + private static final Logger LOG = LoggerFactory.getLogger(TestJob.class); /** * @see org.quartz.Job#execute(org.quartz.JobExecutionContext) @@ -40,4 +40,4 @@ public void execute(JobExecutionContext arg0) throws JobExecutionException System.out.println("execute"); } -} \ No newline at end of file +} diff --git a/jobscheduler/scheduler-test-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/TestJob2.java b/jobscheduler/scheduler-test-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/TestJob2.java index 3e1332bbbddb..6831272e8d81 100644 --- a/jobscheduler/scheduler-test-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/TestJob2.java +++ b/jobscheduler/scheduler-test-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/TestJob2.java @@ -21,8 +21,8 @@ package org.sakaiproject.component.app.scheduler.jobs; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; @@ -30,7 +30,7 @@ public class TestJob2 implements Job { - private static final Log LOG = LogFactory.getLog(TestJob2.class); + private static final Logger LOG = LoggerFactory.getLogger(TestJob2.class); /** * @see org.quartz.Job#execute(org.quartz.JobExecutionContext) @@ -40,4 +40,4 @@ public void execute(JobExecutionContext arg0) throws JobExecutionException System.out.println("execute2"); } -} \ No newline at end of file +} diff --git a/jobscheduler/scheduler-tool/src/java/org/sakaiproject/tool/app/scheduler/SchedulerTool.java b/jobscheduler/scheduler-tool/src/java/org/sakaiproject/tool/app/scheduler/SchedulerTool.java index 8b3c8e6c62b3..bcbdf2072bc6 100644 --- a/jobscheduler/scheduler-tool/src/java/org/sakaiproject/tool/app/scheduler/SchedulerTool.java +++ b/jobscheduler/scheduler-tool/src/java/org/sakaiproject/tool/app/scheduler/SchedulerTool.java @@ -31,8 +31,8 @@ import javax.faces.model.SelectItem; import javax.faces.validator.ValidatorException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.CronScheduleBuilder; import org.quartz.CronTrigger; import org.quartz.InterruptableJob; @@ -64,7 +64,7 @@ public class SchedulerTool { - private static final Log LOG = LogFactory.getLog(SchedulerTool.class); + private static final Logger LOG = LoggerFactory.getLogger(SchedulerTool.class); private static final String CRON_CHECK_ASTERISK = "**"; private static final String CRON_CHECK_QUESTION_MARK = "??"; diff --git a/jsf/jsf-app/src/java/org/sakaiproject/jsf/app/SakaiPhaseListener.java b/jsf/jsf-app/src/java/org/sakaiproject/jsf/app/SakaiPhaseListener.java index 70649ce7e32d..8388cdbd49f0 100644 --- a/jsf/jsf-app/src/java/org/sakaiproject/jsf/app/SakaiPhaseListener.java +++ b/jsf/jsf-app/src/java/org/sakaiproject/jsf/app/SakaiPhaseListener.java @@ -24,11 +24,11 @@ import javax.faces.event.PhaseId; import javax.faces.event.PhaseListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class SakaiPhaseListener implements PhaseListener { - private static final Log logger = LogFactory.getLog(SakaiPhaseListener.class); + private static final Logger logger = LoggerFactory.getLogger(SakaiPhaseListener.class); public PhaseId getPhaseId() { return PhaseId.ANY_PHASE; diff --git a/jsf/jsf-app/src/java/org/sakaiproject/jsf/app/SakaiVariableResolver.java b/jsf/jsf-app/src/java/org/sakaiproject/jsf/app/SakaiVariableResolver.java index 99b6f4c55465..7e33d7d169cc 100644 --- a/jsf/jsf-app/src/java/org/sakaiproject/jsf/app/SakaiVariableResolver.java +++ b/jsf/jsf-app/src/java/org/sakaiproject/jsf/app/SakaiVariableResolver.java @@ -26,8 +26,8 @@ import javax.faces.el.VariableResolver; import javax.servlet.ServletContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ComponentManager; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.web.context.WebApplicationContext; @@ -44,7 +44,7 @@ public class SakaiVariableResolver extends VariableResolver { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(SakaiVariableResolver.class); + private static Logger M_log = LoggerFactory.getLogger(SakaiVariableResolver.class); /** The VariableResolver already in place that we add features to. */ protected VariableResolver m_resolver = null; diff --git a/jsf/jsf-app/src/java/org/sakaiproject/jsf/app/SakaiViewHandler.java b/jsf/jsf-app/src/java/org/sakaiproject/jsf/app/SakaiViewHandler.java index 51aa40f9181f..ccab593ec8cd 100644 --- a/jsf/jsf-app/src/java/org/sakaiproject/jsf/app/SakaiViewHandler.java +++ b/jsf/jsf-app/src/java/org/sakaiproject/jsf/app/SakaiViewHandler.java @@ -31,8 +31,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.api.Tool; import org.sakaiproject.util.ResourceLoader; import org.sakaiproject.util.Web; @@ -55,7 +55,7 @@ public class SakaiViewHandler extends ViewHandler public static final String URL_EXT = "sakai.jsf.tool.URL.ext"; /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(SakaiViewHandler.class); + private static Logger M_log = LoggerFactory.getLogger(SakaiViewHandler.class); /** The wrapped ViewHandler. */ private ViewHandler m_wrapped = null; diff --git a/jsf/jsf-app/src/java/org/sakaiproject/jsf/app/SakaiViewHandlerWrapper.java b/jsf/jsf-app/src/java/org/sakaiproject/jsf/app/SakaiViewHandlerWrapper.java index 11055203d006..386808c3d33e 100644 --- a/jsf/jsf-app/src/java/org/sakaiproject/jsf/app/SakaiViewHandlerWrapper.java +++ b/jsf/jsf-app/src/java/org/sakaiproject/jsf/app/SakaiViewHandlerWrapper.java @@ -32,8 +32,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.api.Tool; import org.sakaiproject.util.ResourceLoader; import org.sakaiproject.util.Web; @@ -56,7 +56,7 @@ public class SakaiViewHandlerWrapper extends ViewHandlerWrapper public static final String URL_EXT = "sakai.jsf.tool.URL.ext"; /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(SakaiViewHandler.class); + private static Logger M_log = LoggerFactory.getLogger(SakaiViewHandler.class); /** The wrapped ViewHandler. */ private ViewHandler m_wrapped = null; diff --git a/jsf/jsf-spreadsheet/src/java/org/sakaiproject/jsf/spreadsheet/SpreadsheetDataFileWriterCsv.java b/jsf/jsf-spreadsheet/src/java/org/sakaiproject/jsf/spreadsheet/SpreadsheetDataFileWriterCsv.java index 1a3b7fec4c47..ea7f8b4986b0 100644 --- a/jsf/jsf-spreadsheet/src/java/org/sakaiproject/jsf/spreadsheet/SpreadsheetDataFileWriterCsv.java +++ b/jsf/jsf-spreadsheet/src/java/org/sakaiproject/jsf/spreadsheet/SpreadsheetDataFileWriterCsv.java @@ -29,8 +29,8 @@ import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; @@ -40,7 +40,7 @@ * possible. */ public class SpreadsheetDataFileWriterCsv implements SpreadsheetDataFileWriter { - private static final Log log = LogFactory.getLog(SpreadsheetDataFileWriterCsv.class); + private static final Logger log = LoggerFactory.getLogger(SpreadsheetDataFileWriterCsv.class); public void writeDataToResponse(List> spreadsheetData, String fileName, HttpServletResponse response) { response.setContentType("text/comma-separated-values"); @@ -54,12 +54,12 @@ public void writeDataToResponse(List> spreadsheetData, String fileN out.write(csvString.getBytes("UTF-8")); out.flush(); } catch (IOException e) { - if (log.isErrorEnabled()) log.error(e); + log.error(e.getMessage()); } finally { try { if (out != null) out.close(); } catch (IOException e) { - if (log.isErrorEnabled()) log.error(e); + log.error(e.getMessage()); } } } diff --git a/jsf/jsf-spreadsheet/src/java/org/sakaiproject/jsf/spreadsheet/SpreadsheetDataFileWriterPdf.java b/jsf/jsf-spreadsheet/src/java/org/sakaiproject/jsf/spreadsheet/SpreadsheetDataFileWriterPdf.java index 85afd6329124..4677b9c73297 100644 --- a/jsf/jsf-spreadsheet/src/java/org/sakaiproject/jsf/spreadsheet/SpreadsheetDataFileWriterPdf.java +++ b/jsf/jsf-spreadsheet/src/java/org/sakaiproject/jsf/spreadsheet/SpreadsheetDataFileWriterPdf.java @@ -9,8 +9,8 @@ import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import com.lowagie.text.BadElementException; @@ -28,7 +28,7 @@ import com.lowagie.text.pdf.PdfWriter; public class SpreadsheetDataFileWriterPdf implements SpreadsheetDataFileWriter { - private static final Log log = LogFactory.getLog(SpreadsheetDataFileWriterCsv.class); + private static final Logger log = LoggerFactory.getLogger(SpreadsheetDataFileWriterCsv.class); private List> studentInfo = new ArrayList>(); private static final int MAX_COLUMNS = 8; @@ -123,16 +123,14 @@ public void writeDataToResponse(List> spreadsheetData, String fileN document.add(new Paragraph("There are no grade records to display")); } - }catch (DocumentException e) { - if (log.isErrorEnabled()) log.error(e); - } catch (IOException e) { - if (log.isErrorEnabled()) log.error(e); + }catch (DocumentException | IOException e) { + log.error(e.getMessage()); }finally{ document.close(); try { if (out != null) out.close(); } catch (IOException e) { - if (log.isErrorEnabled()) log.error(e); + log.error(e.getMessage()); } } diff --git a/jsf/jsf-spreadsheet/src/java/org/sakaiproject/jsf/spreadsheet/SpreadsheetDataFileWriterXls.java b/jsf/jsf-spreadsheet/src/java/org/sakaiproject/jsf/spreadsheet/SpreadsheetDataFileWriterXls.java index 4314686722ee..f181ad4399b4 100644 --- a/jsf/jsf-spreadsheet/src/java/org/sakaiproject/jsf/spreadsheet/SpreadsheetDataFileWriterXls.java +++ b/jsf/jsf-spreadsheet/src/java/org/sakaiproject/jsf/spreadsheet/SpreadsheetDataFileWriterXls.java @@ -29,8 +29,8 @@ import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFCellStyle; import org.apache.poi.hssf.usermodel.HSSFFont; @@ -45,7 +45,7 @@ * */ public class SpreadsheetDataFileWriterXls implements SpreadsheetDataFileWriter { - private static final Log log = LogFactory.getLog(SpreadsheetDataFileWriter.class); + private static final Logger log = LoggerFactory.getLogger(SpreadsheetDataFileWriter.class); public void writeDataToResponse(List> spreadsheetData, String fileName, HttpServletResponse response) { response.setContentType("application/vnd.ms-excel"); @@ -57,12 +57,12 @@ public void writeDataToResponse(List> spreadsheetData, String fileN getAsWorkbook(spreadsheetData).write(out); out.flush(); } catch (IOException e) { - if (log.isErrorEnabled()) log.error(e); + log.error(e.getMessage()); } finally { try { if (out != null) out.close(); } catch (IOException e) { - if (log.isErrorEnabled()) log.error(e); + log.error(e.getMessage()); } } } diff --git a/jsf/jsf-tool/src/java/org/sakaiproject/jsf/util/HelperAwareJsfTool.java b/jsf/jsf-tool/src/java/org/sakaiproject/jsf/util/HelperAwareJsfTool.java index f64f66838bbb..01a2810208f1 100644 --- a/jsf/jsf-tool/src/java/org/sakaiproject/jsf/util/HelperAwareJsfTool.java +++ b/jsf/jsf-tool/src/java/org/sakaiproject/jsf/util/HelperAwareJsfTool.java @@ -20,8 +20,8 @@ **********************************************************************************/ package org.sakaiproject.jsf.util; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.jsf.util.JsfTool; import org.sakaiproject.tool.api.ActiveTool; import org.sakaiproject.tool.api.Tool; @@ -47,7 +47,7 @@ */ public class HelperAwareJsfTool extends JsfTool { - private static Log M_log = LogFactory.getLog(HelperAwareJsfTool.class); + private static Logger M_log = LoggerFactory.getLogger(HelperAwareJsfTool.class); private static final String HELPER_EXT = ".helper"; diff --git a/jsf/jsf-tool/src/java/org/sakaiproject/jsf/util/JsfTool.java b/jsf/jsf-tool/src/java/org/sakaiproject/jsf/util/JsfTool.java index 4894fe455837..43d95b6d39c8 100644 --- a/jsf/jsf-tool/src/java/org/sakaiproject/jsf/util/JsfTool.java +++ b/jsf/jsf-tool/src/java/org/sakaiproject/jsf/util/JsfTool.java @@ -30,8 +30,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.api.ToolSession; import org.sakaiproject.tool.cover.SessionManager; import org.sakaiproject.tool.api.Tool; @@ -48,7 +48,7 @@ public class JsfTool extends HttpServlet { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(JsfTool.class); + private static Logger M_log = LoggerFactory.getLogger(JsfTool.class); /** The file extension to get to JSF. */ protected static final String JSF_EXT = ".jsf"; diff --git a/jsf/jsf-widgets-sun/src/java/org/sakaiproject/jsf/util/JSFDepends.java b/jsf/jsf-widgets-sun/src/java/org/sakaiproject/jsf/util/JSFDepends.java index dc53a9adab78..0c88645cbc1a 100644 --- a/jsf/jsf-widgets-sun/src/java/org/sakaiproject/jsf/util/JSFDepends.java +++ b/jsf/jsf-widgets-sun/src/java/org/sakaiproject/jsf/util/JSFDepends.java @@ -21,8 +21,8 @@ package org.sakaiproject.jsf.util; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * This source file collects the dependencies of the Sakai tag library @@ -34,7 +34,7 @@ */ public class JSFDepends { - private static final Log logger = LogFactory.getLog(JSFDepends.class); + private static final Logger logger = LoggerFactory.getLogger(JSFDepends.class); /** Sun JSF RI dependent classes */ public static class CommandButtonTag extends com.sun.faces.taglib.html_basic.CommandButtonTag {} diff --git a/jsf/jsf-widgets/src/java/org/sakaiproject/jsf/component/FlowState.java b/jsf/jsf-widgets/src/java/org/sakaiproject/jsf/component/FlowState.java index 575fb215886d..4408279df350 100644 --- a/jsf/jsf-widgets/src/java/org/sakaiproject/jsf/component/FlowState.java +++ b/jsf/jsf-widgets/src/java/org/sakaiproject/jsf/component/FlowState.java @@ -26,8 +26,8 @@ import javax.faces.context.FacesContext; import javax.faces.el.ValueBinding; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.jsf.model.PhaseAware; /** @@ -53,7 +53,7 @@ * Any non-transient fields in the bean will be saved and restored from this component. */ public class FlowState extends UIComponentBase { - private static final Log logger = LogFactory.getLog(FlowState.class); + private static final Logger logger = LoggerFactory.getLogger(FlowState.class); public static final String COMPONENT_TYPE = "org.sakaiproject.jsf.FlowState"; diff --git a/jsf/jsf-widgets/src/java/org/sakaiproject/jsf/renderer/InputRichTextRenderer.java b/jsf/jsf-widgets/src/java/org/sakaiproject/jsf/renderer/InputRichTextRenderer.java index 01e0f9c1841c..326bf6da8c65 100644 --- a/jsf/jsf-widgets/src/java/org/sakaiproject/jsf/renderer/InputRichTextRenderer.java +++ b/jsf/jsf-widgets/src/java/org/sakaiproject/jsf/renderer/InputRichTextRenderer.java @@ -21,8 +21,8 @@ package org.sakaiproject.jsf.renderer; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.component.api.ServerConfigurationService; @@ -92,7 +92,7 @@ public class InputRichTextRenderer extends Renderer private static final MessageFormat LIST_ITEM_FORMAT_FCK = new MessageFormat("[\"{0}\", \"{1}\"]"); - private static final Log log = LogFactory.getLog(InputRichTextRenderer.class); + private static final Logger log = LoggerFactory.getLogger(InputRichTextRenderer.class); // we have static resources for our script path and built-in toolbars etc. static { @@ -204,7 +204,7 @@ public void encodeBegin(FacesContext context, UIComponent component) catch (Exception ex) { //default, whatever goes awry - if (log.isDebugEnabled()) log.debug(ex); + log.debug(ex.getMessage()); } if (widthPx == DEFAULT_WIDTH_PX && textareaColumns != DEFAULT_COLUMNS) diff --git a/jsf/jsf-widgets/src/java/org/sakaiproject/jsf/renderer/PagerRenderer.java b/jsf/jsf-widgets/src/java/org/sakaiproject/jsf/renderer/PagerRenderer.java index bbba9b601272..846571b40ae8 100644 --- a/jsf/jsf-widgets/src/java/org/sakaiproject/jsf/renderer/PagerRenderer.java +++ b/jsf/jsf-widgets/src/java/org/sakaiproject/jsf/renderer/PagerRenderer.java @@ -32,14 +32,14 @@ import javax.faces.context.ResponseWriter; import javax.faces.render.Renderer; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.jsf.util.LocaleUtil; import org.sakaiproject.jsf.util.RendererUtil; public class PagerRenderer extends Renderer { - private static final Log log = LogFactory.getLog(PagerRenderer.class); + private static final Logger log = LoggerFactory.getLogger(PagerRenderer.class); private static final String BUNDLE_NAME = "org.sakaiproject.jsf.bundle.pager"; public void encodeBegin(FacesContext context, UIComponent component) throws IOException diff --git a/jsf/jsf-widgets/src/java/org/sakaiproject/jsf/tag/FlowStateTag.java b/jsf/jsf-widgets/src/java/org/sakaiproject/jsf/tag/FlowStateTag.java index 1d2af3880f05..751844d027c5 100644 --- a/jsf/jsf-widgets/src/java/org/sakaiproject/jsf/tag/FlowStateTag.java +++ b/jsf/jsf-widgets/src/java/org/sakaiproject/jsf/tag/FlowStateTag.java @@ -25,11 +25,11 @@ import javax.faces.el.ValueBinding; import javax.faces.webapp.UIComponentTag; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class FlowStateTag extends UIComponentTag { - private static final Log logger = LogFactory.getLog(FlowStateTag.class); + private static final Logger logger = LoggerFactory.getLogger(FlowStateTag.class); private String bean; diff --git a/jsf/jsf-widgets/src/java/org/sakaiproject/jsf/util/LocaleUtil.java b/jsf/jsf-widgets/src/java/org/sakaiproject/jsf/util/LocaleUtil.java index e27fc633599d..7bd5496ef688 100644 --- a/jsf/jsf-widgets/src/java/org/sakaiproject/jsf/util/LocaleUtil.java +++ b/jsf/jsf-widgets/src/java/org/sakaiproject/jsf/util/LocaleUtil.java @@ -30,8 +30,8 @@ import javax.faces.context.FacesContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Instead of using standard methods of deciding which locale should be used @@ -50,7 +50,7 @@ * For details, see the comments to SAK-6886. */ public class LocaleUtil { - private static final Log log = LogFactory.getLog(LocaleUtil.class); + private static final Logger log = LoggerFactory.getLogger(LocaleUtil.class); private static Object sakaiResourceLoader = null; private static Method sakaiResourceLoaderGetLocale; @@ -68,19 +68,9 @@ private static void init() { sakaiResourceLoaderGetOrientation = sakaiResourceLoaderClass.getMethod("getOrientation",new Class[]{Locale.class}); sakaiResourceLoader = sakaiResourceLoaderConstructor.newInstance(); } catch (ClassNotFoundException e) { - if (log.isDebugEnabled()) log.debug("Did not find Sakai ResourceLoader class; will use standard JSF localization"); - } catch (SecurityException e) { - if (log.isErrorEnabled()) log.error("Will use standard JSF localization", e); - } catch (NoSuchMethodException e) { - if (log.isErrorEnabled()) log.error("Will use standard JSF localization", e); - } catch (IllegalArgumentException e) { - if (log.isErrorEnabled()) log.error("Will use standard JSF localization", e); - } catch (InstantiationException e) { - if (log.isErrorEnabled()) log.error("Will use standard JSF localization", e); - } catch (IllegalAccessException e) { - if (log.isErrorEnabled()) log.error("Will use standard JSF localization", e); - } catch (InvocationTargetException e) { - if (log.isErrorEnabled()) log.error("Will use standard JSF localization", e); + log.debug("Did not find Sakai ResourceLoader class; will use standard JSF localization"); + } catch (SecurityException | NoSuchMethodException | IllegalArgumentException | InstantiationException | IllegalAccessException | InvocationTargetException e) { + log.error("Will use standard JSF localization", e); } isInitialized = true; } @@ -92,12 +82,8 @@ public static Locale getLocale(FacesContext context) { if (sakaiResourceLoader != null) { try { locale = (Locale)sakaiResourceLoaderGetLocale.invoke(sakaiResourceLoader); - } catch (IllegalArgumentException e) { - if (log.isErrorEnabled()) log.error(e); - } catch (IllegalAccessException e) { - if (log.isErrorEnabled()) log.error(e); - } catch (InvocationTargetException e) { - if (log.isErrorEnabled()) log.error(e); + } catch (IllegalArgumentException | IllegalAccessException | InvocationTargetException e) { + log.error(e.getMessage()); } } else { // Use standard JSF approach. @@ -121,12 +107,8 @@ public static String getOrientation(Locale loc) { if (sakaiResourceLoader != null) { try { orientation = (String) sakaiResourceLoaderGetOrientation.invoke(sakaiResourceLoader, new Object[]{loc}); - } catch (IllegalArgumentException e) { - if (log.isErrorEnabled()) log.error(e); - } catch (IllegalAccessException e) { - if (log.isErrorEnabled()) log.error(e); - } catch (InvocationTargetException e) { - if (log.isErrorEnabled()) log.error(e); + } catch (IllegalArgumentException | IllegalAccessException | InvocationTargetException e) { + log.error(e.getMessage()); } } return orientation; diff --git a/kernel/api/src/main/java/org/apache/commons/dbcp/SakaiBasicDataSource.java b/kernel/api/src/main/java/org/apache/commons/dbcp/SakaiBasicDataSource.java index 61bf5923db92..b2f35491ac53 100644 --- a/kernel/api/src/main/java/org/apache/commons/dbcp/SakaiBasicDataSource.java +++ b/kernel/api/src/main/java/org/apache/commons/dbcp/SakaiBasicDataSource.java @@ -29,8 +29,8 @@ import javax.sql.DataSource; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.pool.impl.GenericKeyedObjectPool; import org.apache.commons.pool.impl.GenericKeyedObjectPoolFactory; import org.apache.commons.pool.impl.GenericObjectPool; @@ -43,7 +43,7 @@ public class SakaiBasicDataSource extends BasicDataSource { /** Our logger. */ - private static Log M_log = LogFactory.getLog(SakaiBasicDataSource.class); + private static Logger M_log = LoggerFactory.getLogger(SakaiBasicDataSource.class); /** Configuration: to rollback each connection when returned to the pool. */ protected boolean m_rollbackOnReturn = false; diff --git a/kernel/api/src/main/java/org/apache/commons/dbcp/SakaiPoolableConnectionFactory.java b/kernel/api/src/main/java/org/apache/commons/dbcp/SakaiPoolableConnectionFactory.java index 14dddb645a48..3b4f4aa66f1a 100644 --- a/kernel/api/src/main/java/org/apache/commons/dbcp/SakaiPoolableConnectionFactory.java +++ b/kernel/api/src/main/java/org/apache/commons/dbcp/SakaiPoolableConnectionFactory.java @@ -23,8 +23,8 @@ import java.sql.Connection; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.pool.KeyedObjectPool; import org.apache.commons.pool.KeyedObjectPoolFactory; import org.apache.commons.pool.ObjectPool; @@ -43,7 +43,7 @@ public class SakaiPoolableConnectionFactory extends PoolableConnectionFactory protected boolean m_rollbackOnReturn = false; - protected static final Log M_log = LogFactory.getLog(SakaiPoolableConnectionFactory.class); + protected static final Logger M_log = LoggerFactory.getLogger(SakaiPoolableConnectionFactory.class); /** * Create a new PoolableConnectionFactory. * diff --git a/kernel/api/src/main/java/org/sakaiproject/hikaricp/jdbc/pool/SakaiBasicDataSource.java b/kernel/api/src/main/java/org/sakaiproject/hikaricp/jdbc/pool/SakaiBasicDataSource.java index 3bfc64c0e2ee..c0f4f7a62c44 100644 --- a/kernel/api/src/main/java/org/sakaiproject/hikaricp/jdbc/pool/SakaiBasicDataSource.java +++ b/kernel/api/src/main/java/org/sakaiproject/hikaricp/jdbc/pool/SakaiBasicDataSource.java @@ -27,8 +27,8 @@ import java.sql.DriverManager; import java.sql.SQLException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.zaxxer.hikari.HikariDataSource; @@ -40,7 +40,7 @@ public class SakaiBasicDataSource extends HikariDataSource { /** Our logger. */ - private static Log M_log = LogFactory.getLog(SakaiBasicDataSource.class); + private static Logger M_log = LoggerFactory.getLogger(SakaiBasicDataSource.class); /** Configuration: to rollback each connection when returned to the pool. */ //TODO: Is this a data source property? diff --git a/kernel/api/src/main/java/org/sakaiproject/tomcat/jdbc/pool/SakaiBasicDataSource.java b/kernel/api/src/main/java/org/sakaiproject/tomcat/jdbc/pool/SakaiBasicDataSource.java index 56548cb02972..8a839d61a473 100644 --- a/kernel/api/src/main/java/org/sakaiproject/tomcat/jdbc/pool/SakaiBasicDataSource.java +++ b/kernel/api/src/main/java/org/sakaiproject/tomcat/jdbc/pool/SakaiBasicDataSource.java @@ -35,8 +35,8 @@ import javax.management.NotCompliantMBeanException; import javax.management.ObjectName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.tomcat.jdbc.pool.DataSource; import org.apache.tomcat.jdbc.pool.DataSourceFactory; @@ -50,7 +50,7 @@ public class SakaiBasicDataSource extends DataSource { /** Our logger. */ - private static Log M_log = LogFactory.getLog(SakaiBasicDataSource.class); + private static Logger M_log = LoggerFactory.getLogger(SakaiBasicDataSource.class); private MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer(); diff --git a/kernel/api/src/main/java/org/sakaiproject/util/RequestFilter.java b/kernel/api/src/main/java/org/sakaiproject/util/RequestFilter.java index e4936741397c..a3ad125d3dcd 100644 --- a/kernel/api/src/main/java/org/sakaiproject/util/RequestFilter.java +++ b/kernel/api/src/main/java/org/sakaiproject/util/RequestFilter.java @@ -26,8 +26,8 @@ import org.apache.commons.fileupload.FileUploadException; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.servlet.ServletFileUpload; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.cluster.api.ClusterNode; import org.sakaiproject.cluster.api.ClusterService; import org.sakaiproject.cluster.api.ClusterService.Status; @@ -184,7 +184,7 @@ public class RequestFilter implements Filter protected static final String SAKAI_CLUSTER_REDIRECT_RANDOM = "cluster.redirect.random.node"; /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(RequestFilter.class); + private static Logger M_log = LoggerFactory.getLogger(RequestFilter.class); /** If true, we deliver the Sakai end user enterprise id as the remote user in each request. */ protected boolean m_sakaiRemoteUser = true; @@ -421,19 +421,7 @@ public void doFilter(ServletRequest requestObj, ServletResponse responseObj, Fil // filter the request else { - if (M_log.isDebugEnabled()) - { - sb = new StringBuffer("http-request: "); - sb.append(req.getMethod()); - sb.append(" "); - sb.append(req.getRequestURL()); - if (req.getQueryString() != null) - { - sb.append("?"); - sb.append(req.getQueryString()); - } - M_log.debug(sb); - } + M_log.debug("http-request: {} {}?{}", req.getMethod(), req.getRequestURL(), req.getQueryString()); try { @@ -1191,7 +1179,7 @@ protected Session assureSession(HttpServletRequest req, HttpServletResponse res) // check the server instance id String serverInstanceId = serverConfigurationService.getServerIdInstance(); if ((serverInstanceId != null) && (!serverInstanceId.equals(us.getServer()))) { - // Log that the UsageSession server value is changing + // Logger that the UsageSession server value is changing M_log.info("UsageSession: Server change detected: Old Server=" + us.getServer() + " New Server=" + serverInstanceId); // set the new UsageSession server value diff --git a/kernel/api/src/main/java/org/sakaiproject/util/ResponseHeaderFilter.java b/kernel/api/src/main/java/org/sakaiproject/util/ResponseHeaderFilter.java index 815aed267c63..db1ad2b38966 100644 --- a/kernel/api/src/main/java/org/sakaiproject/util/ResponseHeaderFilter.java +++ b/kernel/api/src/main/java/org/sakaiproject/util/ResponseHeaderFilter.java @@ -35,8 +35,8 @@ import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ServerConfigurationService; /** @@ -65,7 +65,7 @@ */ public class ResponseHeaderFilter implements Filter { - private static Log log = LogFactory.getLog(ResponseHeaderFilter.class); + private static Logger log = LoggerFactory.getLogger(ResponseHeaderFilter.class); private Map headerMap = new ConcurrentHashMap(); diff --git a/kernel/api/src/main/java/org/sakaiproject/util/TrustedLoginFilter.java b/kernel/api/src/main/java/org/sakaiproject/util/TrustedLoginFilter.java index 9643ca3160f9..652b22ba4584 100644 --- a/kernel/api/src/main/java/org/sakaiproject/util/TrustedLoginFilter.java +++ b/kernel/api/src/main/java/org/sakaiproject/util/TrustedLoginFilter.java @@ -32,8 +32,8 @@ import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.api.Session; import org.sakaiproject.tool.api.SessionManager; import org.sakaiproject.user.api.UserNotDefinedException; @@ -105,7 +105,7 @@ */ public class TrustedLoginFilter implements Filter { - private final static Log log = LogFactory.getLog(TrustedLoginFilter.class); + private final static Logger log = LoggerFactory.getLogger(TrustedLoginFilter.class); private SessionManager sessionManager; diff --git a/kernel/api/src/main/java/org/sakaiproject/util/api/MockFormattedText.java b/kernel/api/src/main/java/org/sakaiproject/util/api/MockFormattedText.java index 496727599cad..21d9753ac633 100644 --- a/kernel/api/src/main/java/org/sakaiproject/util/api/MockFormattedText.java +++ b/kernel/api/src/main/java/org/sakaiproject/util/api/MockFormattedText.java @@ -21,8 +21,8 @@ package org.sakaiproject.util.api; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.w3c.dom.Element; import java.text.NumberFormat; /** @@ -33,7 +33,7 @@ */ public class MockFormattedText implements FormattedText { - private static final Log log = LogFactory.getLog(FormattedText.class); + private static final Logger log = LoggerFactory.getLogger(FormattedText.class); private static final String WARNING = "Using MOCK FormattedText: all values just pass through and are not processed: FOR TESTING ONLY (if this is live there is a big problem)"; public String processFormattedText(String strFromBrowser, StringBuffer errorMessages) { diff --git a/kernel/api/src/main/java/org/sakaiproject/util/cover/LinkMigrationHelper.java b/kernel/api/src/main/java/org/sakaiproject/util/cover/LinkMigrationHelper.java index eead0cab6a86..c72df93c753b 100644 --- a/kernel/api/src/main/java/org/sakaiproject/util/cover/LinkMigrationHelper.java +++ b/kernel/api/src/main/java/org/sakaiproject/util/cover/LinkMigrationHelper.java @@ -8,8 +8,8 @@ import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.component.cover.ServerConfigurationService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @@ -18,7 +18,7 @@ public class LinkMigrationHelper { private static org.sakaiproject.util.api.LinkMigrationHelper thisLinkMigrationHelper=null; - private static final Log LOG = LogFactory.getLog(LinkMigrationHelper.class); + private static final Logger LOG = LoggerFactory.getLogger(LinkMigrationHelper.class); private static org.sakaiproject.util.api.LinkMigrationHelper getLinkMigrationHelper(){ diff --git a/kernel/api/src/test/java/org/sakaiproject/util/TrustedLoginTokenTest.java b/kernel/api/src/test/java/org/sakaiproject/util/TrustedLoginTokenTest.java index 2c4e69d93f53..8cf890f16a8b 100644 --- a/kernel/api/src/test/java/org/sakaiproject/util/TrustedLoginTokenTest.java +++ b/kernel/api/src/test/java/org/sakaiproject/util/TrustedLoginTokenTest.java @@ -24,14 +24,14 @@ import java.security.MessageDigest; import java.util.Random; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.Assert; import org.junit.Test; public class TrustedLoginTokenTest { - private static final Log log = LogFactory.getLog(TrustedLoginTokenTest.class); + private static final Logger log = LoggerFactory.getLogger(TrustedLoginTokenTest.class); @Test public void testDecode() throws Exception diff --git a/kernel/component-manager/src/main/java/org/sakaiproject/component/cover/TestComponentManagerContainer.java b/kernel/component-manager/src/main/java/org/sakaiproject/component/cover/TestComponentManagerContainer.java index 62d854bda492..9a485caa2c3d 100644 --- a/kernel/component-manager/src/main/java/org/sakaiproject/component/cover/TestComponentManagerContainer.java +++ b/kernel/component-manager/src/main/java/org/sakaiproject/component/cover/TestComponentManagerContainer.java @@ -21,8 +21,8 @@ package org.sakaiproject.component.cover; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.impl.SpringCompMgr; import org.springframework.beans.factory.config.PropertyOverrideConfigurer; import org.springframework.beans.factory.support.BeanDefinitionRegistry; @@ -48,7 +48,7 @@ public class TestComponentManagerContainer { /** * The logger */ - private static final Log log = LogFactory.getLog(TestComponentManagerContainer.class); + private static final Logger log = LoggerFactory.getLogger(TestComponentManagerContainer.class); /** * The current component manager @@ -204,7 +204,7 @@ public Object getService(String beanId) { try { return componentManager.get(beanId); } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); return null; } } diff --git a/kernel/component-manager/src/main/java/org/sakaiproject/component/impl/DynamicDefaultSakaiProperties.java b/kernel/component-manager/src/main/java/org/sakaiproject/component/impl/DynamicDefaultSakaiProperties.java index eba167ca35ed..752f5b5f3ca9 100644 --- a/kernel/component-manager/src/main/java/org/sakaiproject/component/impl/DynamicDefaultSakaiProperties.java +++ b/kernel/component-manager/src/main/java/org/sakaiproject/component/impl/DynamicDefaultSakaiProperties.java @@ -26,23 +26,23 @@ import java.net.UnknownHostException; import java.util.Properties; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Handle any default sakai.properties values that need to be set dynamically. */ public class DynamicDefaultSakaiProperties extends Properties { private static final long serialVersionUID = 1L; - private static Log log = LogFactory.getLog(DynamicDefaultSakaiProperties.class); + private static Logger log = LoggerFactory.getLogger(DynamicDefaultSakaiProperties.class); public void init() { try { String defaultServerId = InetAddress.getLocalHost().getHostName(); this.put("serverId", defaultServerId); - if (log.isDebugEnabled()) log.debug("Set serverId to " + defaultServerId); + log.debug("Set serverId to {}", defaultServerId); } catch (UnknownHostException e) { - if (log.isDebugEnabled()) log.debug(e); + log.debug(e.getMessage(), e); } } } diff --git a/kernel/component-manager/src/main/java/org/sakaiproject/component/impl/MockCompMgr.java b/kernel/component-manager/src/main/java/org/sakaiproject/component/impl/MockCompMgr.java index 47f00f559113..bd9dcb56fffa 100644 --- a/kernel/component-manager/src/main/java/org/sakaiproject/component/impl/MockCompMgr.java +++ b/kernel/component-manager/src/main/java/org/sakaiproject/component/impl/MockCompMgr.java @@ -26,8 +26,8 @@ import java.util.Set; import java.util.concurrent.ConcurrentHashMap; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ComponentManager; /** @@ -37,7 +37,7 @@ @SuppressWarnings("rawtypes") public class MockCompMgr implements ComponentManager { - private static Log M_log = LogFactory.getLog(MockCompMgr.class); + private static Logger M_log = LoggerFactory.getLogger(MockCompMgr.class); /** * Startup the CM as a mock system for unit tests diff --git a/kernel/component-manager/src/main/java/org/sakaiproject/component/impl/SakaiContextLoader.java b/kernel/component-manager/src/main/java/org/sakaiproject/component/impl/SakaiContextLoader.java index 282844362a05..3249ae549c52 100644 --- a/kernel/component-manager/src/main/java/org/sakaiproject/component/impl/SakaiContextLoader.java +++ b/kernel/component-manager/src/main/java/org/sakaiproject/component/impl/SakaiContextLoader.java @@ -26,8 +26,8 @@ import javax.servlet.ServletContext; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.component.cover.ServerConfigurationService; import org.springframework.beans.BeansException; @@ -50,7 +50,7 @@ */ public class SakaiContextLoader extends ContextLoader { - private static final Log log = LogFactory.getLog(SakaiContextLoader.class); + private static final Logger log = LoggerFactory.getLogger(SakaiContextLoader.class); public static final String SPRING_CONTEXT_SUFFIX = "-context.xml"; /** diff --git a/kernel/component-manager/src/main/java/org/sakaiproject/component/impl/SpringCompMgr.java b/kernel/component-manager/src/main/java/org/sakaiproject/component/impl/SpringCompMgr.java index 775eb10e05f9..3c6792453701 100644 --- a/kernel/component-manager/src/main/java/org/sakaiproject/component/impl/SpringCompMgr.java +++ b/kernel/component-manager/src/main/java/org/sakaiproject/component/impl/SpringCompMgr.java @@ -31,8 +31,8 @@ import java.util.Timer; import java.util.TimerTask; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ComponentManager; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.component.api.ServerConfigurationService.ConfigData; @@ -54,7 +54,7 @@ */ public class SpringCompMgr implements ComponentManager { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(SpringCompMgr.class); + private static Logger M_log = LoggerFactory.getLogger(SpringCompMgr.class); /** * System property to control if we close on jvm shutdown (if set) or on the @@ -162,8 +162,8 @@ public void run() { m_ac.publishEvent(new SakaiComponentEvent(this, SakaiComponentEvent.Type.STARTED)); } catch (Exception e) { if (Boolean.valueOf(System.getProperty(SHUTDOWN_ON_ERROR, "false"))) { - M_log.fatal(e.getMessage(), e); - M_log.fatal("Shutting down JVM"); + M_log.error(e.getMessage(), e); + M_log.error("Shutting down JVM"); System.exit(1); } else { M_log.error(e.getMessage(), e); diff --git a/kernel/component-manager/src/main/java/org/sakaiproject/util/ComponentsLoader.java b/kernel/component-manager/src/main/java/org/sakaiproject/util/ComponentsLoader.java index 9bbdb70c46a5..4310630335b6 100644 --- a/kernel/component-manager/src/main/java/org/sakaiproject/util/ComponentsLoader.java +++ b/kernel/component-manager/src/main/java/org/sakaiproject/util/ComponentsLoader.java @@ -33,8 +33,8 @@ import java.util.List; import java.util.Vector; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.context.ConfigurableApplicationContext; @@ -49,7 +49,7 @@ public class ComponentsLoader { /** Our logger */ - private static Log M_log = LogFactory.getLog(ComponentsLoader.class); + private static Logger M_log = LoggerFactory.getLogger(ComponentsLoader.class); /** Folder containing override definitions for beans */ private File overridesFolder; diff --git a/kernel/component-manager/src/main/java/org/sakaiproject/util/ReversiblePropertyOverrideConfigurer.java b/kernel/component-manager/src/main/java/org/sakaiproject/util/ReversiblePropertyOverrideConfigurer.java index 6df0f4e61e8b..ac780b96175b 100644 --- a/kernel/component-manager/src/main/java/org/sakaiproject/util/ReversiblePropertyOverrideConfigurer.java +++ b/kernel/component-manager/src/main/java/org/sakaiproject/util/ReversiblePropertyOverrideConfigurer.java @@ -32,7 +32,7 @@ * (For example "myBean@the.property" instead of "the.property@myBean".) */ public class ReversiblePropertyOverrideConfigurer extends PropertyOverrideConfigurer { - //private static Log log = LogFactory.getLog(ReversiblePropertyOverrideConfigurer.class); + //private static Logger log = LoggerFactory.getLogger(ReversiblePropertyOverrideConfigurer.class); private boolean beanNameAtEnd = true; private String beanNameSeparator; // Private in the superclass, so we need to stash our own copy. diff --git a/kernel/component-manager/src/main/java/org/sakaiproject/util/SakaiContextLoaderListener.java b/kernel/component-manager/src/main/java/org/sakaiproject/util/SakaiContextLoaderListener.java index 095d30b9a9cb..2d22d284da17 100644 --- a/kernel/component-manager/src/main/java/org/sakaiproject/util/SakaiContextLoaderListener.java +++ b/kernel/component-manager/src/main/java/org/sakaiproject/util/SakaiContextLoaderListener.java @@ -24,8 +24,8 @@ import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.component.impl.SakaiContextLoader; import org.sakaiproject.component.impl.SpringCompMgr; @@ -37,7 +37,7 @@ */ public class SakaiContextLoaderListener extends SakaiContextLoader implements ServletContextListener { - private static final Log log = LogFactory.getLog(SakaiContextLoaderListener.class); + private static final Logger log = LoggerFactory.getLogger(SakaiContextLoaderListener.class); /** * Initialize the root web application context. diff --git a/kernel/component-manager/src/main/java/org/sakaiproject/util/SakaiProperties.java b/kernel/component-manager/src/main/java/org/sakaiproject/util/SakaiProperties.java index ce135dbff124..84671c83ef38 100644 --- a/kernel/component-manager/src/main/java/org/sakaiproject/util/SakaiProperties.java +++ b/kernel/component-manager/src/main/java/org/sakaiproject/util/SakaiProperties.java @@ -35,8 +35,8 @@ import java.util.Properties; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.config.BeanFactoryPostProcessor; @@ -59,7 +59,7 @@ * PropertiesFactoryBean, PropertyPlaceholderConfigurer, and PropertyOverrideConfigurer. */ public class SakaiProperties implements BeanFactoryPostProcessorCreator, InitializingBean { - private static Log log = LogFactory.getLog(SakaiProperties.class); + private static Logger log = LoggerFactory.getLogger(SakaiProperties.class); private SakaiPropertiesFactoryBean propertiesFactoryBean = new SakaiPropertiesFactoryBean(); //private PropertiesFactoryBean propertiesFactoryBean = new PropertiesFactoryBean(); private ReversiblePropertyOverrideConfigurer propertyOverrideConfigurer = new ReversiblePropertyOverrideConfigurer(); @@ -260,7 +260,7 @@ public void setIgnoreInvalidKeys(boolean ignoreInvalidKeys) { */ public class SakaiPropertiesFactoryBean implements FactoryBean, InitializingBean { public static final String XML_FILE_EXTENSION = ".xml"; - final Log log = LogFactory.getLog(SakaiPropertiesFactoryBean.class); + final Logger log = LoggerFactory.getLogger(SakaiPropertiesFactoryBean.class); private Map loadedProperties = new LinkedHashMap(); /** diff --git a/kernel/component-manager/src/main/java/org/sakaiproject/util/TerracottaClassLoader.java b/kernel/component-manager/src/main/java/org/sakaiproject/util/TerracottaClassLoader.java index 8de347ccf3ec..0c50c7effa4d 100644 --- a/kernel/component-manager/src/main/java/org/sakaiproject/util/TerracottaClassLoader.java +++ b/kernel/component-manager/src/main/java/org/sakaiproject/util/TerracottaClassLoader.java @@ -4,12 +4,12 @@ import java.net.URL; import java.net.URLClassLoader; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; class TerracottaClassLoader extends URLClassLoader { /** Our logger */ - private static Log log = LogFactory.getLog(ComponentsLoader.class); + private static Logger log = LoggerFactory.getLogger(ComponentsLoader.class); private String classLoaderName; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/alias/impl/BaseAliasService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/alias/impl/BaseAliasService.java index 38eb557ed2f9..ee7c62bd3857 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/alias/impl/BaseAliasService.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/alias/impl/BaseAliasService.java @@ -22,8 +22,8 @@ package org.sakaiproject.alias.impl; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.alias.api.Alias; import org.sakaiproject.alias.api.AliasEdit; import org.sakaiproject.alias.api.AliasService; @@ -59,7 +59,7 @@ public abstract class BaseAliasService implements AliasService, SingleStorageUser { /** Our logger. */ - private static Log M_log = LogFactory.getLog(BaseAliasService.class); + private static Logger M_log = LoggerFactory.getLogger(BaseAliasService.class); /** Storage manager for this service. */ protected Storage m_storage = null; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/alias/impl/DbAliasService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/alias/impl/DbAliasService.java index 17ea331ac773..a783aeb98a8c 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/alias/impl/DbAliasService.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/alias/impl/DbAliasService.java @@ -30,8 +30,8 @@ import java.util.Set; import java.util.Vector; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.alias.api.Alias; import org.sakaiproject.alias.api.AliasEdit; import org.sakaiproject.db.api.SqlReader; @@ -54,7 +54,7 @@ public abstract class DbAliasService extends BaseAliasService { /** Our logger. */ - private static Log M_log = LogFactory.getLog(DbAliasService.class); + private static Logger M_log = LoggerFactory.getLogger(DbAliasService.class); /** Table name for aliases. */ protected String m_tableName = "SAKAI_ALIAS"; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/antivirus/impl/ClamAVScanner.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/antivirus/impl/ClamAVScanner.java index ddade2544a1a..108e10ec5679 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/antivirus/impl/ClamAVScanner.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/antivirus/impl/ClamAVScanner.java @@ -37,8 +37,8 @@ import java.net.SocketAddress; import java.net.UnknownHostException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.antivirus.api.VirusFoundException; import org.sakaiproject.antivirus.api.VirusScanIncompleteException; import org.sakaiproject.antivirus.api.VirusScanner; @@ -69,7 +69,7 @@ * @version $Revision$ */ public class ClamAVScanner implements VirusScanner { - private static final Log logger = LogFactory.getLog(ClamAVScanner.class); + private static final Logger logger = LoggerFactory.getLogger(ClamAVScanner.class); private final String STREAM_PORT_STRING = "PORT "; private final String FOUND_STRING = "FOUND"; private final String SCAN_INCOMPLETE_MSG = "Virus scan could not finish due to an internal error"; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/authz/impl/BaseAuthzGroup.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/authz/impl/BaseAuthzGroup.java index 96187d10762d..6b4031022751 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/authz/impl/BaseAuthzGroup.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/authz/impl/BaseAuthzGroup.java @@ -22,8 +22,8 @@ package org.sakaiproject.authz.impl; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.*; import org.sakaiproject.entity.api.Reference; import org.sakaiproject.entity.api.ResourceProperties; @@ -50,7 +50,7 @@ public class BaseAuthzGroup implements AuthzGroup { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(BaseAuthzGroup.class); + private static Logger M_log = LoggerFactory.getLogger(BaseAuthzGroup.class); /** A fixed class serian number. */ private static final long serialVersionUID = 1L; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/authz/impl/BaseAuthzGroupService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/authz/impl/BaseAuthzGroupService.java index ec92af2b7f45..b63e428cf8e7 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/authz/impl/BaseAuthzGroupService.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/authz/impl/BaseAuthzGroupService.java @@ -21,8 +21,8 @@ package org.sakaiproject.authz.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.*; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.component.cover.ComponentManager; @@ -54,7 +54,7 @@ public abstract class BaseAuthzGroupService implements AuthzGroupService { /** Our logger. */ - private static Log M_log = LogFactory.getLog(BaseAuthzGroupService.class); + private static Logger M_log = LoggerFactory.getLogger(BaseAuthzGroupService.class); /** Storage manager for this service. */ protected Storage m_storage = null; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/authz/impl/BaseRole.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/authz/impl/BaseRole.java index c8f2d06f53a8..d1d577261968 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/authz/impl/BaseRole.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/authz/impl/BaseRole.java @@ -28,8 +28,8 @@ import java.util.Stack; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroup; import org.sakaiproject.authz.api.Role; import org.sakaiproject.authz.api.SimpleRole; @@ -47,7 +47,7 @@ public class BaseRole implements Role { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(BaseRole.class); + private static Logger M_log = LoggerFactory.getLogger(BaseRole.class); /** A fixed class serian number. */ private static final long serialVersionUID = 1L; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/authz/impl/DbAuthzGroupService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/authz/impl/DbAuthzGroupService.java index 91821ef00666..56df7b8270ff 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/authz/impl/DbAuthzGroupService.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/authz/impl/DbAuthzGroupService.java @@ -22,8 +22,8 @@ package org.sakaiproject.authz.impl; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.*; import org.sakaiproject.db.api.SqlReader; import org.sakaiproject.db.api.SqlService; @@ -61,7 +61,7 @@ public abstract class DbAuthzGroupService extends BaseAuthzGroupService implemen /** To avoide the dreaded ORA-01795 and the like, we need to limit to <1000 the items in each in(?, ?, ...) clause, connecting them with ORs. */ protected final static int MAX_IN_CLAUSE = 999; /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(DbAuthzGroupService.class); + private static Logger M_log = LoggerFactory.getLogger(DbAuthzGroupService.class); /** All the event functions we know exist on the db. */ protected Collection m_functionCache = new HashSet(); /** All the event role names we know exist on the db. */ @@ -1032,7 +1032,7 @@ public List getAuthzUserGroupIds(ArrayList authzGroupIds, String userid) UserAndGroups uag = (UserAndGroups) authzUserGroupIdsCache.get(userid); if (uag != null) { List result = uag.getRealmQuery(new HashSet(authzGroupIds)); - if (M_log.isDebugEnabled()) M_log.debug(uag); + M_log.debug(uag.toString()); if (result != null) { // hit return result; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/authz/impl/FunctionManagerComponent.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/authz/impl/FunctionManagerComponent.java index 2e920a2a2f97..4b719bd9c646 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/authz/impl/FunctionManagerComponent.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/authz/impl/FunctionManagerComponent.java @@ -24,8 +24,8 @@ import java.util.List; import java.util.Vector; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.FunctionManager; /** @@ -38,7 +38,7 @@ public class FunctionManagerComponent implements FunctionManager { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(FunctionManagerComponent.class); + private static Logger M_log = LoggerFactory.getLogger(FunctionManagerComponent.class); /** List of security functions. */ protected List m_registeredFunctions = new Vector(); diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/authz/impl/NoSecurity.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/authz/impl/NoSecurity.java index dd312221692d..a2736ee569dd 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/authz/impl/NoSecurity.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/authz/impl/NoSecurity.java @@ -24,8 +24,8 @@ import java.util.List; import java.util.Vector; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.SecurityAdvisor; import org.sakaiproject.authz.api.SecurityService; import org.sakaiproject.user.api.User; @@ -39,7 +39,7 @@ public abstract class NoSecurity implements SecurityService { /** Our logger. */ - private static Log M_log = LogFactory.getLog(NoSecurity.class); + private static Logger M_log = LoggerFactory.getLogger(NoSecurity.class); /********************************************************************************************************************************************************************************************************************************************************** * Dependencies diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/authz/impl/SakaiSecurity.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/authz/impl/SakaiSecurity.java index 9b5b6c40eb05..61c7e3100c96 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/authz/impl/SakaiSecurity.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/authz/impl/SakaiSecurity.java @@ -23,8 +23,8 @@ import net.sf.ehcache.Ehcache; import net.sf.ehcache.Element; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.*; import org.sakaiproject.entity.api.Entity; import org.sakaiproject.entity.api.EntityManager; @@ -52,7 +52,7 @@ public abstract class SakaiSecurity implements SecurityService, Observer { /** Our logger. */ - private static Log M_log = LogFactory.getLog(SakaiSecurity.class); + private static Logger M_log = LoggerFactory.getLogger(SakaiSecurity.class); /** A cache of calls to the service and the results. */ protected Cache m_callCache = null; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/cluster/impl/SakaiClusterService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/cluster/impl/SakaiClusterService.java index e41a0d07db37..4df85056e9f7 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/cluster/impl/SakaiClusterService.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/cluster/impl/SakaiClusterService.java @@ -25,8 +25,8 @@ import java.sql.SQLException; import java.util.*; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.cluster.api.ClusterNode; import org.sakaiproject.cluster.api.ClusterService; import org.sakaiproject.component.api.ServerConfigurationService; @@ -48,7 +48,7 @@ public class SakaiClusterService implements ClusterService { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(SakaiClusterService.class); + private static Logger M_log = LoggerFactory.getLogger(SakaiClusterService.class); /** The maintenance. */ protected Maintenance m_maintenance = null; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/component/impl/BasicConfigurationService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/component/impl/BasicConfigurationService.java index b034b0b2bd0d..78408bc7b6b1 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/component/impl/BasicConfigurationService.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/component/impl/BasicConfigurationService.java @@ -39,8 +39,8 @@ import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.component.api.ServerConfigurationService.ConfigurationListener.BlockingConfigItem; import org.sakaiproject.component.locales.SakaiLocales; @@ -65,7 +65,7 @@ public class BasicConfigurationService implements ServerConfigurationService, Ap private static final String SOURCE_GET_STRINGS = "getStrings"; /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(BasicConfigurationService.class); + private static Logger M_log = LoggerFactory.getLogger(BasicConfigurationService.class); /** * The delegate that handles all the configuration for tools. diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/component/impl/ToolConfigurationService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/component/impl/ToolConfigurationService.java index 455c7a1d7190..84be9e6c8557 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/component/impl/ToolConfigurationService.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/component/impl/ToolConfigurationService.java @@ -1,8 +1,8 @@ package org.sakaiproject.component.impl; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.util.Xml; import org.springframework.core.io.Resource; import org.w3c.dom.Document; @@ -21,7 +21,7 @@ */ public class ToolConfigurationService { - private final Log log = LogFactory.getLog(ToolConfigurationService.class); + private final Logger log = LoggerFactory.getLogger(ToolConfigurationService.class); private boolean useToolGroup; /** @@ -441,4 +441,4 @@ String processTool(Element element, List order, List required, L } return id; } -} \ No newline at end of file +} diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/conditions/impl/BaseConditionService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/conditions/impl/BaseConditionService.java index 2fff128fe88d..eda898fc20f8 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/conditions/impl/BaseConditionService.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/conditions/impl/BaseConditionService.java @@ -27,8 +27,8 @@ import java.util.Observer; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.conditions.api.Condition; import org.sakaiproject.conditions.api.ConditionProvider; import org.sakaiproject.conditions.api.ConditionService; @@ -38,7 +38,7 @@ public class BaseConditionService implements ConditionService, Observer { - private static Log log = LogFactory.getLog(BaseConditionService.class); + private static Logger log = LoggerFactory.getLogger(BaseConditionService.class); private Map eventLookup = new HashMap(); private Map registeredProviders = new HashMap(); diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/config/impl/HibernateConfigItemDaoImpl.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/config/impl/HibernateConfigItemDaoImpl.java index 97b1d2a7439c..9ba3c4cac0ec 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/config/impl/HibernateConfigItemDaoImpl.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/config/impl/HibernateConfigItemDaoImpl.java @@ -21,8 +21,8 @@ package org.sakaiproject.config.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.Criteria; import org.hibernate.criterion.Projections; import org.hibernate.criterion.Restrictions; @@ -44,7 +44,7 @@ * Created on Mar 8, 2013 */ public class HibernateConfigItemDaoImpl extends HibernateDaoSupport implements HibernateConfigItemDao { - private final Log log = LogFactory.getLog(HibernateConfigItemDaoImpl.class); + private final Logger log = LoggerFactory.getLogger(HibernateConfigItemDaoImpl.class); private static String SAKAI_CONFIG_ITEM_SQL = "sakai_config_item"; private SqlService sqlService; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/config/impl/StoredConfigService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/config/impl/StoredConfigService.java index e5e4b2b6a927..f1617680c0cd 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/config/impl/StoredConfigService.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/config/impl/StoredConfigService.java @@ -26,8 +26,8 @@ import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang.IllegalClassException; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.jasypt.encryption.pbe.PBEStringEncryptor; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.component.api.ServerConfigurationService.ConfigData; @@ -72,7 +72,7 @@ public class StoredConfigService implements ConfigurationListener, Configuration // config that should never be persisted public static final String SAKAI_CONFIG_NEVER_PERSIST = "sakai.config.never.persist"; - private final Log log = LogFactory.getLog(StoredConfigService.class); + private final Logger log = LoggerFactory.getLogger(StoredConfigService.class); private ScheduledExecutorService scheduler; private ServerConfigurationService serverConfigurationService; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/BaseContentService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/BaseContentService.java index 26d4041b9049..7a994a53c529 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/BaseContentService.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/BaseContentService.java @@ -66,8 +66,8 @@ import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.lang.ArrayUtils; import org.sakaiproject.alias.api.AliasService; import org.sakaiproject.antivirus.api.VirusFoundException; @@ -188,7 +188,7 @@ public abstract class BaseContentService implements ContentHostingService, Cache SiteContentAdvisorProvider, SiteContentAdvisorTypeRegistry, EntityTransferrerRefMigrator, HardDeleteAware { /** Our logger. */ - private static Log M_log = LogFactory.getLog(BaseContentService.class); + private static Logger M_log = LoggerFactory.getLogger(BaseContentService.class); protected static final long END_OF_TIME = 8000L * 365L * 24L * 60L * 60L * 1000L; protected static final long START_OF_TIME = 365L * 24L * 60L * 60L * 1000L; @@ -7432,7 +7432,7 @@ public Entity getEntity(Reference ref) } catch (EntityPropertyTypeException e) { - // Log this and assume it's not a collection + // Logger this and assume it's not a collection M_log.warn("EntityPropertyTypeException: PROP_IS_COLLECTION not boolean for " + ref.getReference()); } if (isCollection) @@ -8971,7 +8971,7 @@ protected ContentCollection mergeCollection(Element element) throws PermissionEx } catch(EntityPropertyTypeException epte) { - M_log.error(epte); + M_log.error(epte.getMessage(), epte); } // setup the event @@ -12449,7 +12449,7 @@ public BaseResourceEdit(Element el) } catch (UnsupportedEncodingException e) { - M_log.error(e); + M_log.error(e.getMessage(), e); } m_body = new byte[(int) m_contentLength]; @@ -12591,7 +12591,7 @@ public void startElement(String uri, String localName, String qName, } catch (UnsupportedEncodingException e) { - M_log.error(e); + M_log.error(e.getMessage(), e); } m_body = new byte[(int) m_contentLength]; System.arraycopy(decoded, 0, m_body, 0, (int) m_contentLength); @@ -12995,7 +12995,7 @@ public Element toXml(Document doc, Stack stack) } catch (UnsupportedEncodingException e) { - M_log.error(e); + M_log.error(e.getMessage(), e); } resource.setAttribute("body", enc); } diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/BasicContentPrintService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/BasicContentPrintService.java index 989e039d5ce4..3d11821bbad5 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/BasicContentPrintService.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/BasicContentPrintService.java @@ -26,8 +26,8 @@ import org.sakaiproject.content.api.*; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** *

@@ -37,7 +37,7 @@ public class BasicContentPrintService implements ContentPrintService { /** Our logger. */ - private static Log M_log = LogFactory.getLog(BasicContentPrintService.class); + private static Logger M_log = LoggerFactory.getLogger(BasicContentPrintService.class); /** * {@inheritDoc} diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/BasicContentTypeImageService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/BasicContentTypeImageService.java index 34f52c515645..1cd7a51828dc 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/BasicContentTypeImageService.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/BasicContentTypeImageService.java @@ -33,8 +33,8 @@ import java.util.TreeSet; import java.util.Vector; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.content.api.ContentTypeImageService; import org.sakaiproject.util.Resource; @@ -50,7 +50,7 @@ public class BasicContentTypeImageService implements ContentTypeImageService private ServerConfigurationService serverConfigurationService = null; /** Our logger. */ - private static Log M_log = LogFactory.getLog(BasicContentTypeImageService.class); + private static Logger M_log = LoggerFactory.getLogger(BasicContentTypeImageService.class); /** Map content type to image file name. */ //protected Properties m_contentTypeImages = null; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/CollectionAccessFormatter.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/CollectionAccessFormatter.java index 1bf57b4685f5..77c3b5340b6b 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/CollectionAccessFormatter.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/CollectionAccessFormatter.java @@ -31,8 +31,8 @@ import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.content.api.ContentCollection; import org.sakaiproject.content.api.ContentEntity; @@ -53,7 +53,7 @@ */ public class CollectionAccessFormatter { - private static final Log M_log = LogFactory.getLog(CollectionAccessFormatter.class); + private static final Logger M_log = LoggerFactory.getLogger(CollectionAccessFormatter.class); private FormattedText formattedText; private ServerConfigurationService serverConfigurationService; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/ContentHostingHandlerResolverImpl.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/ContentHostingHandlerResolverImpl.java index e24e165910f5..f1b9b2c89852 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/ContentHostingHandlerResolverImpl.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/ContentHostingHandlerResolverImpl.java @@ -7,8 +7,8 @@ import java.util.Collection; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.content.api.ContentCollection; import org.sakaiproject.content.api.ContentCollectionEdit; @@ -51,7 +51,7 @@ public class ContentHostingHandlerResolverImpl implements ContentHostingHandlerResolver { - private static final Log log = LogFactory.getLog(ContentHostingHandlerResolverImpl.class); + private static final Logger log = LoggerFactory.getLogger(ContentHostingHandlerResolverImpl.class); protected SingleStorageUser resourceStorageUser; @@ -84,7 +84,7 @@ public ContentEntity getRealParent( String id) if (id.equals(Entity.SEPARATOR)) { // If the entity is the root and we didn't get anything, there is nothing we can do // no root, no content, no point in trying to get another one - log.fatal("Unable to get Root node of the repository"); + log.error("Unable to get Root node of the repository"); throw new AssertionError("Unable to Get Root repository "+Entity.SEPARATOR); } int lastSlash = id.lastIndexOf(Entity.SEPARATOR, id.length() - 2); diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/DbContentService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/DbContentService.java index 6e140cf75ccb..5a6f124f7b76 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/DbContentService.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/DbContentService.java @@ -45,8 +45,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.content.api.ContentCollection; import org.sakaiproject.content.api.ContentCollectionEdit; @@ -83,6 +83,8 @@ import org.sakaiproject.util.EntityReaderAdapter; import org.sakaiproject.util.SingleStorageUser; import org.sakaiproject.util.Xml; +import org.slf4j.Marker; +import org.slf4j.MarkerFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -97,7 +99,8 @@ public class DbContentService extends BaseContentService { /** Our logger. */ - private static Log M_log = LogFactory.getLog(DbContentService.class); + private static Logger M_log = LoggerFactory.getLogger(DbContentService.class); + private static final Marker FATAL = MarkerFactory.getMarker("FATAL"); /** Table name for collections. */ protected String m_collectionTableName = "CONTENT_COLLECTION"; @@ -420,11 +423,9 @@ public void init() } catch (Exception ex) { - M_log.fatal("Check on Database Failed ", ex); - M_log - .fatal("==========================================================="); - M_log - .fatal("WARNING \n" + M_log.error(FATAL, "Check on Database Failed", ex); + M_log.error(FATAL, "==========================================================="); + M_log.error(FATAL, "WARNING \n" + " The connection from this instance of Sakai to the database\n" + " has been tested and found to corrupt UTF-8 Data. \n" + " In order for Sakai to operate correctly you must ensure that your \n" @@ -1023,13 +1024,12 @@ public DbStorage(SingleStorageUser collectionUser, SingleStorageUser resourceUse n = rs.getInt(1); } if ( n != 0 ) { - M_log.fatal("\n" + - "There are migrated content collection entries in the \n" + + M_log.error(FATAL, "There are migrated content collection entries in the \n" + "BINARY_ENTITY column of CONTENT_COLLECTION you must ensure that this \n" + "data is not required and set all entries to null before starting \n" + "up with migrate data disabled. Failure to do this could loose \n" + - "updates since this database was upgraded \n"); - M_log.fatal("STOP ============================================"); + "updates since this database was upgraded \n"); + M_log.error(FATAL, "STOP ============================================"); /*we need to close these here otherwise the system exit will lead them to being left open * While this may be harmful is bad practice and prevents us identifying real issues */ @@ -1044,13 +1044,12 @@ public DbStorage(SingleStorageUser collectionUser, SingleStorageUser resourceUse n = rs.getInt(1); } if ( n != 0 ) { - M_log.fatal("\n" + - "There are migrated content collection entries in the \n" + + M_log.error(FATAL, "There are migrated content collection entries in the \n" + "BINARY_ENTITY column of CONTENT_RESOURCE you must ensure that this \n" + "data is not required and set all entries to null before starting \n" + "up with migrate data disabled. Failure to do this could loose \n" + - "updates since this database was upgraded \n"); - M_log.fatal("STOP ============================================"); + "updates since this database was upgraded \n"); + M_log.error(FATAL, "STOP ============================================"); /*we need to close these here otherwise the system exit will lead them to being left open * While this may be harmful is bad practice and prevents us identifying real issues */ @@ -1065,13 +1064,12 @@ public DbStorage(SingleStorageUser collectionUser, SingleStorageUser resourceUse n = rs.getInt(1); } if ( n != 0 ) { - M_log.fatal("\n" + - "There are migrated content collection entries in the \n" + + M_log.error(FATAL, "There are migrated content collection entries in the \n" + "BINARY_ENTITY column of CONTENT_RESOURCE_DELETE you must ensure that this \n" + "data is not required and set all entries to null before starting \n" + "up with migrate data disabled. Failure to do this could loose \n" + - "updates since this database was upgraded \n"); - M_log.fatal("STOP ============================================"); + "updates since this database was upgraded \n"); + M_log.error(FATAL, "STOP ============================================"); /*we need to close these here otherwise the system exit will lead them to being left open * While this may be harmful is bad practice and prevents us identifying real issues */ @@ -1085,7 +1083,7 @@ public DbStorage(SingleStorageUser collectionUser, SingleStorageUser resourceUse } } catch (SQLException e) { - M_log.error("Unable to get database statement: " + e, e); + M_log.error("Unable to get database statement: {}", e.getMessage(), e); } finally { cleanup(connection, statement, rs, selectStatement, updateStatement); } diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/DbResourceTypeRegistry.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/DbResourceTypeRegistry.java index 9b980434ac5e..49e75bd87936 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/DbResourceTypeRegistry.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/DbResourceTypeRegistry.java @@ -27,8 +27,8 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.content.api.ResourceType; import org.sakaiproject.content.api.SiteSpecificResourceType; import org.sakaiproject.db.api.SqlReader; @@ -38,7 +38,7 @@ public class DbResourceTypeRegistry extends ResourceTypeRegistryImpl { /** Our logger. */ - protected static final Log M_log = LogFactory.getLog(DbResourceTypeRegistry.class); + protected static final Logger M_log = LoggerFactory.getLogger(DbResourceTypeRegistry.class); /** Configuration: to run the ddl on init or not. */ protected boolean m_autoDdl = false; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/DropboxContextObserver.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/DropboxContextObserver.java index 553c8f66168d..d0a9120c5109 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/DropboxContextObserver.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/DropboxContextObserver.java @@ -27,8 +27,8 @@ import java.util.Set; import java.util.Stack; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.entity.api.ContextObserver; import org.sakaiproject.entity.api.Entity; import org.sakaiproject.entity.api.EntityManager; @@ -47,7 +47,7 @@ public class DropboxContextObserver implements EntityProducer, ContextObserver { /** Our logger. */ - private static Log M_log = LogFactory.getLog(DropboxContextObserver.class); + private static Logger M_log = LoggerFactory.getLogger(DropboxContextObserver.class); /** This string starts the references to resources in this service. */ public static final String REFERENCE_ROOT = Entity.SEPARATOR + "dropbox"; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/DropboxNotification.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/DropboxNotification.java index 1aaced75127f..6f8fee423cab 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/DropboxNotification.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/DropboxNotification.java @@ -28,8 +28,8 @@ import java.util.Collection; import java.util.HashSet; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.SecurityService; import org.sakaiproject.authz.api.Member; import org.sakaiproject.component.api.ServerConfigurationService; @@ -75,7 +75,7 @@ */ public class DropboxNotification extends EmailNotification { - static final Log logger = LogFactory.getLog(DropboxNotification.class); + static final Logger logger = LoggerFactory.getLogger(DropboxNotification.class); /* property bundles */ private static final String DEFAULT_RESOURCECLASS = "org.sakaiproject.localization.util.SiteemaconProperties"; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/LockManagerImpl.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/LockManagerImpl.java index 291c80f6e865..f4e1d359149c 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/LockManagerImpl.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/LockManagerImpl.java @@ -27,6 +27,8 @@ import org.sakaiproject.content.api.Lock; import org.sakaiproject.content.api.LockManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.orm.hibernate3.HibernateObjectRetrievalFailureException; import org.springframework.orm.hibernate3.HibernateSystemException; import org.springframework.orm.hibernate3.support.HibernateDaoSupport; @@ -34,8 +36,7 @@ public class LockManagerImpl extends HibernateDaoSupport implements LockManager { - protected final static org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory - .getLog(LockManagerImpl.class); + protected final static Logger logger = LoggerFactory.getLogger(LockManagerImpl.class); /* * (non-Javadoc) @@ -74,14 +75,9 @@ protected Lock findLock(String assetId, String qualifierId) return (Lock) safePopList(getHibernateTemplate().findByNamedQuery("getLock", new Object[] { assetId, qualifierId })); } - catch (HibernateSystemException e) + catch (HibernateSystemException | HibernateObjectRetrievalFailureException e) { - logger.debug("lock with assetId=" + assetId + " and qualifierId= " + qualifierId + "not found: " + e.getMessage()); - return null; - } - catch (HibernateObjectRetrievalFailureException e) - { - logger.debug("lock with assetId=" + assetId + " and qualifierId= " + qualifierId + "not found: " + e.getMessage()); + logger.debug("lock with assetId={} and qualifierId={} not found: {}", assetId, qualifierId, e.getMessage()); return null; } } @@ -93,14 +89,14 @@ protected Lock findOrCreateLock(String assetId, String qualifierId, boolean expe { if (expected == true) { - logger.warn("expected Lock not found: " + assetId + ", " + qualifierId); + logger.warn("expected Lock not found: {}, {}", assetId, qualifierId); } return new org.sakaiproject.content.hbm.Lock(); } if (expected == false && lock.isActive()) { - logger.warn("Lock not expected, but found anyway: " + assetId + ", " + qualifierId); + logger.warn("Lock not expected, but found anyway: {}, {}", assetId, qualifierId); } return lock; @@ -127,10 +123,7 @@ protected Date now() public Collection getLocks(String assetId) { Collection locks = null; - if (logger.isDebugEnabled()) - { - logger.debug("getLocks(" + assetId + ")"); - } + logger.debug("getLocks({})", assetId); try { @@ -138,7 +131,7 @@ public Collection getLocks(String assetId) } catch (HibernateObjectRetrievalFailureException e) { - logger.error("", e); + logger.error(e.getMessage()); throw new RuntimeException(e); } if (locks == null) return null; @@ -176,17 +169,14 @@ public void removeAllLocks(String qualifier) protected Collection getQualifierLocks(String qualifier) { Collection locks = null; - if (logger.isDebugEnabled()) - { - logger.debug("getLocks(" + qualifier + ")"); - } + logger.debug("getLocks({})", qualifier); try { locks = (List) getHibernateTemplate().findByNamedQuery("activeByQualifier", qualifier); } catch (HibernateObjectRetrievalFailureException e) { - logger.error("", e); + logger.error(e.getMessage()); throw new RuntimeException(e); } if (locks == null) return null; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/ResourceTypeRegistryImpl.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/ResourceTypeRegistryImpl.java index be6c1a7bf1ea..053d0e74bee2 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/ResourceTypeRegistryImpl.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/ResourceTypeRegistryImpl.java @@ -31,8 +31,8 @@ import java.util.SortedSet; import java.util.TreeSet; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.content.api.ResourceToolAction; import org.sakaiproject.content.api.ResourceToolActionPipe; import org.sakaiproject.content.api.ResourceType; @@ -49,7 +49,7 @@ public class ResourceTypeRegistryImpl implements ResourceTypeRegistry { /** Our logger. */ - protected static final Log M_log = LogFactory.getLog(ResourceTypeRegistryImpl.class); + protected static final Logger M_log = LoggerFactory.getLogger(ResourceTypeRegistryImpl.class); /** Map of ResourceType objects indexed by typeId */ protected Map typeIndex = new HashMap(); diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/serialize/impl/conversion/FileSizeResourcesConversionHandler.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/serialize/impl/conversion/FileSizeResourcesConversionHandler.java index e88fa0bd2b98..df846c48a891 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/serialize/impl/conversion/FileSizeResourcesConversionHandler.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/serialize/impl/conversion/FileSizeResourcesConversionHandler.java @@ -30,8 +30,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.content.impl.serialize.impl.Type1BaseContentResourceSerializer; import org.sakaiproject.util.conversion.SchemaConversionHandler; @@ -43,8 +43,7 @@ public class FileSizeResourcesConversionHandler implements SchemaConversionHandler { - private static final Log log = LogFactory - .getLog(FileSizeResourcesConversionHandler.class); + private static final Logger log = LoggerFactory.getLogger(FileSizeResourcesConversionHandler.class); private Pattern contextPattern = Pattern.compile("\\A/(group/|user/|~)(.+?)/"); diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/serialize/impl/conversion/SAXSerializableCollectionAccess.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/serialize/impl/conversion/SAXSerializableCollectionAccess.java index cdeb15cb72a9..7a144f6ffe53 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/serialize/impl/conversion/SAXSerializableCollectionAccess.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/serialize/impl/conversion/SAXSerializableCollectionAccess.java @@ -35,8 +35,8 @@ import javax.xml.parsers.SAXParserFactory; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.content.api.ResourceType; import org.sakaiproject.content.api.GroupAwareEntity.AccessMode; import org.sakaiproject.content.impl.serialize.api.SerializableCollectionAccess; @@ -61,8 +61,7 @@ public class SAXSerializableCollectionAccess implements SerializableCollectionAc protected static final long START_OF_TIME = 365L * 24L * 60L * 60L * 1000L; - protected static final Log log = LogFactory - .getLog(SAXSerializableResourceAccess.class); + protected static final Logger log = LoggerFactory.getLogger(SAXSerializableResourceAccess.class); private Type1BaseContentCollectionSerializer type1CollectionSerializer; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/serialize/impl/conversion/SAXSerializableResourceAccess.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/serialize/impl/conversion/SAXSerializableResourceAccess.java index ead9e6e49b18..ceba06787fde 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/serialize/impl/conversion/SAXSerializableResourceAccess.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/serialize/impl/conversion/SAXSerializableResourceAccess.java @@ -38,8 +38,8 @@ import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.content.api.ResourceType; import org.sakaiproject.content.api.ResourceTypeRegistry; import org.sakaiproject.content.api.GroupAwareEntity.AccessMode; @@ -65,8 +65,7 @@ public class SAXSerializableResourceAccess implements SerializableResourceAccess protected static final long START_OF_TIME = 365L * 24L * 60L * 60L * 1000L; - protected static final Log log = LogFactory - .getLog(SAXSerializableResourceAccess.class); + protected static final Logger log = LoggerFactory.getLogger(SAXSerializableResourceAccess.class); private Type1BaseContentResourceSerializer type1ResourceSerializer; @@ -478,7 +477,7 @@ else if ("resource".equalsIgnoreCase(qName)) } catch (UnsupportedEncodingException e) { - log.error(e); + log.error(e.getMessage(), e); } body = new byte[(int) contentLength]; System.arraycopy(decoded, 0, body, 0, (int) contentLength); diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/db/impl/BasicSqlService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/db/impl/BasicSqlService.java index b4c9c11408f3..a1c607b21ba6 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/db/impl/BasicSqlService.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/db/impl/BasicSqlService.java @@ -46,8 +46,8 @@ import javax.sql.DataSource; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.db.api.SqlReader; import org.sakaiproject.db.api.SqlReaderFinishedException; import org.sakaiproject.db.api.SqlService; @@ -65,9 +65,9 @@ */ public abstract class BasicSqlService implements SqlService { - private static final Log LOG = LogFactory.getLog(BasicSqlService.class); + private static final Logger LOG = LoggerFactory.getLogger(BasicSqlService.class); - private static final Log SWC_LOG = LogFactory.getLog(StreamWithConnection.class); + private static final Logger SWC_LOG = LoggerFactory.getLogger(StreamWithConnection.class); /** Key name in thread local to find the current transaction connection. */ protected static final String TRANSACTION_CONNECTION = "sqlService:transaction_connection"; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/email/impl/BaseDigestService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/email/impl/BaseDigestService.java index 67992410a1e4..f3c1775a0749 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/email/impl/BaseDigestService.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/email/impl/BaseDigestService.java @@ -34,8 +34,8 @@ import java.util.TimerTask; import java.util.Vector; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.SecurityService; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.email.api.Digest; @@ -78,7 +78,7 @@ public abstract class BaseDigestService implements DigestService, SingleStorageUser { /** Our logger. */ - private static Log M_log = LogFactory.getLog(BasicEmailService.class); + private static Logger M_log = LoggerFactory.getLogger(BasicEmailService.class); /** localized tool properties **/ private static final String DEFAULT_RESOURCECLASS = "org.sakaiproject.localization.util.EmailImplProperties"; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/email/impl/BasicEmailService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/email/impl/BasicEmailService.java index 3556c2d914eb..c5141d309150 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/email/impl/BasicEmailService.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/email/impl/BasicEmailService.java @@ -52,8 +52,8 @@ import javax.mail.internet.MimeUtility; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.email.api.AddressValidationException; import org.sakaiproject.email.api.Attachment; @@ -75,7 +75,7 @@ public class BasicEmailService implements EmailService { /** Our logger. */ - private static Log M_log = LogFactory.getLog(BasicEmailService.class); + private static Logger M_log = LoggerFactory.getLogger(BasicEmailService.class); protected static final String PROTOCOL_SMTP = "smtp"; protected static final String PROTOCOL_SMTPS = "smtps"; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/email/impl/DbDigestService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/email/impl/DbDigestService.java index bc650e3952fc..596c81012a9f 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/email/impl/DbDigestService.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/email/impl/DbDigestService.java @@ -23,8 +23,8 @@ import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.db.api.SqlService; import org.sakaiproject.email.api.Digest; import org.sakaiproject.email.api.DigestEdit; @@ -39,7 +39,7 @@ public class DbDigestService extends BaseDigestService { /** Our logger. */ - private static Log M_log = LogFactory.getLog(DbDigestService.class); + private static Logger M_log = LoggerFactory.getLogger(DbDigestService.class); /** Table name for realms. */ protected String m_tableName = "SAKAI_DIGEST"; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/entity/impl/EntityManagerComponent.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/entity/impl/EntityManagerComponent.java index d233537329f4..a77794585b6e 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/entity/impl/EntityManagerComponent.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/entity/impl/EntityManagerComponent.java @@ -28,8 +28,8 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.entity.api.EntityManager; import org.sakaiproject.entity.api.EntityProducer; import org.sakaiproject.entity.api.Reference; @@ -143,7 +143,7 @@ public void iterateEnd() } /** Our logger. */ - protected static final Log M_log = LogFactory.getLog(EntityManagerComponent.class); + protected static final Logger M_log = LoggerFactory.getLogger(EntityManagerComponent.class); /** Set of EntityProducer services. */ protected ConcurrentHashMap m_producersIn = new ConcurrentHashMap(); diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/entity/impl/ReferenceComponent.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/entity/impl/ReferenceComponent.java index b82485a91dad..53b4424642eb 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/entity/impl/ReferenceComponent.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/entity/impl/ReferenceComponent.java @@ -24,8 +24,8 @@ import java.util.Collection; import java.util.Vector; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.entity.api.Entity; import org.sakaiproject.entity.api.EntityProducer; import org.sakaiproject.entity.api.Reference; @@ -44,7 +44,7 @@ public class ReferenceComponent implements Reference { /** Our logger. */ - protected static final Log M_log = LogFactory.getLog(ReferenceComponent.class); + protected static final Logger M_log = LoggerFactory.getLogger(ReferenceComponent.class); /** The reference string. */ protected String m_reference = null; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/ActivityServiceImpl.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/ActivityServiceImpl.java index 190a31e1f748..7e2db826db53 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/ActivityServiceImpl.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/ActivityServiceImpl.java @@ -9,8 +9,8 @@ import java.util.Observer; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.event.api.ActivityService; import org.sakaiproject.event.api.Event; import org.sakaiproject.event.api.EventTrackingService; @@ -25,7 +25,7 @@ */ public class ActivityServiceImpl implements ActivityService, Observer { - private static Log log = LogFactory.getLog(ActivityServiceImpl.class); + private static Logger log = LoggerFactory.getLogger(ActivityServiceImpl.class); private Cache userActivityCache = null; private final String USER_ACTIVITY_CACHE_NAME = "org.sakaiproject.event.api.ActivityService.userActivityCache"; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/BaseEventTrackingService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/BaseEventTrackingService.java index e4ce95158cfa..050b1941373c 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/BaseEventTrackingService.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/BaseEventTrackingService.java @@ -21,8 +21,8 @@ package org.sakaiproject.event.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.SecurityAdvisor; import org.sakaiproject.authz.api.SecurityService; import org.sakaiproject.entity.api.EntityManager; @@ -47,7 +47,7 @@ public abstract class BaseEventTrackingService implements EventTrackingService { /** Our logger. */ - private static Log M_log = LogFactory.getLog(BaseEventTrackingService.class); + private static Logger M_log = LoggerFactory.getLogger(BaseEventTrackingService.class); /** An observable object helper. */ protected MyObservable m_observableHelper = new MyObservable(); diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/BaseLearningResourceStoreService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/BaseLearningResourceStoreService.java index 2e0f96923d97..5d823325d71a 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/BaseLearningResourceStoreService.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/BaseLearningResourceStoreService.java @@ -28,8 +28,8 @@ import java.util.concurrent.ConcurrentHashMap; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.event.api.Event; import org.sakaiproject.event.api.EventTrackingService; @@ -66,7 +66,7 @@ public class BaseLearningResourceStoreService implements LearningResourceStoreSe private static final String ORIGIN_SAKAI_SYSTEM = "sakai.system"; private static final String ORIGIN_SAKAI_CONTENT = "sakai.resources"; - private static final Log log = LogFactory.getLog(BaseLearningResourceStoreService.class); + private static final Logger log = LoggerFactory.getLogger(BaseLearningResourceStoreService.class); /** * Stores the complete set of known LRSP providers (from the Spring AC or registered manually) diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/BaseNotificationService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/BaseNotificationService.java index 60744fbfc070..1ffd48711cb5 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/BaseNotificationService.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/BaseNotificationService.java @@ -22,8 +22,8 @@ package org.sakaiproject.event.impl; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ComponentManager; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.entity.api.Edit; @@ -54,7 +54,7 @@ public abstract class BaseNotificationService implements NotificationService, Observer, SingleStorageUser, CacheRefresher { /** Our logger. */ - private static Log M_log = LogFactory.getLog(BaseNotificationService.class); + private static Logger M_log = LoggerFactory.getLogger(BaseNotificationService.class); /** Storage manager for this service. */ protected Storage m_storage = null; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/BasicEventTracking.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/BasicEventTracking.java index cce7fa496b13..eb3c030a23bc 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/BasicEventTracking.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/BasicEventTracking.java @@ -21,8 +21,8 @@ package org.sakaiproject.event.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.event.api.Event; /** @@ -36,7 +36,7 @@ public abstract class BasicEventTracking extends BaseEventTrackingService { /** Our logger. */ - private static Log M_log = LogFactory.getLog(BasicEventTracking.class); + private static Logger M_log = LoggerFactory.getLogger(BasicEventTracking.class); /** String used to identify this service in the logs */ protected static final String m_logId = "EventTracking: "; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/ClusterEventTracking.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/ClusterEventTracking.java index 236544f6be3a..c6c0ee63b57e 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/ClusterEventTracking.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/ClusterEventTracking.java @@ -22,8 +22,8 @@ package org.sakaiproject.event.impl; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.db.api.SqlReader; @@ -54,7 +54,7 @@ public abstract class ClusterEventTracking extends BaseEventTrackingService impl private static final long WARNING_SAFE_EVENTS_TABLE_SIZE = 18000000l; private static final long MAX_SAFE_EVENTS_TABLE_SIZE = 20000000l; /** Our logger. */ - private static Log M_log = LogFactory.getLog(ClusterEventTracking.class); + private static Logger M_log = LoggerFactory.getLogger(ClusterEventTracking.class); /** The db event checker thread. */ protected Thread m_thread = null; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/DbNotificationService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/DbNotificationService.java index 08b17ece4ab8..fcd1d426c42e 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/DbNotificationService.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/DbNotificationService.java @@ -25,8 +25,8 @@ import java.util.List; import java.util.Vector; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.db.api.SqlService; import org.sakaiproject.event.api.Notification; import org.sakaiproject.event.api.NotificationEdit; @@ -41,7 +41,7 @@ public abstract class DbNotificationService extends BaseNotificationService { /** Our logger. */ - private static Log M_log = LogFactory.getLog(DbNotificationService.class); + private static Logger M_log = LoggerFactory.getLogger(DbNotificationService.class); /** Table name for users. */ protected String m_tableName = "SAKAI_NOTIFICATION"; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/EventQueryServiceImpl.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/EventQueryServiceImpl.java index be76f18a6421..10080c55f418 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/EventQueryServiceImpl.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/EventQueryServiceImpl.java @@ -1,7 +1,7 @@ package org.sakaiproject.event.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.event.api.EventQueryService; import org.sakaiproject.util.Xml; import org.w3c.dom.Document; @@ -24,7 +24,7 @@ */ public class EventQueryServiceImpl implements EventQueryService { - private static Log log = LogFactory.getLog(EventQueryServiceImpl.class); + private static Logger log = LoggerFactory.getLogger(EventQueryServiceImpl.class); private DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/UsageSessionServiceAdaptor.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/UsageSessionServiceAdaptor.java index 70a1b3cbd7af..03dd2d11665c 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/UsageSessionServiceAdaptor.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/UsageSessionServiceAdaptor.java @@ -39,8 +39,8 @@ import javax.servlet.http.HttpServletRequest; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroupService; import org.sakaiproject.authz.api.SecurityService; import org.sakaiproject.component.api.ServerConfigurationService; @@ -75,7 +75,7 @@ public abstract class UsageSessionServiceAdaptor implements UsageSessionService private static final long MAX_SAFE_SESSIONS_TABLE_SIZE = 2000000l; /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(UsageSessionServiceAdaptor.class); + private static Logger M_log = LoggerFactory.getLogger(UsageSessionServiceAdaptor.class); /** Storage manager for this service. */ protected Storage m_storage = null; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/id/impl/UuidV4IdComponent.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/id/impl/UuidV4IdComponent.java index 157ce6c57a6d..8ec13370f925 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/id/impl/UuidV4IdComponent.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/id/impl/UuidV4IdComponent.java @@ -23,8 +23,8 @@ import java.util.UUID; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.id.api.IdManager; /** @@ -35,7 +35,7 @@ public class UuidV4IdComponent implements IdManager { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(UuidV4IdComponent.class); + private static Logger M_log = LoggerFactory.getLogger(UuidV4IdComponent.class); /********************************************************************************************************************************************************************************************************************************************************** * Dependencies and their setter methods diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/BaseMemoryService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/BaseMemoryService.java index db90a640be08..5b51fb9d95c2 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/BaseMemoryService.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/BaseMemoryService.java @@ -23,8 +23,8 @@ import net.sf.ehcache.CacheManager; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.SecurityService; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.component.cover.ComponentManager; @@ -43,7 +43,7 @@ public class BaseMemoryService implements MemoryService { public static final String TYPE_EHCACHE = "ehcache"; public static final String TYPE_HAZELCAST = "hazelcast"; - final Log log = LogFactory.getLog(BaseMemoryService.class); + final Logger log = LoggerFactory.getLogger(BaseMemoryService.class); ServerConfigurationService serverConfigurationService; CacheManager cacheManager; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/BasicCache.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/BasicCache.java index ac0a9a736a6c..dbb1a82af8ec 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/BasicCache.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/BasicCache.java @@ -21,8 +21,8 @@ package org.sakaiproject.memory.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.memory.api.Cache; import org.sakaiproject.memory.api.CacheLoader; import org.sakaiproject.memory.api.CacheStatistics; @@ -38,7 +38,7 @@ * @author Aaron Zeckoski (azeckoski @ unicon.net) (azeckoski @ gmail.com) */ public abstract class BasicCache implements Cache { - final Log log = LogFactory.getLog(BasicCache.class); + final Logger log = LoggerFactory.getLogger(BasicCache.class); /** * the name for this cache */ diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/BasicMapCache.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/BasicMapCache.java index 18f5eadd52fc..79cb8e6017ef 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/BasicMapCache.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/BasicMapCache.java @@ -21,8 +21,8 @@ package org.sakaiproject.memory.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.memory.api.Configuration; import java.util.Map; @@ -36,7 +36,7 @@ * @author Aaron Zeckoski (azeckoski @ unicon.net) (azeckoski @ gmail.com) */ public class BasicMapCache extends BasicCache { - final Log log = LogFactory.getLog(BasicMapCache.class); + final Logger log = LoggerFactory.getLogger(BasicMapCache.class); /** * Underlying cache implementation diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/EhCacheJmxRegistration.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/EhCacheJmxRegistration.java index 0cabd4d466ed..f33133313768 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/EhCacheJmxRegistration.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/EhCacheJmxRegistration.java @@ -23,8 +23,8 @@ import net.sf.ehcache.CacheManager; import net.sf.ehcache.management.ManagementService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.management.MBeanServer; import java.lang.management.ManagementFactory; @@ -36,7 +36,7 @@ public class EhCacheJmxRegistration { - private static final Log log = LogFactory.getLog(EhCacheJmxRegistration.class); + private static final Logger log = LoggerFactory.getLogger(EhCacheJmxRegistration.class); private MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer(); diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/EhcacheCache.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/EhcacheCache.java index f6725c280b7d..1cb8eb1cda5f 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/EhcacheCache.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/EhcacheCache.java @@ -26,8 +26,8 @@ import net.sf.ehcache.Element; import net.sf.ehcache.config.CacheConfiguration; import net.sf.ehcache.event.CacheEventListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.memory.api.CacheEventListener.CacheEntryEvent; import org.sakaiproject.memory.api.CacheEventListener.EventType; import org.sakaiproject.memory.api.CacheStatistics; @@ -42,7 +42,7 @@ * @author Aaron Zeckoski (azeckoski @ unicon.net) (azeckoski @ gmail.com) */ public class EhcacheCache extends BasicCache implements CacheEventListener { - final Log log = LogFactory.getLog(BasicMapCache.class); + final Logger log = LoggerFactory.getLogger(BasicMapCache.class); /** * Underlying cache implementation diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/EhcacheMemoryService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/EhcacheMemoryService.java index 895e7f3b6753..da68c6a686ac 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/EhcacheMemoryService.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/EhcacheMemoryService.java @@ -26,8 +26,8 @@ import net.sf.ehcache.config.CacheConfiguration; import net.sf.ehcache.config.Configuration; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.SecurityService; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.component.cover.ComponentManager; @@ -52,7 +52,7 @@ */ public class EhcacheMemoryService implements MemoryService { - final Log log = LogFactory.getLog(EhcacheMemoryService.class); + final Logger log = LoggerFactory.getLogger(EhcacheMemoryService.class); CacheManager cacheManager; /** diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/HazelcastCache.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/HazelcastCache.java index 8a56061d5e33..3eb1223bba95 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/HazelcastCache.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/HazelcastCache.java @@ -22,8 +22,8 @@ package org.sakaiproject.memory.impl; import com.hazelcast.core.IMap; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.memory.api.CacheLoader; import org.sakaiproject.memory.api.CacheStatistics; @@ -37,7 +37,7 @@ * @author Aaron Zeckoski (azeckoski @ unicon.net) (azeckoski @ gmail.com) */ public class HazelcastCache extends BasicMapCache { - final Log log = LogFactory.getLog(HazelcastCache.class); + final Logger log = LoggerFactory.getLogger(HazelcastCache.class); private IMap cache; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/HazelcastMemoryService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/HazelcastMemoryService.java index 889d5daf3b2d..53ea7d2841c2 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/HazelcastMemoryService.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/HazelcastMemoryService.java @@ -30,8 +30,8 @@ import com.hazelcast.core.HazelcastInstance; import com.hazelcast.core.IMap; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.SecurityService; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.component.cover.ComponentManager; @@ -51,7 +51,7 @@ */ public class HazelcastMemoryService implements MemoryService { - final Log log = LogFactory.getLog(HazelcastMemoryService.class); + final Logger log = LoggerFactory.getLogger(HazelcastMemoryService.class); ServerConfigurationService serverConfigurationService; SecurityService securityService; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/SakaiCacheManagerFactoryBean.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/SakaiCacheManagerFactoryBean.java index cec43629cad5..067611de45c1 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/SakaiCacheManagerFactoryBean.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/memory/impl/SakaiCacheManagerFactoryBean.java @@ -26,8 +26,8 @@ import net.sf.ehcache.config.*; import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ServerConfigurationService; import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.FactoryBean; @@ -75,7 +75,7 @@ public class SakaiCacheManagerFactoryBean implements FactoryBean, private final static String DEFAULT_CACHE_SERVER_URL = "localhost:9510"; private final static int DEFAULT_CACHE_TIMEOUT = 600; // 10 mins private final static int DEFAULT_CACHE_MAX_OBJECTS = 10000; - protected final Log logger = LogFactory.getLog(getClass()); + protected final Logger logger = LoggerFactory.getLogger(getClass()); protected ServerConfigurationService serverConfigurationService; private Resource configLocation; private boolean shared = false; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/messagebundle/impl/CachingMessageBundleServiceImpl.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/messagebundle/impl/CachingMessageBundleServiceImpl.java index adab1d6b0057..afa76fffff31 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/messagebundle/impl/CachingMessageBundleServiceImpl.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/messagebundle/impl/CachingMessageBundleServiceImpl.java @@ -1,8 +1,8 @@ package org.sakaiproject.messagebundle.impl; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.memory.api.Cache; import org.sakaiproject.memory.api.MemoryService; import org.sakaiproject.messagebundle.api.MessageBundleProperty; @@ -24,7 +24,7 @@ * */ public class CachingMessageBundleServiceImpl extends MessageBundleServiceImpl { - private static Log LOG = LogFactory.getLog(CachingMessageBundleServiceImpl.class); + private static Logger LOG = LoggerFactory.getLogger(CachingMessageBundleServiceImpl.class); private static String CACHE_NAME = "org.sakaiproject.messagebundle.cache.bundles"; private MemoryService memoryService; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/messagebundle/impl/MessageBundleServiceImpl.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/messagebundle/impl/MessageBundleServiceImpl.java index 3f00c990958b..66e986c4d2ea 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/messagebundle/impl/MessageBundleServiceImpl.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/messagebundle/impl/MessageBundleServiceImpl.java @@ -21,8 +21,8 @@ package org.sakaiproject.messagebundle.impl; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.messagebundle.api.MessageBundleService; import org.sakaiproject.messagebundle.api.MessageBundleProperty; import org.hibernate.*; @@ -50,7 +50,7 @@ * To change this template use File | Settings | File Templates. */ public class MessageBundleServiceImpl extends HibernateDaoSupport implements MessageBundleService { - private static Log logger = LogFactory.getLog(MessageBundleServiceImpl.class); + private static Logger logger = LoggerFactory.getLogger(MessageBundleServiceImpl.class); /** * list of bundles that we've already indexed, only want to update once per startup diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/BaseGroup.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/BaseGroup.java index a845c5001411..add8d238b83b 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/BaseGroup.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/BaseGroup.java @@ -26,8 +26,8 @@ import java.util.Stack; import java.util.Iterator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroup; import org.sakaiproject.authz.api.GroupNotDefinedException; import org.sakaiproject.authz.api.Member; @@ -53,7 +53,7 @@ public class BaseGroup implements Group, Identifiable { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(BaseGroup.class); + private static Logger M_log = LoggerFactory.getLogger(BaseGroup.class); /** A fixed class serian number. */ private static final long serialVersionUID = 1L; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/BaseSite.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/BaseSite.java index 8ae0c7622cb2..0b0e544970f1 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/BaseSite.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/BaseSite.java @@ -34,8 +34,8 @@ import java.util.Vector; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroup; import org.sakaiproject.authz.api.AuthzGroupService; import org.sakaiproject.authz.api.GroupNotDefinedException; @@ -78,7 +78,7 @@ public class BaseSite implements Site { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(BaseSite.class); + private static Logger M_log = LoggerFactory.getLogger(BaseSite.class); /** A fixed class serian number. */ private static final long serialVersionUID = 1L; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/BaseSitePage.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/BaseSitePage.java index 66ca5dd5f212..2f0498ac8f2c 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/BaseSitePage.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/BaseSitePage.java @@ -24,8 +24,8 @@ import java.util.*; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.entity.api.ResourceProperties; import org.sakaiproject.entity.api.ResourcePropertiesEdit; import org.sakaiproject.site.api.Site; @@ -47,7 +47,7 @@ public class BaseSitePage implements SitePage, Identifiable { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(BaseSitePage.class); + private static Logger M_log = LoggerFactory.getLogger(BaseSitePage.class); /** A fixed class serian number. */ private static final long serialVersionUID = 1L; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/BaseSiteService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/BaseSiteService.java index bac90ea01083..862b1aa84d9c 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/BaseSiteService.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/BaseSiteService.java @@ -22,8 +22,8 @@ package org.sakaiproject.site.impl; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.*; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.entity.api.*; @@ -66,7 +66,7 @@ public abstract class BaseSiteService implements SiteService, Observer { /** Our logger. */ - private static Log M_log = LogFactory.getLog(BaseSiteService.class); + private static Logger M_log = LoggerFactory.getLogger(BaseSiteService.class); /** diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/BaseToolConfiguration.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/BaseToolConfiguration.java index d2a045e37b62..cd16a0de861e 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/BaseToolConfiguration.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/BaseToolConfiguration.java @@ -27,8 +27,8 @@ import java.util.Stack; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.site.api.SitePage; import org.sakaiproject.site.api.SiteService; import org.sakaiproject.site.api.ToolConfiguration; @@ -50,7 +50,7 @@ public class BaseToolConfiguration extends org.sakaiproject.util.Placement imple ToolConfiguration, Identifiable { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(BaseToolConfiguration.class); + private static Logger M_log = LoggerFactory.getLogger(BaseToolConfiguration.class); /** A fixed class serial number. */ private static final long serialVersionUID = 1L; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/DbSiteService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/DbSiteService.java index c75fe0fded00..a6e55cb3d4c5 100755 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/DbSiteService.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/DbSiteService.java @@ -34,8 +34,8 @@ import java.util.Properties; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.db.api.SqlReader; import org.sakaiproject.db.api.SqlReaderFinishedException; import org.sakaiproject.db.api.SqlService; @@ -58,7 +58,7 @@ public abstract class DbSiteService extends BaseSiteService { /** Our logger. */ - private static Log M_log = LogFactory.getLog(DbSiteService.class); + private static Logger M_log = LoggerFactory.getLogger(DbSiteService.class); /** Table name for sites. */ protected String m_siteTableName = "SAKAI_SITE"; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/JoinSiteDelegate.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/JoinSiteDelegate.java index d8f560284cf9..133f28ef6293 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/JoinSiteDelegate.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/JoinSiteDelegate.java @@ -7,8 +7,8 @@ import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.SecurityAdvisor; import org.sakaiproject.authz.api.SecurityService; @@ -34,7 +34,7 @@ public class JoinSiteDelegate private UserDirectoryService userDirectoryService; // class members - private static Log log = LogFactory.getLog(JoinSiteDelegate.class); + private static Logger log = LoggerFactory.getLogger(JoinSiteDelegate.class); private static final String COMMA_DELIMITER = ","; // Comma delimiter (for csv parsing) private static final String JOINSITE_GROUP_NO_SELECTION = "noSelection"; // The value of the joiner group site private static final String SAK_PERM_SITE_UPD = "site.upd"; // The name of the site update permission diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/SiteAliasCleanupNotificationAction.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/SiteAliasCleanupNotificationAction.java index 441e0895a9a9..354fb725a23a 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/SiteAliasCleanupNotificationAction.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/SiteAliasCleanupNotificationAction.java @@ -21,8 +21,8 @@ package org.sakaiproject.site.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.alias.api.AliasService; import org.sakaiproject.event.api.Event; import org.sakaiproject.event.api.Notification; @@ -42,7 +42,7 @@ */ public class SiteAliasCleanupNotificationAction implements NotificationAction { - private static Log log = LogFactory.getLog(SiteAliasCleanupNotificationAction.class); + private static Logger log = LoggerFactory.getLogger(SiteAliasCleanupNotificationAction.class); private AliasService aliasService; private NotificationService notificationService; private boolean enabled = true; @@ -183,4 +183,4 @@ public NotificationService getNotificationService() { return notificationService; } -} \ No newline at end of file +} diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/SiteCacheImpl.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/SiteCacheImpl.java index 3f557b365d75..d5d2e4374b83 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/SiteCacheImpl.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/SiteCacheImpl.java @@ -25,8 +25,8 @@ import net.sf.ehcache.Ehcache; import net.sf.ehcache.Element; import net.sf.ehcache.event.CacheEventListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.memory.api.Cache; import org.sakaiproject.memory.api.MemoryService; @@ -48,7 +48,7 @@ */ public class SiteCacheImpl implements CacheEventListener, SiteCache { - private static Log M_log = LogFactory.getLog(SiteCacheImpl.class); + private static Logger M_log = LoggerFactory.getLogger(SiteCacheImpl.class); /** Map of a tool id to a cached site's tool configuration instance. */ protected Map m_tools = new ConcurrentHashMap(); /** Map of a page id to a cached site's SitePage instance. */ diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/SiteCacheSafe.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/SiteCacheSafe.java index ac801095047b..d24c6506aa21 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/SiteCacheSafe.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/SiteCacheSafe.java @@ -21,8 +21,8 @@ package org.sakaiproject.site.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.event.api.Event; import org.sakaiproject.event.api.EventTrackingService; import org.sakaiproject.memory.api.*; @@ -46,7 +46,7 @@ */ public class SiteCacheSafe extends BasicCache implements SiteCache, CacheEventListener { - private static Log M_log = LogFactory.getLog(SiteCacheSafe.class); + private static Logger M_log = LoggerFactory.getLogger(SiteCacheSafe.class); private static final String CACHE_PREFIX = "org.sakaiproject.site.impl.SiteCacheImpl."; private static final String MAIN_CACHE_NAME = CACHE_PREFIX+"cache"; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/thread_local/impl/ThreadLocalComponent.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/thread_local/impl/ThreadLocalComponent.java index aa5f9c75f32b..c3d0b31dff7a 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/thread_local/impl/ThreadLocalComponent.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/thread_local/impl/ThreadLocalComponent.java @@ -24,8 +24,8 @@ import java.util.HashMap; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.thread_local.api.ThreadBound; import org.sakaiproject.thread_local.api.ThreadLocalManager; @@ -40,7 +40,7 @@ public class ThreadLocalComponent implements ThreadLocalManager { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(ThreadLocalComponent.class); + private static Logger M_log = LoggerFactory.getLogger(ThreadLocalComponent.class); /** *

diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/time/impl/BasicTimeService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/time/impl/BasicTimeService.java index 9ef856d3afd1..40fa52d8e637 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/time/impl/BasicTimeService.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/time/impl/BasicTimeService.java @@ -29,8 +29,8 @@ import java.util.StringTokenizer; import java.util.TimeZone; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.entity.api.ResourceProperties; import org.sakaiproject.memory.api.Cache; import org.sakaiproject.memory.api.MemoryService; @@ -51,7 +51,7 @@ public class BasicTimeService implements TimeService { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(TimeService.class); + private static Logger M_log = LoggerFactory.getLogger(TimeService.class); /** The time zone for our GMT times. */ protected TimeZone M_tz = null; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/tool/impl/ActiveToolComponent.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/tool/impl/ActiveToolComponent.java index 2bff776b8bb0..6176e88e42a6 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/tool/impl/ActiveToolComponent.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/tool/impl/ActiveToolComponent.java @@ -44,8 +44,8 @@ import javax.servlet.http.HttpServletResponseWrapper; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.FunctionManager; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.tool.api.ActiveTool; @@ -69,7 +69,7 @@ public abstract class ActiveToolComponent extends ToolComponent implements ActiveToolManager { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(ActiveToolComponent.class); + private static Logger M_log = LoggerFactory.getLogger(ActiveToolComponent.class); public static final String TOOL_PORTLET_CONTEXT_PATH = "portlet-context"; static final String TOOL_CATEGORIES_PREFIX = "tool.categories."; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/tool/impl/RebuildBreakdownServiceImpl.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/tool/impl/RebuildBreakdownServiceImpl.java index 98236e279fc2..b0add1b4813d 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/tool/impl/RebuildBreakdownServiceImpl.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/tool/impl/RebuildBreakdownServiceImpl.java @@ -22,8 +22,8 @@ import com.google.common.collect.MapMaker; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.azeckoski.reflectutils.ConstructorUtils; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.event.api.UsageSession; @@ -66,7 +66,7 @@ public class RebuildBreakdownServiceImpl implements RebuildBreakdownService { final static String SESSION_LAST_BREAKDOWN_KEY = SPECIAL_SESSION_KEY_PREFIX+"LastBreakdownTime"; final static String SESSION_LAST_REBUILD_KEY = SPECIAL_SESSION_KEY_PREFIX+"LastRebuildTime"; - private static final Log log = LogFactory.getLog(RebuildBreakdownServiceImpl.class); + private static final Logger log = LoggerFactory.getLogger(RebuildBreakdownServiceImpl.class); private final int minSecondsBetweenStoresDefault = 10; private final int minSecondsAfterRebuildDefault = 30; private final int smallestMinSecondsBetweenStores = 1; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/tool/impl/ToolComponent.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/tool/impl/ToolComponent.java index 765b3e7c2886..7dcae3ba12f5 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/tool/impl/ToolComponent.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/tool/impl/ToolComponent.java @@ -37,8 +37,8 @@ import java.util.concurrent.ConcurrentHashMap; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.SecurityService; import org.sakaiproject.site.api.Site; import org.sakaiproject.site.api.ToolConfiguration; @@ -64,7 +64,7 @@ public abstract class ToolComponent implements ToolManager { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(ToolComponent.class); + private static Logger M_log = LoggerFactory.getLogger(ToolComponent.class); /** Key in the ThreadLocalManager for binding our current placement. */ protected final static String CURRENT_PLACEMENT = "sakai:ToolComponent:current.placement"; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/tool/impl/ToolImpl.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/tool/impl/ToolImpl.java index bf17d3d9fa50..896285b45bfd 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/tool/impl/ToolImpl.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/tool/impl/ToolImpl.java @@ -27,8 +27,8 @@ import java.util.Properties; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.api.ActiveToolManager; import org.sakaiproject.tool.api.Tool; import org.sakaiproject.tool.api.ToolManager; @@ -42,7 +42,7 @@ public class ToolImpl implements Tool, Comparable { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(ToolImpl.class); + private static Logger M_log = LoggerFactory.getLogger(ToolImpl.class); /** The access security. */ protected Tool.AccessSecurity m_accessSecurity = Tool.AccessSecurity.PORTAL; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/AuthenticationCache.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/AuthenticationCache.java index 20d76ed6c2f3..e85f70f423ea 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/AuthenticationCache.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/AuthenticationCache.java @@ -19,8 +19,8 @@ package org.sakaiproject.user.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.memory.api.Cache; import org.sakaiproject.memory.api.MemoryService; import org.sakaiproject.user.api.Authentication; @@ -49,7 +49,7 @@ * @author Aaron Zeckoski (aaron@caret.cam.ac.uk) */ public class AuthenticationCache { - private static final Log log = LogFactory.getLog(AuthenticationCache.class); + private static final Logger log = LoggerFactory.getLogger(AuthenticationCache.class); private MemoryService memoryService; private Cache authCache = null; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/AuthnCacheWatcher.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/AuthnCacheWatcher.java index 3b86ffa4a519..67767934240a 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/AuthnCacheWatcher.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/AuthnCacheWatcher.java @@ -21,8 +21,8 @@ package org.sakaiproject.user.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.entity.api.EntityManager; import org.sakaiproject.entity.api.Reference; @@ -44,7 +44,7 @@ */ public class AuthnCacheWatcher implements Observer { - private static final Log log = LogFactory.getLog(AuthnCacheWatcher.class); + private static final Logger log = LoggerFactory.getLogger(AuthnCacheWatcher.class); //Copied from DbUserService as they are private private static final String EIDCACHE = "eid:"; private static final String IDCACHE = "id:"; @@ -125,7 +125,7 @@ public void update(Observable arg0, Object arg) { userCache.remove(IDCACHE + refId); } catch (UserNotDefinedException e) { //not sure how we'd end up here - log.warn(e); + log.warn(e.getMessage(), e); } } diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/BasePreferencesService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/BasePreferencesService.java index 37117f88299c..0ad092fce848 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/BasePreferencesService.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/BasePreferencesService.java @@ -21,8 +21,8 @@ package org.sakaiproject.user.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.FunctionManager; import org.sakaiproject.authz.api.SecurityService; import org.sakaiproject.component.api.ServerConfigurationService; @@ -68,7 +68,7 @@ public abstract class BasePreferencesService implements PreferencesService, Sing */ private static final String LOCALE_PREFERENCE_KEY = "sakai:resourceloader"; /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(BasePreferencesService.class); + private static Logger M_log = LoggerFactory.getLogger(BasePreferencesService.class); /** Storage manager for this service. */ protected Storage m_storage = null; /** The initial portion of a relative access point URL. */ diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/BaseUserDirectoryService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/BaseUserDirectoryService.java index 99b4f782fb30..e9033ec69769 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/BaseUserDirectoryService.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/BaseUserDirectoryService.java @@ -23,8 +23,8 @@ package org.sakaiproject.user.impl; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.*; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.component.cover.ComponentManager; @@ -66,7 +66,7 @@ public abstract class BaseUserDirectoryService implements UserDirectoryService, UserFactory { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(BaseUserDirectoryService.class); + private static Logger M_log = LoggerFactory.getLogger(BaseUserDirectoryService.class); /** Storage manager for this service. */ protected Storage m_storage = null; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/DbPreferencesService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/DbPreferencesService.java index 10b10bdbcb14..eae2d1a5a45b 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/DbPreferencesService.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/DbPreferencesService.java @@ -21,8 +21,8 @@ package org.sakaiproject.user.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.db.api.SqlService; import org.sakaiproject.user.api.Preferences; import org.sakaiproject.user.api.PreferencesEdit; @@ -37,7 +37,7 @@ public abstract class DbPreferencesService extends BasePreferencesService { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(DbPreferencesService.class); + private static Logger M_log = LoggerFactory.getLogger(DbPreferencesService.class); /** Table name for realms. */ protected String m_tableName = "SAKAI_PREFERENCES"; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/DbUserService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/DbUserService.java index f9a94db6b439..936dd343b9ec 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/DbUserService.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/DbUserService.java @@ -22,8 +22,8 @@ package org.sakaiproject.user.impl; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.db.api.SqlReader; import org.sakaiproject.db.api.SqlReaderFinishedException; import org.sakaiproject.db.api.SqlService; @@ -47,7 +47,7 @@ public abstract class DbUserService extends BaseUserDirectoryService { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(DbUserService.class); + private static Logger M_log = LoggerFactory.getLogger(DbUserService.class); /** Table name for users. */ protected String m_tableName = "SAKAI_USER"; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/OpenAuthnComponent.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/OpenAuthnComponent.java index 24a48020061f..195a5caf9d1d 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/OpenAuthnComponent.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/OpenAuthnComponent.java @@ -21,8 +21,8 @@ package org.sakaiproject.user.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.user.api.Authentication; import org.sakaiproject.user.api.AuthenticationException; import org.sakaiproject.user.api.AuthenticationManager; @@ -39,7 +39,7 @@ public class OpenAuthnComponent implements AuthenticationManager { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(OpenAuthnComponent.class); + private static Logger M_log = LoggerFactory.getLogger(OpenAuthnComponent.class); /********************************************************************************************************************************************************************************************************************************************************** * Dependencies and their setter methods diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/PasswordPolicyProviderDefaultImpl.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/PasswordPolicyProviderDefaultImpl.java index 1b5b10d01935..7bffe02a71da 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/PasswordPolicyProviderDefaultImpl.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/PasswordPolicyProviderDefaultImpl.java @@ -23,8 +23,8 @@ import java.util.Arrays; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.user.api.PasswordPolicyProvider; @@ -39,7 +39,7 @@ public class PasswordPolicyProviderDefaultImpl implements PasswordPolicyProvider { /** Our log (commons). */ - private static Log logger = LogFactory.getLog(PasswordPolicyProviderDefaultImpl.class); + private static Logger logger = LoggerFactory.getLogger(PasswordPolicyProviderDefaultImpl.class); /** value for minimum password entropy */ private static final int DEFAULT_MIN_ENTROPY = 16; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/PasswordService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/PasswordService.java index bbae718e0ae0..32dba1d02f1b 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/PasswordService.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/PasswordService.java @@ -28,8 +28,8 @@ import javax.mail.internet.MimeUtility; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** @@ -40,7 +40,7 @@ */ public class PasswordService { - private final static Log log = LogFactory.getLog(PasswordService.class); + private final static Logger log = LoggerFactory.getLogger(PasswordService.class); private Random saltSource = new Random(); diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/PrecachingDbUserService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/PrecachingDbUserService.java index 37926a11a9b3..2958ea5be8fb 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/PrecachingDbUserService.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/PrecachingDbUserService.java @@ -21,8 +21,8 @@ package org.sakaiproject.user.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; @@ -54,7 +54,7 @@ */ public abstract class PrecachingDbUserService extends DbUserService { - private static Log log = LogFactory.getLog(PrecachingDbUserService.class); + private static Logger log = LoggerFactory.getLogger(PrecachingDbUserService.class); boolean logUsersRemoved = false; boolean logUsersNotRemoved = false; diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/UserAuthnComponent.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/UserAuthnComponent.java index 980efc152b93..038332d95ed7 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/UserAuthnComponent.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/user/impl/UserAuthnComponent.java @@ -21,8 +21,8 @@ package org.sakaiproject.user.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.user.api.Authentication; import org.sakaiproject.user.api.AuthenticationException; import org.sakaiproject.user.api.AuthenticationManager; @@ -43,7 +43,7 @@ public abstract class UserAuthnComponent implements AuthenticationManager { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(UserAuthnComponent.class); + private static Logger M_log = LoggerFactory.getLogger(UserAuthnComponent.class); /********************************************************************************************************************************************************************************************************************************************************** * Dependencies diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/util/impl/FormattedTextImpl.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/util/impl/FormattedTextImpl.java index 080104368334..1ea902ce703a 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/util/impl/FormattedTextImpl.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/util/impl/FormattedTextImpl.java @@ -32,8 +32,8 @@ import java.text.DecimalFormat; import org.apache.commons.lang.StringEscapeUtils; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.validator.routines.UrlValidator; import org.w3c.dom.Element; @@ -56,7 +56,7 @@ public class FormattedTextImpl implements FormattedText { /** Our log (commons). */ - private static final Log M_log = LogFactory.getLog(FormattedTextImpl.class); + private static final Logger M_log = LoggerFactory.getLogger(FormattedTextImpl.class); private ServerConfigurationService serverConfigurationService = null; public void setServerConfigurationService(ServerConfigurationService serverConfigurationService) { @@ -406,7 +406,7 @@ public String processFormattedText(final String strFromBrowser, StringBuilder er } } if (logErrors && M_log.isInfoEnabled()) { - // KNL-1075 - Log errors if desired so they can be easily found + // KNL-1075 - Logger errors if desired so they can be easily found String user = "UNKNOWN"; try { user = sessionManager.getCurrentSession().getUserEid(); diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/util/impl/LinkMigrationHelperImpl.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/util/impl/LinkMigrationHelperImpl.java index 224489567868..03d8c787bc62 100644 --- a/kernel/kernel-impl/src/main/java/org/sakaiproject/util/impl/LinkMigrationHelperImpl.java +++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/util/impl/LinkMigrationHelperImpl.java @@ -6,15 +6,15 @@ import java.util.Vector; import java.util.Map.Entry; import org.sakaiproject.component.api.ServerConfigurationService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.util.api.LinkMigrationHelper; public class LinkMigrationHelperImpl implements LinkMigrationHelper { - private static final Log LOG = LogFactory.getLog(LinkMigrationHelperImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(LinkMigrationHelperImpl.class); private static final String ESCAPED_SPACE= "%"+"20"; private ServerConfigurationService serverConfigurationService; diff --git a/kernel/kernel-impl/src/test/java/org/sakaiproject/authz/impl/DummyUserEncodingTest.java b/kernel/kernel-impl/src/test/java/org/sakaiproject/authz/impl/DummyUserEncodingTest.java index f9e846cea361..28f8f13fff8b 100644 --- a/kernel/kernel-impl/src/test/java/org/sakaiproject/authz/impl/DummyUserEncodingTest.java +++ b/kernel/kernel-impl/src/test/java/org/sakaiproject/authz/impl/DummyUserEncodingTest.java @@ -1,7 +1,7 @@ package org.sakaiproject.authz.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; @@ -10,7 +10,7 @@ import org.sakaiproject.test.SakaiKernelTestBase; public class DummyUserEncodingTest extends SakaiKernelTestBase { - private static Log log = LogFactory.getLog(DummyUserEncodingTest.class); + private static Logger log = LoggerFactory.getLogger(DummyUserEncodingTest.class); protected AuthzGroupService _ags; protected String _secretPrefix; @@ -21,7 +21,7 @@ public static void beforeClass() { oneTimeSetup(); log.debug("finished oneTimeSetup"); } catch (Exception e) { - log.warn(e); + log.warn(e.getMessage(), e); } } diff --git a/kernel/kernel-impl/src/test/java/org/sakaiproject/authz/impl/RoleProviderTest.java b/kernel/kernel-impl/src/test/java/org/sakaiproject/authz/impl/RoleProviderTest.java index 51ff0088c977..0c774156a834 100644 --- a/kernel/kernel-impl/src/test/java/org/sakaiproject/authz/impl/RoleProviderTest.java +++ b/kernel/kernel-impl/src/test/java/org/sakaiproject/authz/impl/RoleProviderTest.java @@ -4,8 +4,8 @@ import java.util.Collections; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; @@ -21,7 +21,7 @@ import org.sakaiproject.user.api.UserEdit; public class RoleProviderTest extends SakaiKernelTestBase { - private static Log log = LogFactory.getLog(RoleProviderTest.class); + private static Logger log = LoggerFactory.getLogger(RoleProviderTest.class); @BeforeClass public static void beforeClass() { @@ -30,7 +30,7 @@ public static void beforeClass() { oneTimeSetup(); log.debug("finished oneTimeSetup"); } catch (Exception e) { - log.warn(e); + log.warn(e.getMessage(), e); } } diff --git a/kernel/kernel-impl/src/test/java/org/sakaiproject/component/impl/BasicConfigurationServiceTest.java b/kernel/kernel-impl/src/test/java/org/sakaiproject/component/impl/BasicConfigurationServiceTest.java index 092439867ed7..f6357e8ce9f0 100644 --- a/kernel/kernel-impl/src/test/java/org/sakaiproject/component/impl/BasicConfigurationServiceTest.java +++ b/kernel/kernel-impl/src/test/java/org/sakaiproject/component/impl/BasicConfigurationServiceTest.java @@ -28,8 +28,8 @@ import java.util.Locale; import org.apache.commons.lang.ArrayUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -42,7 +42,7 @@ */ public class BasicConfigurationServiceTest { - private static Log log = LogFactory.getLog(BasicConfigurationServiceTest.class); + private static Logger log = LoggerFactory.getLogger(BasicConfigurationServiceTest.class); private BasicConfigurationService basicConfigurationService; private String SOURCE = "TEST"; @@ -65,7 +65,7 @@ public void setUp() throws Exception { basicConfigurationService.addConfigItem( new ConfigItemImpl("test7", "${AZ}"), SOURCE); basicConfigurationService.addConfigItem( new ConfigItemImpl("intVal", 11), SOURCE); basicConfigurationService.addConfigItem( new ConfigItemImpl("booleanVal", true), SOURCE); - log.info(basicConfigurationService.getConfigData()); + log.info(basicConfigurationService.getConfigData().toString()); } @Test diff --git a/kernel/kernel-impl/src/test/java/org/sakaiproject/component/test/ConfigurationLoadingTest.java b/kernel/kernel-impl/src/test/java/org/sakaiproject/component/test/ConfigurationLoadingTest.java index 61b57bb97998..09d00353e10b 100644 --- a/kernel/kernel-impl/src/test/java/org/sakaiproject/component/test/ConfigurationLoadingTest.java +++ b/kernel/kernel-impl/src/test/java/org/sakaiproject/component/test/ConfigurationLoadingTest.java @@ -26,8 +26,8 @@ import java.util.Arrays; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; @@ -39,7 +39,7 @@ * */ public class ConfigurationLoadingTest extends SakaiKernelTestBase { - private static Log log = LogFactory.getLog(ConfigurationLoadingTest.class); + private static Logger log = LoggerFactory.getLogger(ConfigurationLoadingTest.class); private ServerConfigurationService serverConfigurationService; @@ -50,7 +50,7 @@ public static void beforeClass() { try { oneTimeSetup("filesystem", CONFIG); } catch (Exception e) { - log.warn(e); + log.warn(e.getMessage(), e); } } diff --git a/kernel/kernel-impl/src/test/java/org/sakaiproject/component/test/DynamicConfigurationTest.java b/kernel/kernel-impl/src/test/java/org/sakaiproject/component/test/DynamicConfigurationTest.java index 30f2701996b8..2c76d0f783e0 100644 --- a/kernel/kernel-impl/src/test/java/org/sakaiproject/component/test/DynamicConfigurationTest.java +++ b/kernel/kernel-impl/src/test/java/org/sakaiproject/component/test/DynamicConfigurationTest.java @@ -22,8 +22,8 @@ package org.sakaiproject.component.test; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; @@ -35,7 +35,7 @@ * */ public class DynamicConfigurationTest extends SakaiKernelTestBase { - private static Log log = LogFactory.getLog(DynamicConfigurationTest.class); + private static Logger log = LoggerFactory.getLogger(DynamicConfigurationTest.class); private ServerConfigurationService serverConfigurationService; @@ -48,7 +48,7 @@ public static void beforeClass() { oneTimeSetup("dynamic", CONFIG); log.debug("finished oneTimeSetup"); } catch (Exception e) { - log.warn(e); + log.warn(e.getMessage(), e); } } diff --git a/kernel/kernel-impl/src/test/java/org/sakaiproject/component/test/dynamic/DbPropertiesDao.java b/kernel/kernel-impl/src/test/java/org/sakaiproject/component/test/dynamic/DbPropertiesDao.java index 2ecff3d2510d..e5c610ade12a 100644 --- a/kernel/kernel-impl/src/test/java/org/sakaiproject/component/test/dynamic/DbPropertiesDao.java +++ b/kernel/kernel-impl/src/test/java/org/sakaiproject/component/test/dynamic/DbPropertiesDao.java @@ -28,8 +28,8 @@ import javax.sql.DataSource; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.jdbc.BadSqlGrammarException; import org.springframework.jdbc.core.simple.SimpleJdbcTemplate; import org.springframework.transaction.annotation.Transactional; @@ -39,7 +39,7 @@ */ @Transactional public class DbPropertiesDao { - private static Log log = LogFactory.getLog(DbPropertiesDao.class); + private static Logger log = LoggerFactory.getLogger(DbPropertiesDao.class); private SimpleJdbcTemplate simpleJdbcTemplate; private boolean autoDdl; private Map initialDbProperties; diff --git a/kernel/kernel-impl/src/test/java/org/sakaiproject/config/test/StoredConfigServiceTest.java b/kernel/kernel-impl/src/test/java/org/sakaiproject/config/test/StoredConfigServiceTest.java index 30691afda751..4d794b926e2b 100644 --- a/kernel/kernel-impl/src/test/java/org/sakaiproject/config/test/StoredConfigServiceTest.java +++ b/kernel/kernel-impl/src/test/java/org/sakaiproject/config/test/StoredConfigServiceTest.java @@ -21,8 +21,8 @@ package org.sakaiproject.config.test; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; @@ -47,7 +47,7 @@ * Created on April 18, 2013 */ public class StoredConfigServiceTest extends SakaiKernelTestBase { - private static final Log LOG = LogFactory.getLog(StoredConfigServiceTest.class); + private static final Logger LOG = LoggerFactory.getLogger(StoredConfigServiceTest.class); private static BasicConfigurationService basicConfigurationService; private static StoredConfigService storedConfigService; @@ -61,7 +61,7 @@ public static void beforeClass() { oneTimeSetupAfter(); LOG.debug("finished oneTimeSetup"); } catch (Exception e) { - LOG.warn(e); + LOG.warn(e.getMessage(), e); } } diff --git a/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/db/test/CheckBlobSafety.java b/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/db/test/CheckBlobSafety.java index 0177ebb231e6..416dd24e0a9e 100644 --- a/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/db/test/CheckBlobSafety.java +++ b/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/db/test/CheckBlobSafety.java @@ -37,8 +37,8 @@ import org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS; import org.apache.commons.dbcp.datasources.SharedPoolDataSource; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -50,7 +50,7 @@ public class CheckBlobSafety { - private static final Log log = LogFactory.getLog(CheckBlobSafety.class); + private static final Logger log = LoggerFactory.getLogger(CheckBlobSafety.class); private SharedPoolDataSource tds; diff --git a/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/serialize/impl/test/ByteStorageConversionCheck.java b/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/serialize/impl/test/ByteStorageConversionCheck.java index c89fd521bc36..da79d525bcf7 100644 --- a/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/serialize/impl/test/ByteStorageConversionCheck.java +++ b/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/serialize/impl/test/ByteStorageConversionCheck.java @@ -23,8 +23,8 @@ import java.util.Random; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.Assert; import org.junit.Test; import org.sakaiproject.util.ByteStorageConversion; @@ -36,7 +36,7 @@ public class ByteStorageConversionCheck { - private static final Log log = LogFactory.getLog(ByteStorageConversionCheck.class); + private static final Logger log = LoggerFactory.getLogger(ByteStorageConversionCheck.class); @Test public void test256Conversion() { diff --git a/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/serialize/impl/test/GMTDateformatterTest.java b/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/serialize/impl/test/GMTDateformatterTest.java index 3001124b8b08..ee4e036f2349 100644 --- a/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/serialize/impl/test/GMTDateformatterTest.java +++ b/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/serialize/impl/test/GMTDateformatterTest.java @@ -26,15 +26,15 @@ import java.util.GregorianCalendar; import java.util.TimeZone; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.Assert; import org.junit.Test; import org.sakaiproject.content.impl.util.GMTDateformatter; public class GMTDateformatterTest { - private static final Log log = LogFactory.getLog(GMTDateformatterTest.class); + private static final Logger log = LoggerFactory.getLogger(GMTDateformatterTest.class); @Test public void testPad() diff --git a/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/serialize/impl/test/MySQLByteStorage.java b/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/serialize/impl/test/MySQLByteStorage.java index f93c92759ff7..bdb93faed815 100644 --- a/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/serialize/impl/test/MySQLByteStorage.java +++ b/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/serialize/impl/test/MySQLByteStorage.java @@ -33,8 +33,8 @@ import org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS; import org.apache.commons.dbcp.datasources.SharedPoolDataSource; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -43,7 +43,7 @@ public class MySQLByteStorage { - private static final Log log = LogFactory.getLog(MySQLByteStorage.class); + private static final Logger log = LoggerFactory.getLogger(MySQLByteStorage.class); private SharedPoolDataSource tds; diff --git a/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/serialize/impl/test/ProfileSerializerTest.java b/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/serialize/impl/test/ProfileSerializerTest.java index ca007e681dc6..940d0ea9508f 100644 --- a/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/serialize/impl/test/ProfileSerializerTest.java +++ b/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/serialize/impl/test/ProfileSerializerTest.java @@ -21,14 +21,14 @@ package org.sakaiproject.content.impl.serialize.impl.test; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.Test; import org.sakaiproject.content.impl.serialize.impl.Type1BaseContentCollectionSerializer; public class ProfileSerializerTest { - private static final Log log = LogFactory.getLog(ProfileSerializerTest.class); + private static final Logger log = LoggerFactory.getLogger(ProfileSerializerTest.class); /** * Test method for diff --git a/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/ContentHostingServiceRecycleTest.java b/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/ContentHostingServiceRecycleTest.java index da121fa6c96d..5c958e62542a 100644 --- a/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/ContentHostingServiceRecycleTest.java +++ b/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/ContentHostingServiceRecycleTest.java @@ -6,8 +6,8 @@ import java.util.Properties; import java.util.UUID; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; @@ -26,7 +26,7 @@ * Test for deleting files. */ public class ContentHostingServiceRecycleTest extends SakaiKernelTestBase { - private static Log log = LogFactory.getLog(ContentHostingServiceRecycleTest.class); + private static Logger log = LoggerFactory.getLogger(ContentHostingServiceRecycleTest.class); @BeforeClass public static void beforeClass() { @@ -39,7 +39,7 @@ public static void beforeClass() { Files.createTempDirectory(FileSystems.getDefault().getPath(System.getProperty("java.io.tmpdir")), "deleted").toString()); oneTimeSetup(null, null, properties); } catch (Exception e) { - log.warn(e); + log.warn(e.getMessage(), e); } } diff --git a/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/ContentHostingServiceTest.java b/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/ContentHostingServiceTest.java index fd40ed998b7a..920a2943b82d 100644 --- a/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/ContentHostingServiceTest.java +++ b/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/ContentHostingServiceTest.java @@ -8,8 +8,8 @@ import java.util.Arrays; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.FixMethodOrder; @@ -36,7 +36,7 @@ public class ContentHostingServiceTest extends SakaiKernelTestBase { private static final String SIMPLE_FOLDER1 = "/admin/folder1/"; - private static final Log log = LogFactory.getLog(ContentHostingServiceTest.class); + private static final Logger log = LoggerFactory.getLogger(ContentHostingServiceTest.class); @BeforeClass public static void beforeClass() { @@ -45,7 +45,7 @@ public static void beforeClass() { oneTimeSetup(); log.debug("finished oneTimeSetup"); } catch (Exception e) { - log.warn(e); + log.warn(e.getMessage(), e); } } diff --git a/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/ContentIntegrationTestDisabled.java b/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/ContentIntegrationTestDisabled.java index a0d05e0f9bc7..d3c8e9f06821 100644 --- a/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/ContentIntegrationTestDisabled.java +++ b/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/ContentIntegrationTestDisabled.java @@ -2,8 +2,8 @@ import java.nio.ByteBuffer; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.After; import org.junit.Before; import org.junit.BeforeClass; @@ -15,7 +15,7 @@ public class ContentIntegrationTestDisabled extends SakaiKernelTestBase { - private static final Log log = LogFactory.getLog(ContentIntegrationTestDisabled.class); + private static final Logger log = LoggerFactory.getLogger(ContentIntegrationTestDisabled.class); private AuthzGroupService authzGroupService; private SiteService siteService; @@ -37,7 +37,7 @@ public static void beforeClass() { oneTimeSetup(); log.debug("finished oneTimeSetup"); } catch (Exception e) { - log.warn(e); + log.warn(e.getMessage(), e); } } diff --git a/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/MockContentCollection.java b/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/MockContentCollection.java index d271cb16e665..fb78de83e742 100644 --- a/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/MockContentCollection.java +++ b/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/MockContentCollection.java @@ -24,8 +24,8 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.content.api.ContentCollectionEdit; /** @@ -34,7 +34,7 @@ */ public class MockContentCollection extends MockContentEntity implements ContentCollectionEdit { - private static final Log logger = LogFactory.getLog(MockContentCollection.class); + private static final Logger logger = LoggerFactory.getLogger(MockContentCollection.class); /** * @param collectionId diff --git a/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/MockContentEntity.java b/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/MockContentEntity.java index f595d86109f7..9289ffdc804b 100644 --- a/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/MockContentEntity.java +++ b/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/MockContentEntity.java @@ -23,8 +23,8 @@ import java.util.*; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.content.api.ContentCollection; import org.sakaiproject.content.api.ContentEntity; import org.sakaiproject.content.api.ContentHostingHandler; @@ -48,7 +48,7 @@ */ public class MockContentEntity implements ContentEntity, GroupAwareEdit { - private static final Log logger = LogFactory.getLog(MockContentEntity.class); + private static final Logger logger = LoggerFactory.getLogger(MockContentEntity.class); protected String entityId; protected String containingCollectionId; diff --git a/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/MockContentResource.java b/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/MockContentResource.java index 621d1daf6c1b..49c16329c9eb 100644 --- a/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/MockContentResource.java +++ b/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/MockContentResource.java @@ -26,8 +26,8 @@ import java.io.IOException; import java.io.InputStream; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.content.api.ContentResourceEdit; import org.sakaiproject.entity.api.ResourceProperties; import org.sakaiproject.entity.api.ResourcePropertiesEdit; @@ -41,7 +41,7 @@ public class MockContentResource extends MockContentEntity implements ContentRes { public static final int STREAM_BUFFER_SIZE = 4096; - private static final Log logger = LogFactory.getLog(MockContentResource.class); + private static final Logger logger = LoggerFactory.getLogger(MockContentResource.class); protected String collectionId; diff --git a/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/RoleAccessTest.java b/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/RoleAccessTest.java index c587bce77f38..dfceaa0750a4 100644 --- a/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/RoleAccessTest.java +++ b/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/RoleAccessTest.java @@ -2,8 +2,8 @@ import junit.extensions.TestSetup; import junit.framework.TestSuite; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.*; import org.sakaiproject.authz.api.AuthzGroupService; import org.sakaiproject.authz.api.AuthzPermissionException; @@ -26,7 +26,7 @@ public class RoleAccessTest extends SakaiKernelTestBase { - private static final Log log = LogFactory.getLog(RoleAccessTest.class); + private static final Logger log = LoggerFactory.getLogger(RoleAccessTest.class); protected static final String SITE_ID = "site-id"; protected static final String IMAGES_COLLECTION = String.format("/group/%s/images/", SITE_ID); diff --git a/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/RoleViewTest.java b/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/RoleViewTest.java index 18869f909b02..38b50700a9e7 100644 --- a/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/RoleViewTest.java +++ b/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/RoleViewTest.java @@ -1,7 +1,7 @@ package org.sakaiproject.content.impl.test; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.*; import org.sakaiproject.authz.api.*; import org.sakaiproject.content.api.ContentCollectionEdit; @@ -17,7 +17,7 @@ @FixMethodOrder(NAME_ASCENDING) public class RoleViewTest extends SakaiKernelTestBase { - private static final Log log = LogFactory.getLog(RoleViewTest.class); + private static final Logger log = LoggerFactory.getLogger(RoleViewTest.class); protected static final String PHOTOS_COLLECTION = "/private/images/photos/"; protected static final String TEST_ROLE = "com.roles.test"; diff --git a/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/VirusScannerTest.java b/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/VirusScannerTest.java index b3484163f9fb..efa5af07652d 100644 --- a/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/VirusScannerTest.java +++ b/kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/test/VirusScannerTest.java @@ -21,8 +21,8 @@ package org.sakaiproject.content.impl.test; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.FixMethodOrder; @@ -50,7 +50,7 @@ public class VirusScannerTest extends SakaiKernelTestBase { //private static final String SIMPLE_FOLDER1 = "/admin/folder1/"; - private static final Log log = LogFactory.getLog(VirusScannerTest.class); + private static final Logger log = LoggerFactory.getLogger(VirusScannerTest.class); @BeforeClass public static void beforeClass() { @@ -59,7 +59,7 @@ public static void beforeClass() { oneTimeSetup("antivirus"); log.debug("finished oneTimeSetup"); } catch (Exception e) { - log.warn(e); + log.warn(e.getMessage(), e); } } @@ -91,4 +91,4 @@ public void testVirusFound() throws Exception { Assert.assertTrue("the file was found, this is not expected, since a virus was found it should have been removed", false); } -} \ No newline at end of file +} diff --git a/kernel/kernel-impl/src/test/java/org/sakaiproject/email/impl/test/EmailServiceTest.java b/kernel/kernel-impl/src/test/java/org/sakaiproject/email/impl/test/EmailServiceTest.java index 7c3e867256f8..dbf276b7d005 100644 --- a/kernel/kernel-impl/src/test/java/org/sakaiproject/email/impl/test/EmailServiceTest.java +++ b/kernel/kernel-impl/src/test/java/org/sakaiproject/email/impl/test/EmailServiceTest.java @@ -30,8 +30,8 @@ import javax.mail.internet.InternetAddress; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.jmock.Expectations; import org.jmock.Mockery; import org.junit.After; @@ -53,7 +53,7 @@ public class EmailServiceTest { - private static Log log = LogFactory.getLog(EmailServiceTest.class); + private static Logger log = LoggerFactory.getLogger(EmailServiceTest.class); private static final boolean ALLOW_TRANSPORT = false; private static final boolean LOG_SENT_EMAIL = false; @@ -134,7 +134,7 @@ public static void tearDownEmailService() throws Exception { if (wiser != null && wiser.getServer().isRunning()) { if (LOG_SENT_EMAIL) { for (WiserMessage msg : wiser.getMessages()) { - log.info(msg); + log.info(msg.toString()); } } wiser.stop(); @@ -318,4 +318,4 @@ public void testSendMailAll() throws Exception emailService.sendMail(from, to, subject, content, headerToMap, replyTo, additionalHeaders, attachments); } -} \ No newline at end of file +} diff --git a/kernel/kernel-impl/src/test/java/org/sakaiproject/site/impl/test/SiteAliasCleanupNotificationActionIntegrationTest.java b/kernel/kernel-impl/src/test/java/org/sakaiproject/site/impl/test/SiteAliasCleanupNotificationActionIntegrationTest.java index 2817f08dd585..2ebdbcee0c11 100644 --- a/kernel/kernel-impl/src/test/java/org/sakaiproject/site/impl/test/SiteAliasCleanupNotificationActionIntegrationTest.java +++ b/kernel/kernel-impl/src/test/java/org/sakaiproject/site/impl/test/SiteAliasCleanupNotificationActionIntegrationTest.java @@ -20,8 +20,8 @@ **********************************************************************************/ package org.sakaiproject.site.impl.test; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -43,7 +43,7 @@ import java.util.List; public class SiteAliasCleanupNotificationActionIntegrationTest extends SakaiKernelTestBase { - private static Log log = LogFactory.getLog(SiteAliasCleanupNotificationActionIntegrationTest.class); + private static Logger log = LoggerFactory.getLogger(SiteAliasCleanupNotificationActionIntegrationTest.class); private Session session; @BeforeClass @@ -51,7 +51,7 @@ public static void beforeClass() { try { oneTimeSetup(); } catch (Exception e) { - log.warn(e); + log.warn(e.getMessage(), e); } } diff --git a/kernel/kernel-impl/src/test/java/org/sakaiproject/site/impl/test/SiteAliasCleanupNotificationActionTest.java b/kernel/kernel-impl/src/test/java/org/sakaiproject/site/impl/test/SiteAliasCleanupNotificationActionTest.java index 1185a9ce756d..eb227b6907c7 100644 --- a/kernel/kernel-impl/src/test/java/org/sakaiproject/site/impl/test/SiteAliasCleanupNotificationActionTest.java +++ b/kernel/kernel-impl/src/test/java/org/sakaiproject/site/impl/test/SiteAliasCleanupNotificationActionTest.java @@ -22,7 +22,7 @@ import java.lang.reflect.Field; -import org.apache.commons.logging.Log; +import org.slf4j.Logger; import org.jmock.Expectations; import org.jmock.integration.junit3.MockObjectTestCase; import org.sakaiproject.alias.api.AliasService; @@ -48,7 +48,7 @@ public class SiteAliasCleanupNotificationActionTest extends MockObjectTestCase { private Event inboundEvent; private AliasService aliasService; private NotificationService notificationService; - private Log log; + private Logger log; protected void setUp() throws Exception { aliasService = mock(AliasService.class); @@ -56,7 +56,7 @@ protected void setUp() throws Exception { cleanupActionWrappingNotificationEdit = mock(NotificationEdit.class); inboundNotification = mock(Notification.class); inboundEvent = mock(Event.class); - log = mock(Log.class); + log = mock(Logger.class); cleanupAction = new SiteAliasCleanupNotificationAction(); cleanupAction.setAliasService(aliasService); cleanupAction.setNotificationService(notificationService); diff --git a/kernel/kernel-impl/src/test/java/org/sakaiproject/site/impl/test/SiteSearchTest.java b/kernel/kernel-impl/src/test/java/org/sakaiproject/site/impl/test/SiteSearchTest.java index ffe8233d5456..f534145fef77 100644 --- a/kernel/kernel-impl/src/test/java/org/sakaiproject/site/impl/test/SiteSearchTest.java +++ b/kernel/kernel-impl/src/test/java/org/sakaiproject/site/impl/test/SiteSearchTest.java @@ -1,7 +1,7 @@ package org.sakaiproject.site.impl.test; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; @@ -24,14 +24,14 @@ * */ public class SiteSearchTest extends SakaiKernelTestBase { - private static Log log = LogFactory.getLog(SiteSearchTest.class); + private static Logger log = LoggerFactory.getLogger(SiteSearchTest.class); @BeforeClass public static void beforeClass() { try { oneTimeSetup("sitesearch"); } catch (Exception e) { - log.warn(e); + log.warn(e.getMessage(), e); } } @@ -84,4 +84,4 @@ public void testJoinableSiteSQL() throws Exception { Assert.assertEquals(1, sites.size()); } -} \ No newline at end of file +} diff --git a/kernel/kernel-impl/src/test/java/org/sakaiproject/site/impl/test/SiteServiceTest.java b/kernel/kernel-impl/src/test/java/org/sakaiproject/site/impl/test/SiteServiceTest.java index cf4d5dcb5174..905f937366d1 100644 --- a/kernel/kernel-impl/src/test/java/org/sakaiproject/site/impl/test/SiteServiceTest.java +++ b/kernel/kernel-impl/src/test/java/org/sakaiproject/site/impl/test/SiteServiceTest.java @@ -3,8 +3,8 @@ import java.util.Set; import java.util.TreeSet; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; @@ -27,7 +27,7 @@ import org.sakaiproject.user.api.UserPermissionException; public class SiteServiceTest extends SakaiKernelTestBase { - private static final Log log = LogFactory.getLog(SiteServiceTest.class); + private static final Logger log = LoggerFactory.getLogger(SiteServiceTest.class); @BeforeClass public static void beforeClass() { @@ -36,7 +36,7 @@ public static void beforeClass() { oneTimeSetup(null); log.debug("finished oneTimeSetup"); } catch (Exception e) { - log.warn(e); + log.warn(e.getMessage(), e); } } diff --git a/kernel/kernel-impl/src/test/java/org/sakaiproject/user/impl/BaseUserDirectoryServiceTest.java b/kernel/kernel-impl/src/test/java/org/sakaiproject/user/impl/BaseUserDirectoryServiceTest.java index 589a332c5077..78762b4dbdb5 100644 --- a/kernel/kernel-impl/src/test/java/org/sakaiproject/user/impl/BaseUserDirectoryServiceTest.java +++ b/kernel/kernel-impl/src/test/java/org/sakaiproject/user/impl/BaseUserDirectoryServiceTest.java @@ -3,8 +3,8 @@ import java.util.HashMap; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; @@ -32,7 +32,7 @@ * @author Aaron Zeckoski (azeckoski @ unicon.net) (azeckoski @ vt.edu) */ public class BaseUserDirectoryServiceTest extends SakaiKernelTestBase { - private static Log log = LogFactory.getLog(BaseUserDirectoryServiceTest.class); + private static Logger log = LoggerFactory.getLogger(BaseUserDirectoryServiceTest.class); private static String USER_SOURCE_PROPERTY = "user.source"; private static Map eidToId = new HashMap(); @@ -57,7 +57,7 @@ public static void beforeClass() { oneTimeSetupAfter(); if (log.isDebugEnabled()) log.debug("finished setup"); } catch (Exception e) { - log.warn(e); + log.warn(e.getMessage(), e); } } diff --git a/kernel/kernel-impl/src/test/java/org/sakaiproject/user/impl/test/AuthenticatedUserProviderTest.java b/kernel/kernel-impl/src/test/java/org/sakaiproject/user/impl/test/AuthenticatedUserProviderTest.java index 5fa0606552a9..1675d61885b0 100644 --- a/kernel/kernel-impl/src/test/java/org/sakaiproject/user/impl/test/AuthenticatedUserProviderTest.java +++ b/kernel/kernel-impl/src/test/java/org/sakaiproject/user/impl/test/AuthenticatedUserProviderTest.java @@ -24,8 +24,8 @@ import java.util.Collection; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; @@ -49,7 +49,7 @@ public class AuthenticatedUserProviderTest extends SakaiKernelTestBase { protected static final String CONFIG = null; - private static Log log = LogFactory.getLog(AuthenticatedUserProviderTest.class); + private static Logger log = LoggerFactory.getLogger(AuthenticatedUserProviderTest.class); private static TestProvider userDirectoryProvider; private UserDirectoryService userDirectoryService; // These services are only used to clear out various caches to make sure @@ -65,7 +65,7 @@ public static void beforeClass() { oneTimeSetupAfter(); log.debug("finished oneTimeSetup"); } catch (Exception e) { - log.warn(e); + log.warn(e.getMessage(), e); } } @@ -242,7 +242,7 @@ public SecurityAdvice isAllowed(String userId, String function, String reference user.setLastName("Last Name, Jr."); userDirectoryService.commitEdit(user); } catch (Exception e) { - log.warn(e); + log.warn(e.getMessage(), e); } finally { securityService.popAdvisor(); } @@ -259,7 +259,7 @@ public SecurityAdvice isAllowed(String userId, String function, String reference }); user = (UserEdit)userDirectoryService.addUser(null, eid, "First", "Last Name, Sr.", "eid@somewhere.edu", password, "Student", null); } catch (Exception e1) { - log.warn(e1); + log.warn(e1.getMessage(), e1); } finally { securityService.popAdvisor(); } diff --git a/kernel/kernel-impl/src/test/java/org/sakaiproject/user/impl/test/AuthenticationCacheTest.java b/kernel/kernel-impl/src/test/java/org/sakaiproject/user/impl/test/AuthenticationCacheTest.java index 5e6e3d903529..a8d2316af61d 100644 --- a/kernel/kernel-impl/src/test/java/org/sakaiproject/user/impl/test/AuthenticationCacheTest.java +++ b/kernel/kernel-impl/src/test/java/org/sakaiproject/user/impl/test/AuthenticationCacheTest.java @@ -22,8 +22,8 @@ package org.sakaiproject.user.impl.test; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; @@ -38,7 +38,7 @@ import org.sakaiproject.util.IdPwEvidence; public class AuthenticationCacheTest extends SakaiKernelTestBase { - private static Log log = LogFactory.getLog(AuthenticationCacheTest.class); + private static Logger log = LoggerFactory.getLogger(AuthenticationCacheTest.class); private static String[] USER_DATA_1 = {"localonly1user", null, "First", "Last1", "local1@edu", "local1password"}; private static IdPwEvidence USER_EVIDENCE_1 = new IdPwEvidence(USER_DATA_1[0], USER_DATA_1[5]); private static String[] USER_DATA_2 = {"localonly2user", null, "First", "Last2", "local2@edu", "local2password"}; @@ -54,7 +54,7 @@ public static void beforeClass() { oneTimeSetup("AuthenticationCacheTest"); log.debug("finished oneTimeSetup"); } catch (Exception e) { - log.warn(e); + log.warn(e.getMessage(), e); } } diff --git a/kernel/kernel-impl/src/test/java/org/sakaiproject/user/impl/test/ContextualDisplayServiceTest.java b/kernel/kernel-impl/src/test/java/org/sakaiproject/user/impl/test/ContextualDisplayServiceTest.java index cfa2b674aa91..7fbe69eece71 100644 --- a/kernel/kernel-impl/src/test/java/org/sakaiproject/user/impl/test/ContextualDisplayServiceTest.java +++ b/kernel/kernel-impl/src/test/java/org/sakaiproject/user/impl/test/ContextualDisplayServiceTest.java @@ -24,8 +24,8 @@ import java.util.Collection; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; @@ -50,7 +50,7 @@ * and display names. */ public class ContextualDisplayServiceTest extends SakaiKernelTestBase { - private static Log log = LogFactory.getLog(ContextualDisplayServiceTest.class); + private static Logger log = LoggerFactory.getLogger(ContextualDisplayServiceTest.class); private static final String FIRST_NAME = "Alice"; // Also use EIDs as last names. @@ -80,7 +80,7 @@ public static void beforeClass() { oneTimeSetupAfter(); log.debug("finished oneTimeSetup"); } catch (Exception e) { - log.warn(e); + log.warn(e.getMessage(), e); } } diff --git a/kernel/kernel-impl/src/test/java/org/sakaiproject/user/impl/test/GetUsersByEidTest.java b/kernel/kernel-impl/src/test/java/org/sakaiproject/user/impl/test/GetUsersByEidTest.java index a38e7dfd0bc6..20e7ecf5731f 100644 --- a/kernel/kernel-impl/src/test/java/org/sakaiproject/user/impl/test/GetUsersByEidTest.java +++ b/kernel/kernel-impl/src/test/java/org/sakaiproject/user/impl/test/GetUsersByEidTest.java @@ -22,8 +22,8 @@ package org.sakaiproject.user.impl.test; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; @@ -48,7 +48,7 @@ * UserDirectoryService implementation. */ public class GetUsersByEidTest extends SakaiKernelTestBase { - private static Log log = LogFactory.getLog(GetUsersByEidTest.class); + private static Logger log = LoggerFactory.getLogger(GetUsersByEidTest.class); // Oracle will throw a SQLException if we put more than this into a // "WHERE tbl.col IN (:paramList)" query, and so we need to test for @@ -83,7 +83,7 @@ public static void beforeClass() { oneTimeSetup("disable_user_cache"); oneTimeSetupAfter(); } catch (Exception e) { - log.warn(e); + log.warn(e.getMessage(), e); } } diff --git a/kernel/kernel-impl/src/test/java/org/sakaiproject/user/impl/test/RequireLocalAccountLegacyAuthenticationTest.java b/kernel/kernel-impl/src/test/java/org/sakaiproject/user/impl/test/RequireLocalAccountLegacyAuthenticationTest.java index 96160e260567..3bc1d10a56a3 100644 --- a/kernel/kernel-impl/src/test/java/org/sakaiproject/user/impl/test/RequireLocalAccountLegacyAuthenticationTest.java +++ b/kernel/kernel-impl/src/test/java/org/sakaiproject/user/impl/test/RequireLocalAccountLegacyAuthenticationTest.java @@ -22,8 +22,8 @@ package org.sakaiproject.user.impl.test; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; @@ -51,7 +51,7 @@ * */ public class RequireLocalAccountLegacyAuthenticationTest extends SakaiKernelTestBase { - private static Log log = LogFactory.getLog(RequireLocalAccountLegacyAuthenticationTest.class); + private static Logger log = LoggerFactory.getLogger(RequireLocalAccountLegacyAuthenticationTest.class); private static TestProvider userDirectoryProvider; private static String LOCALLY_STORED_EID = "locallystoreduser"; private static String LOCALLY_STORED_PWD = "locallystoreduser-pwd"; @@ -80,7 +80,7 @@ public static void beforeClass() { oneTimeSetupAfter(); if (log.isDebugEnabled()) log.debug("finished setup"); } catch (Exception e) { - log.warn(e); + log.warn(e.getMessage(), e); } } diff --git a/kernel/kernel-impl/src/test/java/org/sakaiproject/user/impl/test/UserDirectoryServiceGetTest.java b/kernel/kernel-impl/src/test/java/org/sakaiproject/user/impl/test/UserDirectoryServiceGetTest.java index d4e17aed7141..c770db10f597 100644 --- a/kernel/kernel-impl/src/test/java/org/sakaiproject/user/impl/test/UserDirectoryServiceGetTest.java +++ b/kernel/kernel-impl/src/test/java/org/sakaiproject/user/impl/test/UserDirectoryServiceGetTest.java @@ -29,8 +29,8 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; @@ -53,7 +53,7 @@ * */ public class UserDirectoryServiceGetTest extends SakaiKernelTestBase { - private static Log log = LogFactory.getLog(UserDirectoryServiceGetTest.class); + private static Logger log = LoggerFactory.getLogger(UserDirectoryServiceGetTest.class); private static String USER_SOURCE_PROPERTY = "user.source"; private static Map eidToId = new HashMap(); @@ -79,7 +79,7 @@ public static void beforeClass() { oneTimeSetupAfter(); if (log.isDebugEnabled()) log.debug("finished setup"); } catch (Exception e) { - log.warn(e); + log.warn(e.getMessage(), e); } } diff --git a/kernel/kernel-private/src/main/java/org/sakaiproject/springframework/orm/hibernate/AddableSessionFactoryBean.java b/kernel/kernel-private/src/main/java/org/sakaiproject/springframework/orm/hibernate/AddableSessionFactoryBean.java index f31ec59c5330..0667757fbaa8 100644 --- a/kernel/kernel-private/src/main/java/org/sakaiproject/springframework/orm/hibernate/AddableSessionFactoryBean.java +++ b/kernel/kernel-private/src/main/java/org/sakaiproject/springframework/orm/hibernate/AddableSessionFactoryBean.java @@ -33,8 +33,8 @@ import org.hibernate.dialect.function.ClassicCountFunction; import org.hibernate.dialect.function.ClassicSumFunction; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; @@ -42,7 +42,7 @@ public class AddableSessionFactoryBean extends LocalSessionFactoryBean implements ApplicationContextAware { - protected final transient Log logger = LogFactory.getLog(getClass()); + protected final transient Logger logger = LoggerFactory.getLogger(getClass()); private ApplicationContext applicationContext; diff --git a/kernel/kernel-private/src/main/java/org/sakaiproject/springframework/orm/hibernate/HibernateJMXAgent.java b/kernel/kernel-private/src/main/java/org/sakaiproject/springframework/orm/hibernate/HibernateJMXAgent.java index 00de8a3b2f33..f922f9ab654e 100644 --- a/kernel/kernel-private/src/main/java/org/sakaiproject/springframework/orm/hibernate/HibernateJMXAgent.java +++ b/kernel/kernel-private/src/main/java/org/sakaiproject/springframework/orm/hibernate/HibernateJMXAgent.java @@ -30,8 +30,8 @@ import javax.management.NotCompliantMBeanException; import javax.management.ObjectName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.SessionFactory; import org.hibernate.jmx.StatisticsService; @@ -40,7 +40,7 @@ */ public class HibernateJMXAgent { - private static final Log log = LogFactory.getLog(HibernateJMXAgent.class); + private static final Logger log = LoggerFactory.getLogger(HibernateJMXAgent.class); private MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer(); diff --git a/kernel/kernel-private/src/main/java/org/sakaiproject/springframework/orm/hibernate/SakaiCacheProvider.java b/kernel/kernel-private/src/main/java/org/sakaiproject/springframework/orm/hibernate/SakaiCacheProvider.java index 61a16c100778..dabef3f9b94d 100644 --- a/kernel/kernel-private/src/main/java/org/sakaiproject/springframework/orm/hibernate/SakaiCacheProvider.java +++ b/kernel/kernel-private/src/main/java/org/sakaiproject/springframework/orm/hibernate/SakaiCacheProvider.java @@ -22,8 +22,8 @@ package org.sakaiproject.springframework.orm.hibernate; import net.sf.ehcache.Ehcache; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.cache.CacheException; import org.hibernate.cache.CacheProvider; import org.hibernate.cache.EhCache; @@ -42,7 +42,7 @@ */ public class SakaiCacheProvider implements CacheProvider, ApplicationContextAware { - private static final Log LOG = LogFactory.getLog(SakaiCacheProvider.class); + private static final Logger LOG = LoggerFactory.getLogger(SakaiCacheProvider.class); private Cache defaultCache; diff --git a/kernel/kernel-private/src/main/java/org/sakaiproject/springframework/orm/hibernate/impl/AdditionalHibernateMappingsImpl.java b/kernel/kernel-private/src/main/java/org/sakaiproject/springframework/orm/hibernate/impl/AdditionalHibernateMappingsImpl.java index b04eed966619..bee0adf4f78d 100644 --- a/kernel/kernel-private/src/main/java/org/sakaiproject/springframework/orm/hibernate/impl/AdditionalHibernateMappingsImpl.java +++ b/kernel/kernel-private/src/main/java/org/sakaiproject/springframework/orm/hibernate/impl/AdditionalHibernateMappingsImpl.java @@ -23,8 +23,8 @@ import java.io.*; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.MappingException; import org.hibernate.cfg.Configuration; import org.sakaiproject.springframework.orm.hibernate.AdditionalHibernateMappings; @@ -33,7 +33,7 @@ public class AdditionalHibernateMappingsImpl implements AdditionalHibernateMappings, Comparable { - protected final transient Log logger = LogFactory.getLog(getClass()); + protected final transient Logger logger = LoggerFactory.getLogger(getClass()); private Resource[] mappingLocations; diff --git a/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/BaseDbBinarySingleStorage.java b/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/BaseDbBinarySingleStorage.java index f21b357d6a46..b94cc6b3cf69 100644 --- a/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/BaseDbBinarySingleStorage.java +++ b/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/BaseDbBinarySingleStorage.java @@ -30,8 +30,8 @@ import java.util.Map; import java.util.Vector; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.db.api.SqlReader; import org.sakaiproject.db.api.SqlService; import org.sakaiproject.entity.api.Edit; @@ -73,7 +73,7 @@ public class BaseDbBinarySingleStorage implements DbSingleStorage public static final String STORAGE_FIELDS = "BINARY_ENTITY"; /** Our logger. */ - private static Log M_log = LogFactory.getLog(BaseDbBinarySingleStorage.class); + private static Logger M_log = LoggerFactory.getLogger(BaseDbBinarySingleStorage.class); /** Table name for resource records. */ protected String m_resourceTableName = null; diff --git a/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/BaseDbDoubleStorage.java b/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/BaseDbDoubleStorage.java index cf499c5848b2..8a0b15b25a5f 100644 --- a/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/BaseDbDoubleStorage.java +++ b/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/BaseDbDoubleStorage.java @@ -32,8 +32,8 @@ import java.util.Vector; import org.apache.commons.lang.ArrayUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.db.api.SqlReader; import org.sakaiproject.db.api.SqlReaderFinishedException; import org.sakaiproject.db.api.SqlService; @@ -76,7 +76,7 @@ public class BaseDbDoubleStorage { /** Our logger. */ - private static Log M_log = LogFactory.getLog(BaseDbDoubleStorage.class); + private static Logger M_log = LoggerFactory.getLogger(BaseDbDoubleStorage.class); /** Table name for container records. */ protected String m_containerTableName = null; diff --git a/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/BaseDbDualSingleStorage.java b/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/BaseDbDualSingleStorage.java index 75d762eb3615..3120fd0f54cb 100644 --- a/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/BaseDbDualSingleStorage.java +++ b/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/BaseDbDualSingleStorage.java @@ -30,8 +30,8 @@ import java.util.Map; import java.util.Vector; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.db.api.SqlReader; import org.sakaiproject.db.api.SqlService; import org.sakaiproject.entity.api.Edit; @@ -76,7 +76,7 @@ public class BaseDbDualSingleStorage implements DbSingleStorage public static final String STORAGE_FIELDS = "XML, BINARY_ENTITY"; /** Our logger. */ - private static Log M_log = LogFactory.getLog(BaseDbDualSingleStorage.class); + private static Logger M_log = LoggerFactory.getLogger(BaseDbDualSingleStorage.class); /** Table name for resource records. */ protected String m_resourceTableName = null; diff --git a/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/BaseDbFlatStorage.java b/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/BaseDbFlatStorage.java index faee650ebcbe..c10dbba9a650 100644 --- a/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/BaseDbFlatStorage.java +++ b/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/BaseDbFlatStorage.java @@ -33,8 +33,8 @@ import java.util.Vector; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.db.api.SqlReader; import org.sakaiproject.db.api.SqlService; import org.sakaiproject.entity.api.Edit; @@ -75,7 +75,7 @@ public class BaseDbFlatStorage private static final String CACHE_NAME_PREFIX = "org.sakaiproject.db.BaseDbFlatStorage."; /** Our logger. */ - private static Log M_log = LogFactory.getLog(BaseDbFlatStorage.class); + private static Logger M_log = LoggerFactory.getLogger(BaseDbFlatStorage.class); /** Table name for resource records. */ protected String m_resourceTableName = null; diff --git a/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/BaseDbSingleStorage.java b/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/BaseDbSingleStorage.java index 65b7530462af..fe87ddfdf7f4 100644 --- a/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/BaseDbSingleStorage.java +++ b/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/BaseDbSingleStorage.java @@ -30,8 +30,8 @@ import java.util.Stack; import java.util.Vector; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.db.api.SqlReader; import org.sakaiproject.db.api.SqlService; import org.sakaiproject.entity.api.Edit; @@ -68,7 +68,7 @@ public class BaseDbSingleStorage implements DbSingleStorage public static final String STORAGE_FIELDS = "XML"; /** Our logger. */ - private static Log M_log = LogFactory.getLog(BaseDbSingleStorage.class); + private static Logger M_log = LoggerFactory.getLogger(BaseDbSingleStorage.class); /** Table name for resource records. */ protected String m_resourceTableName = null; diff --git a/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/BaseXmlFileStorage.java b/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/BaseXmlFileStorage.java index 7200f877503f..0e28cce0d69a 100644 --- a/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/BaseXmlFileStorage.java +++ b/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/BaseXmlFileStorage.java @@ -30,8 +30,8 @@ import java.util.Stack; import java.util.Vector; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.entity.api.Edit; import org.sakaiproject.entity.api.Entity; import org.sakaiproject.entity.api.ResourceProperties; @@ -53,7 +53,7 @@ public class BaseXmlFileStorage { /** Our logger. */ - private static Log M_log = LogFactory.getLog(BaseXmlFileStorage.class); + private static Logger M_log = LoggerFactory.getLogger(BaseXmlFileStorage.class); /** * Holds the container object, a table of the resources contained. diff --git a/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/DbSingleStorageReader.java b/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/DbSingleStorageReader.java index de7d2f7f768d..e2760c346d84 100644 --- a/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/DbSingleStorageReader.java +++ b/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/DbSingleStorageReader.java @@ -23,8 +23,8 @@ import java.sql.ResultSet; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.db.api.SqlReader; /** @@ -33,7 +33,7 @@ public class DbSingleStorageReader implements SqlReader { - private static final Log log = LogFactory.getLog(DbSingleStorageReader.class); + private static final Logger log = LoggerFactory.getLogger(DbSingleStorageReader.class); private DbSingleStorage storage; diff --git a/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/DefaultEntityHandler.java b/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/DefaultEntityHandler.java index 050b3f717830..b0e757cdceb8 100644 --- a/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/DefaultEntityHandler.java +++ b/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/DefaultEntityHandler.java @@ -21,8 +21,8 @@ package org.sakaiproject.util; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.entity.api.Entity; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; @@ -42,7 +42,7 @@ public class DefaultEntityHandler extends DefaultHandler implements SAXEntityHandler { - private static final Log log = LogFactory.getLog(DefaultEntityHandler.class); + private static final Logger log = LoggerFactory.getLogger(DefaultEntityHandler.class); protected ContentHandler ch; diff --git a/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/EntityReaderAdapter.java b/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/EntityReaderAdapter.java index e806e7e7d9d2..e34b487ac578 100644 --- a/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/EntityReaderAdapter.java +++ b/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/EntityReaderAdapter.java @@ -23,8 +23,8 @@ import java.io.IOException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.entity.api.Entity; import org.sakaiproject.entity.api.serialize.EntityParseException; import org.sakaiproject.entity.api.serialize.EntityReaderHandler; @@ -43,7 +43,7 @@ public class EntityReaderAdapter implements EntityReaderHandler { - private static final Log log = LogFactory.getLog(EntityReaderAdapter.class); + private static final Logger log = LoggerFactory.getLogger(EntityReaderAdapter.class); private SingleStorageUser storageUser = null; diff --git a/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/PathHashUtil.java b/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/PathHashUtil.java index 8b6100967fae..f97304f8437f 100644 --- a/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/PathHashUtil.java +++ b/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/PathHashUtil.java @@ -23,8 +23,8 @@ import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -33,7 +33,7 @@ */ public class PathHashUtil { - private static final Log log = LogFactory.getLog(PathHashUtil.class); + private static final Logger log = LoggerFactory.getLogger(PathHashUtil.class); private static char[] encode = { '0', '1', '2', '3', '4', '5', '6', '7', diff --git a/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/StorageUtils.java b/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/StorageUtils.java index 41476e913e37..0e0b46e186e3 100644 --- a/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/StorageUtils.java +++ b/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/StorageUtils.java @@ -37,8 +37,8 @@ import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; import org.w3c.dom.ls.DOMImplementationLS; @@ -55,7 +55,7 @@ */ public class StorageUtils { - private static Log M_log = LogFactory.getLog(StorageUtils.class); + private static Logger M_log = LoggerFactory.getLogger(StorageUtils.class); private static SAXParserFactory parserFactory; diff --git a/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/conversion/CheckConnection.java b/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/conversion/CheckConnection.java index 31810c1ffc9f..d4a286af1720 100644 --- a/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/conversion/CheckConnection.java +++ b/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/conversion/CheckConnection.java @@ -28,8 +28,8 @@ import javax.sql.DataSource; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.util.ByteStorageConversion; /** @@ -38,7 +38,7 @@ */ public class CheckConnection { - private static final Log log = LogFactory.getLog(CheckConnection.class); + private static final Logger log = LoggerFactory.getLogger(CheckConnection.class); public void check(DataSource tds) throws Exception { diff --git a/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/conversion/SchemaConversionController.java b/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/conversion/SchemaConversionController.java index 3207160935cb..2b6d71505961 100644 --- a/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/conversion/SchemaConversionController.java +++ b/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/conversion/SchemaConversionController.java @@ -32,8 +32,8 @@ import javax.sql.DataSource; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @author ieb @@ -42,7 +42,7 @@ public class SchemaConversionController { private boolean reportErrorsInTable = false; - private static final Log log = LogFactory.getLog(SchemaConversionController.class); + private static final Logger log = LoggerFactory.getLogger(SchemaConversionController.class); private long nrecords = 0; diff --git a/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/conversion/UpgradeSchema.java b/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/conversion/UpgradeSchema.java index 3cc98c825350..6288d2827f1b 100644 --- a/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/conversion/UpgradeSchema.java +++ b/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/conversion/UpgradeSchema.java @@ -33,8 +33,8 @@ import org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS; import org.apache.commons.dbcp.datasources.SharedPoolDataSource; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** @@ -43,7 +43,7 @@ public class UpgradeSchema { - private static final Log log = LogFactory.getLog(UpgradeSchema.class); + private static final Logger log = LoggerFactory.getLogger(UpgradeSchema.class); private SharedPoolDataSource tds; diff --git a/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/serialize/Type1BaseResourcePropertiesSerializer.java b/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/serialize/Type1BaseResourcePropertiesSerializer.java index b9941426708d..3c51927e1fb7 100644 --- a/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/serialize/Type1BaseResourcePropertiesSerializer.java +++ b/kernel/kernel-storage-util/src/main/java/org/sakaiproject/util/serialize/Type1BaseResourcePropertiesSerializer.java @@ -30,8 +30,8 @@ import java.util.Vector; import java.util.Map.Entry; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.entity.api.serialize.DataStreamEntitySerializer; import org.sakaiproject.entity.api.serialize.EntityParseException; import org.sakaiproject.entity.api.serialize.SerializableEntity; @@ -51,8 +51,7 @@ public class Type1BaseResourcePropertiesSerializer implements DataStreamEntitySe private static final int BLOCK3 = 102; - private static final Log log = LogFactory - .getLog(Type1BaseResourcePropertiesSerializer.class); + private static final Logger log = LoggerFactory.getLogger(Type1BaseResourcePropertiesSerializer.class); /** * @see org.sakaiproject.entity.api.serialize.DataStreamEntitySerializer#parse(org.sakaiproject.entity.api.serialize.SerializableEntity, diff --git a/kernel/kernel-util/src/main/java/org/sakaiproject/content/util/ZipContentUtil.java b/kernel/kernel-util/src/main/java/org/sakaiproject/content/util/ZipContentUtil.java index b037f137ed61..0b5a09c81d8b 100644 --- a/kernel/kernel-util/src/main/java/org/sakaiproject/content/util/ZipContentUtil.java +++ b/kernel/kernel-util/src/main/java/org/sakaiproject/content/util/ZipContentUtil.java @@ -22,8 +22,8 @@ import javax.activation.MimetypesFileTypeMap; import org.apache.commons.io.IOUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.content.api.ContentCollection; import org.sakaiproject.content.api.ContentCollectionEdit; @@ -47,7 +47,7 @@ @SuppressWarnings({ "deprecation", "restriction" }) public class ZipContentUtil { - protected static final Log LOG = LogFactory.getLog(ZipContentUtil.class); + protected static final Logger LOG = LoggerFactory.getLogger(ZipContentUtil.class); private static final String ZIP_EXTENSION = ".zip"; private static final int BUFFER_SIZE = 32000; private static final MimetypesFileTypeMap mime = new MimetypesFileTypeMap(); @@ -167,11 +167,11 @@ public void compressFolder(Reference reference) { } catch (PermissionException pE){ addAlert(toolSession, rb.getString("permission_error_zip")); - LOG.warn(pE); + LOG.warn(pE.getMessage(), pE); } catch (Exception e) { addAlert(toolSession, rb.getString("generic_error_zip")); - LOG.error(e); + LOG.error(e.getMessage(), e); } finally { if (fis != null) { @@ -555,4 +555,4 @@ private String getContainingFolderDisplayName(String rootId,String filename) thr } -} \ No newline at end of file +} diff --git a/kernel/kernel-util/src/main/java/org/sakaiproject/memory/util/CacheInitializer.java b/kernel/kernel-util/src/main/java/org/sakaiproject/memory/util/CacheInitializer.java index 7b765323ab25..b050a7fc31ab 100644 --- a/kernel/kernel-util/src/main/java/org/sakaiproject/memory/util/CacheInitializer.java +++ b/kernel/kernel-util/src/main/java/org/sakaiproject/memory/util/CacheInitializer.java @@ -1,8 +1,8 @@ package org.sakaiproject.memory.util; import net.sf.ehcache.config.CacheConfiguration; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.lang.reflect.Method; import java.lang.reflect.Modifier; @@ -18,7 +18,7 @@ */ public class CacheInitializer { - private static final Log M_log = LogFactory.getLog(CacheInitializer.class); + private static final Logger M_log = LoggerFactory.getLogger(CacheInitializer.class); private Map configMap; @@ -70,7 +70,7 @@ public CacheInitializer initialize(CacheConfiguration cacheConfig) { String key = Character.toLowerCase(method.getName().charAt( "set".length())) + method.getName().substring("set".length() + 1); - M_log.debug("Looking in config map for: " + key); + M_log.debug("Looking in config map for: {}", key); String value = configMap.get(key); if (value != null) { Class clazz = method.getParameterTypes()[0]; @@ -79,7 +79,7 @@ public CacheInitializer initialize(CacheConfiguration cacheConfig) { if (obj != null) { invokeMethod(method, cacheConfig, obj); - M_log.debug("Setting " + clazz + "#" + key + " to " + value); + M_log.debug("Setting {}#{} to {}", clazz, key, value); } } @@ -109,10 +109,10 @@ private Object covertValue(String value, Class clazz) { || char.class.equals(clazz)) { obj = Character.valueOf(value.charAt(0)); } else { - M_log.debug("Can't convert to :" + clazz); + M_log.debug("Can't convert to :{}", clazz); } } catch (NumberFormatException nfe) { - M_log.debug("Ignored bad number: " + value); + M_log.debug("Ignored bad number: {}", value); } return obj; } @@ -121,7 +121,7 @@ private void invokeMethod(Method method, Object obj, Object value) { try { method.invoke(obj, value); } catch (Exception e) { - M_log.debug(e); + M_log.debug(e.getMessage(), e); } } diff --git a/kernel/kernel-util/src/main/java/org/sakaiproject/memory/util/EhCacheFactoryBean.java b/kernel/kernel-util/src/main/java/org/sakaiproject/memory/util/EhCacheFactoryBean.java index 84ddad5f087e..aae2ab466919 100644 --- a/kernel/kernel-util/src/main/java/org/sakaiproject/memory/util/EhCacheFactoryBean.java +++ b/kernel/kernel-util/src/main/java/org/sakaiproject/memory/util/EhCacheFactoryBean.java @@ -68,8 +68,8 @@ import net.sf.ehcache.constructs.blocking.*; import net.sf.ehcache.event.CacheEventListener; import net.sf.ehcache.store.MemoryStoreEvictionPolicy; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.component.cover.ComponentManager; import org.springframework.beans.factory.BeanNameAware; @@ -106,7 +106,7 @@ */ public class EhCacheFactoryBean implements FactoryBean, BeanNameAware, InitializingBean { - protected final Log logger = LogFactory.getLog(getClass()); + protected final Logger logger = LoggerFactory.getLogger(getClass()); private ServerConfigurationService serverConfigurationService = (ServerConfigurationService) ComponentManager.get(ServerConfigurationService.class); diff --git a/kernel/kernel-util/src/main/java/org/sakaiproject/util/BaseResourceProperties.java b/kernel/kernel-util/src/main/java/org/sakaiproject/util/BaseResourceProperties.java index eb520ba46f03..19bfef937083 100644 --- a/kernel/kernel-util/src/main/java/org/sakaiproject/util/BaseResourceProperties.java +++ b/kernel/kernel-util/src/main/java/org/sakaiproject/util/BaseResourceProperties.java @@ -33,8 +33,8 @@ import java.util.Vector; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.content.cover.ContentTypeImageService; import org.sakaiproject.entity.api.EntityPropertyNotDefinedException; import org.sakaiproject.entity.api.EntityPropertyTypeException; @@ -64,7 +64,7 @@ public class BaseResourceProperties implements ResourceProperties, SerializablePropertiesAccess, SerializableEntity { /** Our logger. */ - private static Log M_log = LogFactory.getLog(BaseResourceProperties.class); + private static Logger M_log = LoggerFactory.getLogger(BaseResourceProperties.class); /** A fixed class serian number. */ private static final long serialVersionUID = 1L; diff --git a/kernel/kernel-util/src/main/java/org/sakaiproject/util/EmailNotification.java b/kernel/kernel-util/src/main/java/org/sakaiproject/util/EmailNotification.java index 901e555f995e..7b44ca1490f7 100644 --- a/kernel/kernel-util/src/main/java/org/sakaiproject/util/EmailNotification.java +++ b/kernel/kernel-util/src/main/java/org/sakaiproject/util/EmailNotification.java @@ -26,8 +26,8 @@ import java.util.Vector; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.email.cover.DigestService; @@ -73,7 +73,7 @@ public class EmailNotification implements NotificationAction { // Our logger - private static Log M_log = LogFactory.getLog(EmailNotification.class); + private static Logger M_log = LoggerFactory.getLogger(EmailNotification.class); protected final String MULTIPART_BOUNDARY = "======sakai-multi-part-boundary======"; protected final String BOUNDARY_LINE = "\n\n--"+MULTIPART_BOUNDARY+"\n"; diff --git a/kernel/kernel-util/src/main/java/org/sakaiproject/util/FormattedText.java b/kernel/kernel-util/src/main/java/org/sakaiproject/util/FormattedText.java index 4c5ebffc39db..4d85a43e68cd 100644 --- a/kernel/kernel-util/src/main/java/org/sakaiproject/util/FormattedText.java +++ b/kernel/kernel-util/src/main/java/org/sakaiproject/util/FormattedText.java @@ -21,8 +21,8 @@ package org.sakaiproject.util; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.util.api.FormattedText.Level; import org.sakaiproject.util.api.MockFormattedText; @@ -39,7 +39,7 @@ @Deprecated public class FormattedText { - private static final Log log = LogFactory.getLog(FormattedText.class); + private static final Logger log = LoggerFactory.getLogger(FormattedText.class); private static Object LOCK = new Object(); private static org.sakaiproject.util.api.FormattedText formattedText; diff --git a/kernel/kernel-util/src/main/java/org/sakaiproject/util/PasswordCheck.java b/kernel/kernel-util/src/main/java/org/sakaiproject/util/PasswordCheck.java index a81d0b276cdd..25d7eecea970 100644 --- a/kernel/kernel-util/src/main/java/org/sakaiproject/util/PasswordCheck.java +++ b/kernel/kernel-util/src/main/java/org/sakaiproject/util/PasswordCheck.java @@ -26,8 +26,8 @@ import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.math.IntRange; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** *

@@ -49,7 +49,7 @@ public class PasswordCheck { public static final int VERY_WEAK = 1; public static final int NONE = 0; - private static Log log = LogFactory.getLog(Resource.class); + private static Logger log = LoggerFactory.getLogger(Resource.class); /** * Compute the strength of the given password and return it as one of the constant values. diff --git a/kernel/kernel-util/src/main/java/org/sakaiproject/util/PathHashUtil.java b/kernel/kernel-util/src/main/java/org/sakaiproject/util/PathHashUtil.java index 733796515a1c..d0bd6d115a3c 100644 --- a/kernel/kernel-util/src/main/java/org/sakaiproject/util/PathHashUtil.java +++ b/kernel/kernel-util/src/main/java/org/sakaiproject/util/PathHashUtil.java @@ -23,8 +23,8 @@ import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -33,7 +33,7 @@ */ public class PathHashUtil { - private static final Log log = LogFactory.getLog(PathHashUtil.class); + private static final Logger log = LoggerFactory.getLogger(PathHashUtil.class); private static char[] encode = { '0', '1', '2', '3', '4', '5', '6', '7', diff --git a/kernel/kernel-util/src/main/java/org/sakaiproject/util/RemoteHostFilter.java b/kernel/kernel-util/src/main/java/org/sakaiproject/util/RemoteHostFilter.java index 762f3e18840a..27402c636c04 100644 --- a/kernel/kernel-util/src/main/java/org/sakaiproject/util/RemoteHostFilter.java +++ b/kernel/kernel-util/src/main/java/org/sakaiproject/util/RemoteHostFilter.java @@ -36,8 +36,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; // Add the ability to look in sakai.properties for properties import org.sakaiproject.component.cover.ServerConfigurationService; @@ -81,7 +81,7 @@ public class RemoteHostFilter implements Filter { // Our logger - private static Log M_log = LogFactory.getLog(RemoteHostFilter.class); + private static Logger M_log = LoggerFactory.getLogger(RemoteHostFilter.class); /** * Define an empty pattern to save re-constructing a null array multiple diff --git a/kernel/kernel-util/src/main/java/org/sakaiproject/util/Resource.java b/kernel/kernel-util/src/main/java/org/sakaiproject/util/Resource.java index 37ab90c36972..020248928b1c 100644 --- a/kernel/kernel-util/src/main/java/org/sakaiproject/util/Resource.java +++ b/kernel/kernel-util/src/main/java/org/sakaiproject/util/Resource.java @@ -21,8 +21,8 @@ package org.sakaiproject.util; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.util.ResourceLoader; @@ -34,7 +34,7 @@ * */ public class Resource { - private static Log log = LogFactory.getLog(Resource.class); + private static Logger log = LoggerFactory.getLogger(Resource.class); public Resource() { // constructor diff --git a/kernel/kernel-util/src/main/java/org/sakaiproject/util/ResourceLoader.java b/kernel/kernel-util/src/main/java/org/sakaiproject/util/ResourceLoader.java index 7223bcef9e01..8e386eb029e7 100644 --- a/kernel/kernel-util/src/main/java/org/sakaiproject/util/ResourceLoader.java +++ b/kernel/kernel-util/src/main/java/org/sakaiproject/util/ResourceLoader.java @@ -22,8 +22,8 @@ package org.sakaiproject.util; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.i18n.InternationalizedMessages; @@ -45,7 +45,7 @@ @SuppressWarnings("rawtypes") public class ResourceLoader extends DummyMap implements InternationalizedMessages { - protected static final Log M_log = LogFactory.getLog(ResourceLoader.class); + protected static final Logger M_log = LoggerFactory.getLogger(ResourceLoader.class); // name of ResourceBundle protected String baseName = null; diff --git a/kernel/kernel-util/src/main/java/org/sakaiproject/util/UserNotificationPreferencesRegistrationImpl.java b/kernel/kernel-util/src/main/java/org/sakaiproject/util/UserNotificationPreferencesRegistrationImpl.java index efb784124ee8..ddc5d60c38b3 100644 --- a/kernel/kernel-util/src/main/java/org/sakaiproject/util/UserNotificationPreferencesRegistrationImpl.java +++ b/kernel/kernel-util/src/main/java/org/sakaiproject/util/UserNotificationPreferencesRegistrationImpl.java @@ -26,8 +26,8 @@ import java.util.Map; import java.util.Map.Entry; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.user.api.UserNotificationPreferencesRegistration; import org.sakaiproject.user.api.UserNotificationPreferencesRegistrationService; @@ -69,7 +69,7 @@ public abstract class UserNotificationPreferencesRegistrationImpl implements Use private UserNotificationPreferencesRegistrationService userNotificationPreferencesRegistrationService; - protected final Log logger = LogFactory.getLog(getClass()); + protected final Logger logger = LoggerFactory.getLogger(getClass()); private String sectionTitle = ""; private String sectionDescription = ""; diff --git a/kernel/kernel-util/src/main/java/org/sakaiproject/util/Validator.java b/kernel/kernel-util/src/main/java/org/sakaiproject/util/Validator.java index 8d8c7a11572a..aa49c935a463 100644 --- a/kernel/kernel-util/src/main/java/org/sakaiproject/util/Validator.java +++ b/kernel/kernel-util/src/main/java/org/sakaiproject/util/Validator.java @@ -27,8 +27,8 @@ import javax.servlet.http.HttpServletRequest; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.exception.IdInvalidException; @@ -42,7 +42,7 @@ public class Validator { /** Our logger. */ - private static Log M_log = LogFactory.getLog(Validator.class); + private static Logger M_log = LoggerFactory.getLogger(Validator.class); /** These characters are not allowed in a resource id */ public static final String INVALID_CHARS_IN_RESOURCE_ID = "^/\\{}[]()%*?#&=\n\r\t\b\f"; diff --git a/kernel/kernel-util/src/main/java/org/sakaiproject/util/Web.java b/kernel/kernel-util/src/main/java/org/sakaiproject/util/Web.java index c7be2ad76ff4..b0c7044bbfa1 100644 --- a/kernel/kernel-util/src/main/java/org/sakaiproject/util/Web.java +++ b/kernel/kernel-util/src/main/java/org/sakaiproject/util/Web.java @@ -32,8 +32,8 @@ import javax.servlet.ServletConfig; import javax.servlet.http.HttpServletRequest; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.tool.api.SessionManager; @@ -47,7 +47,7 @@ public class Web { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(Web.class); + private static Logger M_log = LoggerFactory.getLogger(Web.class); // used to remove javascript from html private static final String START_JAVASCRIPT = "=0 && agent.indexOf("Safari" } catch (java.io.UnsupportedEncodingException e) { - M_log.error(e); + M_log.error(e.getMessage(), e); } return fileName; diff --git a/kernel/kernel-util/src/main/java/org/sakaiproject/util/Xml.java b/kernel/kernel-util/src/main/java/org/sakaiproject/util/Xml.java index 4caedff1a28d..3993b11c60c2 100644 --- a/kernel/kernel-util/src/main/java/org/sakaiproject/util/Xml.java +++ b/kernel/kernel-util/src/main/java/org/sakaiproject/util/Xml.java @@ -41,8 +41,8 @@ import javax.xml.parsers.SAXParserFactory; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.codec.binary.Base64; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; @@ -65,7 +65,7 @@ public class Xml { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(Xml.class); + private static Logger M_log = LoggerFactory.getLogger(Xml.class); private static SAXParserFactory parserFactory; /** diff --git a/kernel/kernel-util/src/test/java/org/sakaiproject/util/WebTest.java b/kernel/kernel-util/src/test/java/org/sakaiproject/util/WebTest.java index 74db7cc84e4a..2e40afe39fab 100644 --- a/kernel/kernel-util/src/test/java/org/sakaiproject/util/WebTest.java +++ b/kernel/kernel-util/src/test/java/org/sakaiproject/util/WebTest.java @@ -1,7 +1,7 @@ package org.sakaiproject.util; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -10,7 +10,7 @@ public class WebTest { - private static Log log = LogFactory.getLog(WebTest.class); + private static Logger log = LoggerFactory.getLogger(WebTest.class); @BeforeClass public static void beforeClass() { @@ -19,7 +19,7 @@ public static void beforeClass() { //oneTimeSetup(); log.debug("finished oneTimeSetup"); } catch (Exception e) { - log.warn(e); + log.warn(e.getMessage(), e); } } diff --git a/lessonbuilder/tool/opt-src/java/org/sakaiproject/lessonbuildertool/ccexport/Assignment2Export.java b/lessonbuilder/tool/opt-src/java/org/sakaiproject/lessonbuildertool/ccexport/Assignment2Export.java index dae4d657efa6..342cb86aea2d 100644 --- a/lessonbuilder/tool/opt-src/java/org/sakaiproject/lessonbuildertool/ccexport/Assignment2Export.java +++ b/lessonbuilder/tool/opt-src/java/org/sakaiproject/lessonbuildertool/ccexport/Assignment2Export.java @@ -47,8 +47,8 @@ import org.sakaiproject.db.cover.SqlService; import org.sakaiproject.db.api.SqlReader; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.lang.StringEscapeUtils; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.component.cover.ComponentManager; @@ -93,7 +93,7 @@ public class Assignment2Export extends AssignmentExport { - private static Log log = LogFactory.getLog(AssignmentExport.class); + private static Logger log = LoggerFactory.getLogger(AssignmentExport.class); private static SimplePageToolDao simplePageToolDao; diff --git a/lessonbuilder/tool/opt-src/java/org/sakaiproject/lessonbuildertool/service/Assignment2Entity.java b/lessonbuilder/tool/opt-src/java/org/sakaiproject/lessonbuildertool/service/Assignment2Entity.java index e8b07a43ff90..8f1a00e971af 100644 --- a/lessonbuilder/tool/opt-src/java/org/sakaiproject/lessonbuildertool/service/Assignment2Entity.java +++ b/lessonbuilder/tool/opt-src/java/org/sakaiproject/lessonbuildertool/service/Assignment2Entity.java @@ -38,8 +38,8 @@ import java.util.Iterator; import java.lang.reflect.Method; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.jdom.Element; import org.jdom.Namespace; @@ -123,7 +123,7 @@ class AssignGroup { String groupid; } - private static Log log = LogFactory.getLog(Assignment2Entity.class); + private static Logger log = LoggerFactory.getLogger(Assignment2Entity.class); private static Cache assignmentCache = null; protected static final int DEFAULT_EXPIRATION = 10 * 60; diff --git a/lessonbuilder/tool/opt-src/java/org/sakaiproject/lessonbuildertool/service/MnemeEntity.java b/lessonbuilder/tool/opt-src/java/org/sakaiproject/lessonbuildertool/service/MnemeEntity.java index eee4b0f05aa8..6b7bb9c3c185 100644 --- a/lessonbuilder/tool/opt-src/java/org/sakaiproject/lessonbuildertool/service/MnemeEntity.java +++ b/lessonbuilder/tool/opt-src/java/org/sakaiproject/lessonbuildertool/service/MnemeEntity.java @@ -37,8 +37,8 @@ import java.util.Date; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.lessonbuildertool.service.LessonSubmission; import org.sakaiproject.lessonbuildertool.tool.beans.SimplePageBean; @@ -75,7 +75,7 @@ public class MnemeEntity implements LessonEntity, QuizEntity { - private static Log log = LogFactory.getLog(MnemeEntity.class); + private static Logger log = LoggerFactory.getLogger(MnemeEntity.class); private static Cache assessmentCache = null; protected static final int DEFAULT_EXPIRATION = 10 * 60; diff --git a/lessonbuilder/tool/opt-src/java/org/sakaiproject/lessonbuildertool/service/ScormEntity.java b/lessonbuilder/tool/opt-src/java/org/sakaiproject/lessonbuildertool/service/ScormEntity.java index ab3c465222d2..c0dc7e62f071 100644 --- a/lessonbuilder/tool/opt-src/java/org/sakaiproject/lessonbuildertool/service/ScormEntity.java +++ b/lessonbuilder/tool/opt-src/java/org/sakaiproject/lessonbuildertool/service/ScormEntity.java @@ -38,8 +38,8 @@ import java.util.Iterator; import java.lang.reflect.Method; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.jdom.Element; import org.jdom.Namespace; @@ -101,7 +101,7 @@ public class ScormEntity implements LessonEntity, AssignmentInterface { - private static Log log = LogFactory.getLog(ScormEntity.class); + private static Logger log = LoggerFactory.getLogger(ScormEntity.class); private SimplePageBean simplePageBean; diff --git a/lessonbuilder/tool/opt-src/java/org/sakaiproject/lessonbuildertool/service/YaftTopicEntity.java b/lessonbuilder/tool/opt-src/java/org/sakaiproject/lessonbuildertool/service/YaftTopicEntity.java index f1b79bd33916..0aa10f1ce435 100644 --- a/lessonbuilder/tool/opt-src/java/org/sakaiproject/lessonbuildertool/service/YaftTopicEntity.java +++ b/lessonbuilder/tool/opt-src/java/org/sakaiproject/lessonbuildertool/service/YaftTopicEntity.java @@ -30,8 +30,8 @@ import java.util.Date; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.lessonbuildertool.service.LessonSubmission; import org.sakaiproject.lessonbuildertool.tool.beans.SimplePageBean; @@ -57,7 +57,7 @@ */ public class YaftTopicEntity implements LessonEntity, ForumInterface { - private static Log log = LogFactory.getLog(YaftTopicEntity.class); + private static Logger log = LoggerFactory.getLogger(YaftTopicEntity.class); private static String TOOL_ID = "sakai.yaft"; diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/cc/AbstractParser.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/cc/AbstractParser.java index f2de489c18fc..9c1826fbb52c 100755 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/cc/AbstractParser.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/cc/AbstractParser.java @@ -46,8 +46,8 @@ import java.io.IOException; import java.util.Iterator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.jdom.Element; import org.jdom.JDOMException; import org.jdom.Namespace; @@ -62,7 +62,7 @@ public abstract class AbstractParser { - private static final Log log = LogFactory.getLog(AbstractParser.class); + private static final Logger log = LoggerFactory.getLogger(AbstractParser.class); private static final String RESOURCE_QUERY="ims:resource[@identifier='xxx']"; private static final String MD_ROOT="lom"; private static final String METADATA="metadata"; diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/cc/LtiParser.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/cc/LtiParser.java index e9e3dc9a4a19..289f0f168dce 100755 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/cc/LtiParser.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/cc/LtiParser.java @@ -44,8 +44,8 @@ import java.io.IOException; import java.util.Iterator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.jdom.Attribute; import org.jdom.Element; import org.jdom.JDOMException; @@ -53,7 +53,7 @@ import org.jdom.xpath.XPath; public class LtiParser extends AbstractParser implements ContentParser { - private static final Log log = LogFactory.getLog(LtiParser.class); + private static final Logger log = LoggerFactory.getLogger(LtiParser.class); private static final Namespace LT_NS = Namespace.getNamespace("dt", "http://www.imsglobal.org/xsd/imsbasiclti_v1p0"); private static final String FILE="file"; diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/cc/Parser.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/cc/Parser.java index 2d9fd2fd31af..a8fdd03bdc27 100755 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/cc/Parser.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/cc/Parser.java @@ -47,8 +47,8 @@ import java.util.Iterator; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.jdom.Element; import org.jdom.JDOMException; import org.jdom.Namespace; @@ -76,7 +76,7 @@ */ public class Parser extends AbstractParser { - private static final Log log = LogFactory.getLog(Parser.class); + private static final Logger log = LoggerFactory.getLogger(Parser.class); CartridgeLoader utils; private static final String IMS_MANIFEST="imsmanifest.xml"; diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/cc/PrintHandler.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/cc/PrintHandler.java index 1ba7b3aade03..27357bcb84ae 100755 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/cc/PrintHandler.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/cc/PrintHandler.java @@ -1,7 +1,7 @@ package org.sakaiproject.lessonbuildertool.cc; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /*********** * This code is based on a reference implementation done for the IMS Consortium. @@ -108,7 +108,7 @@ public class PrintHandler extends DefaultHandler implements AssessmentHandler, DiscussionHandler, AuthorizationHandler, MetadataHandler, LearningApplicationResourceHandler, QuestionBankHandler, WebContentHandler, WebLinkHandler{ - private static final Log log = LogFactory.getLog(PrintHandler.class); + private static final Logger log = LoggerFactory.getLogger(PrintHandler.class); private static final String HREF="href"; private static final String TYPE="type"; private static final String FILE="file"; diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/cc/ZipLoader.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/cc/ZipLoader.java index 7c2af07216d6..120a38752756 100755 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/cc/ZipLoader.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/cc/ZipLoader.java @@ -54,8 +54,8 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -75,7 +75,7 @@ */ public class ZipLoader implements CartridgeLoader { - private static final Log log = LogFactory.getLog(ZipLoader.class); + private static final Logger log = LoggerFactory.getLogger(ZipLoader.class); private File root; private String rootPath; private File cc; diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/ccexport/AssignmentExport.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/ccexport/AssignmentExport.java index e5d15968c890..c340faf44958 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/ccexport/AssignmentExport.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/ccexport/AssignmentExport.java @@ -44,8 +44,8 @@ import java.util.Iterator; import java.net.URLEncoder; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.lang.StringEscapeUtils; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.util.Validator; @@ -93,7 +93,7 @@ public class AssignmentExport { - private static Log log = LogFactory.getLog(AssignmentExport.class); + private static Logger log = LoggerFactory.getLogger(AssignmentExport.class); private static SimplePageToolDao simplePageToolDao; diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/ccexport/BltiExport.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/ccexport/BltiExport.java index d154aba129a5..a1334d79874d 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/ccexport/BltiExport.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/ccexport/BltiExport.java @@ -6,8 +6,8 @@ import java.util.List; import java.util.Map; import org.apache.commons.lang.StringEscapeUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.lessonbuildertool.model.SimplePageToolDao; import org.sakaiproject.component.cover.ServerConfigurationService; @@ -15,7 +15,7 @@ import uk.org.ponder.messageutil.MessageLocator; public class BltiExport { - private static Log log = LogFactory.getLog(AssignmentExport.class); + private static Logger log = LoggerFactory.getLogger(AssignmentExport.class); private static SimplePageToolDao simplePageToolDao; static MessageLocator messageLocator = null; diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/ccexport/CCExport.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/ccexport/CCExport.java index 66f1517ab022..a33d5cb1a052 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/ccexport/CCExport.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/ccexport/CCExport.java @@ -41,8 +41,8 @@ import java.util.regex.Matcher; import java.net.URLDecoder; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringEscapeUtils; import org.sakaiproject.content.api.ContentCollection; @@ -74,7 +74,7 @@ public class CCExport { - private static Log log = LogFactory.getLog(CCExport.class); + private static Logger log = LoggerFactory.getLogger(CCExport.class); private File root; private String rootPath; diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/ccexport/ForumsExport.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/ccexport/ForumsExport.java index 1fac39079d29..329a9ec2f21d 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/ccexport/ForumsExport.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/ccexport/ForumsExport.java @@ -44,8 +44,8 @@ import java.util.Iterator; import java.net.URLEncoder; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.lang.StringEscapeUtils; import org.sakaiproject.component.cover.ServerConfigurationService; @@ -104,7 +104,7 @@ public class ForumsExport { - private static Log log = LogFactory.getLog(ForumsExport.class); + private static Logger log = LoggerFactory.getLogger(ForumsExport.class); private static SimplePageToolDao simplePageToolDao; diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/ccexport/JForumExport.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/ccexport/JForumExport.java index bbdea2e418a8..f5487b34d807 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/ccexport/JForumExport.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/ccexport/JForumExport.java @@ -44,8 +44,8 @@ import java.util.Iterator; import java.net.URLEncoder; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.lang.StringEscapeUtils; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.component.cover.ComponentManager; @@ -99,7 +99,7 @@ public class JForumExport extends ForumsExport { - private static Log log = LogFactory.getLog(JForumExport.class); + private static Logger log = LoggerFactory.getLogger(JForumExport.class); private static SimplePageToolDao simplePageToolDao; diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/ccexport/SamigoExport.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/ccexport/SamigoExport.java index 5a14afbd812b..3b418fb2d9e9 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/ccexport/SamigoExport.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/ccexport/SamigoExport.java @@ -42,8 +42,8 @@ import java.util.Date; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.lang.StringEscapeUtils; import org.sakaiproject.component.cover.ServerConfigurationService; @@ -119,7 +119,7 @@ public class SamigoExport { - private static Log log = LogFactory.getLog(SamigoExport.class); + private static Logger log = LoggerFactory.getLogger(SamigoExport.class); PublishedAssessmentService pubService = new PublishedAssessmentService(); AssessmentService assessmentService = new AssessmentService(); diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/AjaxServer.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/AjaxServer.java index 47b216cdc9d7..cf067d4e925d 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/AjaxServer.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/AjaxServer.java @@ -49,8 +49,8 @@ import javax.servlet.ServletConfig; import javax.servlet.ServletException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroupService; import org.sakaiproject.authz.api.AuthzGroup; @@ -109,7 +109,7 @@ public void setSimplePageToolDao(Object dao) { } /** Our log (commons). */ - private static Log log = LogFactory.getLog(AjaxServer.class); + private static Logger log = LoggerFactory.getLogger(AjaxServer.class); public static final String FILTERHTML = "lessonbuilder.filterhtml"; private static String filterHtml = ServerConfigurationService.getString(FILTERHTML); diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/AssignmentEntity.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/AssignmentEntity.java index a33feec34cc6..be66de11661f 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/AssignmentEntity.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/AssignmentEntity.java @@ -36,8 +36,8 @@ import java.util.Map; import java.util.Iterator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.jdom.Element; import org.jdom.Namespace; @@ -106,7 +106,7 @@ public class AssignmentEntity implements LessonEntity, AssignmentInterface { public static final int CACHE_MAX_ENTRIES = 5000; public static final int CACHE_TIME_TO_LIVE_SECONDS = 600; public static final int CACHE_TIME_TO_IDLE_SECONDS = 360; - private static Log log = LogFactory.getLog(AssignmentEntity.class); + private static Logger log = LoggerFactory.getLogger(AssignmentEntity.class); private static Cache assignmentCache = null; @@ -367,11 +367,8 @@ public boolean addEntityControl(String siteId, String groupId) throws IOExceptio } catch (IdUnusedException e) { log.warn("ID unused ", e); return false; - } catch (PermissionException e) { - log.warn(e); - return false; - } catch (InUseException e) { - log.warn(e); + } catch (PermissionException | InUseException e) { + log.warn(e.getMessage(), e); return false; } @@ -407,7 +404,7 @@ public boolean addEntityControl(String siteId, String groupId) throws IOExceptio try { edit.setGroupAccess(newGroups); } catch (PermissionException e) { - log.warn(e); + log.warn(e.getMessage()); return false; } @@ -431,7 +428,7 @@ public boolean addEntityControl(String siteId, String groupId) throws IOExceptio // this change mode to grouped edit.setGroupAccess(groups); } catch (PermissionException e) { - log.warn(e); + log.warn(e.getMessage()); return false; } @@ -440,7 +437,7 @@ public boolean addEntityControl(String siteId, String groupId) throws IOExceptio return true; } } catch (Exception e) { - log.warn(e); + log.warn(e.getMessage()); return false; } finally { if (doCancel) { @@ -463,14 +460,8 @@ public boolean removeEntityControl(String siteId, String groupId) throws IOExcep try { edit = AssignmentService.editAssignment(ref); - } catch (IdUnusedException e) { - log.warn(e); - return false; - } catch (PermissionException e) { - log.warn(e); - return false; - } catch (InUseException e) { - log.warn(e); + } catch (IdUnusedException | PermissionException | InUseException e) { + log.warn(e.getMessage()); return false; } @@ -504,7 +495,7 @@ public boolean removeEntityControl(String siteId, String groupId) throws IOExcep try { edit.setGroupAccess(newGroups); } catch (PermissionException e) { - log.warn(e); + log.warn(e.getMessage()); return false; } } else { @@ -525,7 +516,7 @@ public boolean removeEntityControl(String siteId, String groupId) throws IOExcep } } catch (Exception e) { - log.warn(e); + log.warn(e.getMessage()); return false; } finally { if (doCancel) { @@ -555,6 +546,7 @@ public LessonSubmission getSubmission(String userId) { user = UserDirectoryService.getUser(userId); submission = AssignmentService.getSubmission(assignment.getReference(), user); } catch (Exception e) { + log.warn(e.getMessage()); return null; } @@ -688,11 +680,8 @@ public void setGroups(Collection groups) { } catch (IdUnusedException e) { log.warn("ID unused ", e); return; - } catch (PermissionException e) { - log.warn(e); - return; - } catch (InUseException e) { - log.warn(e); + } catch (PermissionException | InUseException e) { + log.warn(e.getMessage()); return; } @@ -721,7 +710,7 @@ public void setGroups(Collection groups) { return; } catch (Exception e) { - log.warn(e); + log.warn(e.getMessage()); return; } finally { if (doCancel) { diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/BltiEntity.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/BltiEntity.java index 6e488f7eacaa..823d6a8b48c6 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/BltiEntity.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/BltiEntity.java @@ -39,8 +39,8 @@ import java.net.URLEncoder; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.lessonbuildertool.service.LessonSubmission; import org.sakaiproject.lessonbuildertool.tool.beans.SimplePageBean; @@ -84,7 +84,7 @@ public class BltiEntity implements LessonEntity, BltiInterface { - private static Log log = LogFactory.getLog(BltiEntity.class); + private static Logger log = LoggerFactory.getLogger(BltiEntity.class); private static Cache bltiCache = null; protected static final int DEFAULT_EXPIRATION = 10 * 60; diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/ForumEntity.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/ForumEntity.java index d1c29c233ff4..decce1028ae5 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/ForumEntity.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/ForumEntity.java @@ -36,8 +36,8 @@ import java.util.Comparator; import java.util.Date; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.lang.StringEscapeUtils; import org.sakaiproject.lessonbuildertool.service.LessonSubmission; @@ -117,7 +117,7 @@ public class ForumEntity extends HibernateDaoSupport implements LessonEntity, ForumInterface { - private static Log log = LogFactory.getLog(ForumEntity.class); + private static Logger log = LoggerFactory.getLogger(ForumEntity.class); private static Cache topicCache = null; // topicid => grouplist protected static final int DEFAULT_EXPIRATION = 10 * 60; diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/GradebookIfc.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/GradebookIfc.java index 92b9dc53b90d..305d6280e670 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/GradebookIfc.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/GradebookIfc.java @@ -26,8 +26,8 @@ import java.util.Date; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.service.gradebook.shared.GradebookExternalAssessmentService; /** @@ -38,7 +38,7 @@ */ public class GradebookIfc { - private static final Log log = LogFactory.getLog(GradebookIfc.class); + private static final Logger log = LoggerFactory.getLogger(GradebookIfc.class); private static GradebookExternalAssessmentService gbExternalService = null; public void setGradebookExternalAssessmentService (GradebookExternalAssessmentService s) { @@ -102,4 +102,4 @@ public boolean updateExternalAssessmentScores(final String gradebookUid, final S return true; } -} \ No newline at end of file +} diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/GroupPermissionsService.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/GroupPermissionsService.java index f8c3706ffce2..56a8b5010579 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/GroupPermissionsService.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/GroupPermissionsService.java @@ -29,8 +29,8 @@ import java.util.List; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroup; import org.sakaiproject.authz.api.Role; import org.sakaiproject.authz.api.RoleAlreadyDefinedException; @@ -59,7 +59,7 @@ * */ public class GroupPermissionsService { - private static Log log = LogFactory.getLog(GroupPermissionsService.class); + private static Logger log = LoggerFactory.getLogger(GroupPermissionsService.class); static private LessonEntity forumEntity = null; public void setForumEntity(Object e) { diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/JForumEntity.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/JForumEntity.java index fc1d465b4a91..4938af1e135b 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/JForumEntity.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/JForumEntity.java @@ -45,8 +45,8 @@ import org.sakaiproject.tool.cover.ActiveToolManager; import org.sakaiproject.site.cover.SiteService; import org.sakaiproject.component.cover.ServerConfigurationService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.lessonbuildertool.service.LessonSubmission; @@ -77,7 +77,7 @@ public class JForumEntity implements LessonEntity, ForumInterface { - private static final Log log = LogFactory.getLog(JForumEntity.class); + private static final Logger log = LoggerFactory.getLogger(JForumEntity.class); static boolean initdone = false; static boolean haveJforum = false; diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/LessonBuilderAccessService.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/LessonBuilderAccessService.java index 2b2b60c5c8a9..fe8d7160a0b3 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/LessonBuilderAccessService.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/LessonBuilderAccessService.java @@ -40,8 +40,8 @@ import java.text.SimpleDateFormat; import org.apache.commons.io.IOUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.net.SocketException; @@ -113,7 +113,7 @@ public class LessonBuilderAccessService { public static final int CACHE_MAX_ENTRIES = 5000; public static final int CACHE_TIME_TO_LIVE_SECONDS = 600; public static final int CACHE_TIME_TO_IDLE_SECONDS = 360; - private static Log M_log = LogFactory.getLog(LessonBuilderAccessService.class); + private static Logger M_log = LoggerFactory.getLogger(LessonBuilderAccessService.class); public static final String ATTR_SESSION = "sakai.session"; diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/LessonBuilderEntityProducer.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/LessonBuilderEntityProducer.java index ff7511ae9ca4..8cbcb874610e 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/LessonBuilderEntityProducer.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/LessonBuilderEntityProducer.java @@ -52,8 +52,8 @@ import java.lang.reflect.Method; import java.util.regex.PatternSyntaxException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.fileupload.disk.DiskFileItem; import org.sakaiproject.authz.api.SecurityAdvisor; import org.sakaiproject.authz.api.SecurityService; @@ -130,7 +130,7 @@ public class LessonBuilderEntityProducer extends AbstractEntityProvider implements EntityProducer, EntityTransferrer, EntityTransferrerRefMigrator, Serializable, CoreEntityProvider, AutoRegisterEntityProvider, Statisticable, InputTranslatable, Createable, ToolApi { - protected final Log logger = LogFactory.getLog(getClass()); + protected final Logger logger = LoggerFactory.getLogger(getClass()); private static final String ARCHIVE_VERSION = "2.4"; // in case new features are added in future exports private static final String VERSION_ATTR = "version"; @@ -319,7 +319,7 @@ public SecurityAdvice isAllowed(String userId, String function, String reference } catch (Exception e) { - logger.info(e); + logger.info(e.getMessage(), e); } finally { securityService.popAdvisor(); } @@ -1892,7 +1892,7 @@ private String processUrl(ContentCopyContext context, String value, } return uri.toString(); } catch (URISyntaxException e) { - // Log this so we may get an idea of the things that are breaking + // Logger this so we may get an idea of the things that are breaking // the parser. System.err.println("Failed to parse URL: " + value + " " + e.getMessage()); } diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/LessonsAccess.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/LessonsAccess.java index 27e4e3a65a3d..c47f230c0add 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/LessonsAccess.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/LessonsAccess.java @@ -31,8 +31,8 @@ import java.util.Arrays; import java.util.Date; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroup; import org.sakaiproject.authz.api.AuthzGroupService; @@ -76,7 +76,7 @@ public class LessonsAccess { - private Log log = LogFactory.getLog(LessonsAccess.class); + private Logger log = LoggerFactory.getLogger(LessonsAccess.class); // caching private static Cache cache = null; diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/LessonsEntityContentProducer.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/LessonsEntityContentProducer.java index 230771261345..bbf4a7306a5c 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/LessonsEntityContentProducer.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/LessonsEntityContentProducer.java @@ -25,8 +25,8 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.SecurityService; import org.sakaiproject.component.api.ComponentManager; import org.sakaiproject.component.cover.ServerConfigurationService; @@ -60,7 +60,7 @@ public class LessonsEntityContentProducer implements EntityContentProducer { - private static Log log = LogFactory.getLog(LessonsEntityContentProducer.class); + private static Logger log = LoggerFactory.getLogger(LessonsEntityContentProducer.class); static final String REFERENCE_ROOT = Entity.SEPARATOR + "lessonbuilder"; diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/SamigoEntity.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/SamigoEntity.java index 6b12be1015b5..393a7caf395e 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/SamigoEntity.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/SamigoEntity.java @@ -23,8 +23,8 @@ package org.sakaiproject.lessonbuildertool.service; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.db.cover.SqlService; import org.sakaiproject.lessonbuildertool.SimplePageItem; @@ -85,7 +85,7 @@ public class SamigoEntity implements LessonEntity, QuizEntity { - private static Log log = LogFactory.getLog(SamigoEntity.class); + private static Logger log = LoggerFactory.getLogger(SamigoEntity.class); private static Cache assessmentCache = null; protected static final int DEFAULT_EXPIRATION = 10 * 60; @@ -252,7 +252,7 @@ public List getEntitiesInSite(SimplePageBean bean) { } if (false) { // testing - log.info(entity.getGroups(true)); + log.info(entity.getGroups(true).toString()); List oldGroups = entity.getGroups(true); //5c51c1fb-bf48-475f-99a6-a303f5ad9520 //d579a252-204e-46cd-9720-7eca7bd47630 diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/beans/GradingBean.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/beans/GradingBean.java index b51fa828119c..159414829d6f 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/beans/GradingBean.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/beans/GradingBean.java @@ -16,14 +16,14 @@ import org.sakaiproject.lessonbuildertool.service.GradebookIfc; import org.sakaiproject.authz.api.AuthzGroupService; import org.sakaiproject.authz.api.Member; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroup; import org.sakaiproject.tool.cover.SessionManager; public class GradingBean { - private static final Log log = LogFactory.getLog(GradingBean.class); + private static final Logger log = LoggerFactory.getLogger(GradingBean.class); public String id; public String points; public String jsId; diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/beans/ReportHandlerHook.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/beans/ReportHandlerHook.java index 682824f3dfeb..7dd7ddb519a8 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/beans/ReportHandlerHook.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/beans/ReportHandlerHook.java @@ -16,8 +16,8 @@ import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.lessonbuildertool.tool.view.ExportCCViewParameters; import org.sakaiproject.lessonbuildertool.ccexport.CCExport; import org.sakaiproject.tool.cover.ToolManager; @@ -34,7 +34,7 @@ */ public class ReportHandlerHook { - private static Log log = LogFactory.getLog(ReportHandlerHook.class); + private static Logger log = LoggerFactory.getLogger(ReportHandlerHook.class); private ViewParameters viewparams; public void setViewparams(ViewParameters viewparams) { diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/beans/SimplePageBean.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/beans/SimplePageBean.java index 60fe4006b5cb..50bcdba13244 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/beans/SimplePageBean.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/beans/SimplePageBean.java @@ -27,8 +27,8 @@ import java.text.SimpleDateFormat; import java.text.Format; import java.math.BigDecimal; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroup; import org.sakaiproject.authz.api.Member; import org.sakaiproject.authz.api.SecurityAdvisor; @@ -124,7 +124,7 @@ public class SimplePageBean { public static final int CACHE_MAX_ENTRIES = 5000; public static final int CACHE_TIME_TO_LIVE_SECONDS = 600; public static final int CACHE_TIME_TO_IDLE_SECONDS = 360; - private static Log log = LogFactory.getLog(SimplePageBean.class); + private static Logger log = LoggerFactory.getLogger(SimplePageBean.class); public enum Status { NOT_REQUIRED, REQUIRED, DISABLED, COMPLETED, FAILED, NEEDSGRADING @@ -7542,7 +7542,7 @@ private String expandZippedResource(String resourceId) { String relativeUrl = contentCollectionId + index; return relativeUrl; } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); setErrKey("simplepage.website.cantexpand", null); return null; } diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/entityproviders/LessonsEntityProvider.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/entityproviders/LessonsEntityProvider.java index 75764a4914fa..1f9159349ba0 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/entityproviders/LessonsEntityProvider.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/entityproviders/LessonsEntityProvider.java @@ -38,8 +38,8 @@ import lombok.Setter; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.entitybroker.EntityReference; import org.sakaiproject.entitybroker.EntityView; @@ -104,7 +104,7 @@ public class LessonsEntityProvider extends AbstractEntityProvider implements Ent protected final static String CURRENT_TOOL = "sakai:ToolComponent:current.tool"; - private static final Log log = LogFactory.getLog(LessonsEntityProvider.class); + private static final Logger log = LoggerFactory.getLogger(LessonsEntityProvider.class); @Override public String getEntityPrefix() { diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/evolvers/SakaiFCKTextEvolver.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/evolvers/SakaiFCKTextEvolver.java index a034708e34f8..f1afed02bb21 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/evolvers/SakaiFCKTextEvolver.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/evolvers/SakaiFCKTextEvolver.java @@ -9,8 +9,8 @@ import java.util.Iterator; import org.sakaiproject.content.api.ContentHostingService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import uk.org.ponder.htmlutil.HTMLUtil; @@ -24,7 +24,7 @@ import uk.org.ponder.rsf.evolvers.TextInputEvolver; public class SakaiFCKTextEvolver implements TextInputEvolver { - private static final Log log = LogFactory.getLog(SakaiFCKTextEvolver.class); + private static final Logger log = LoggerFactory.getLogger(SakaiFCKTextEvolver.class); public static final String COMPONENT_ID = "sakai-FCKEditor:"; private String context; private ContentHostingService contentHostingService; diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/AssignmentPickerProducer.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/AssignmentPickerProducer.java index 59b4f096f2ef..66d449ac4558 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/AssignmentPickerProducer.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/AssignmentPickerProducer.java @@ -30,8 +30,8 @@ import org.sakaiproject.lessonbuildertool.service.LessonEntity; import org.sakaiproject.tool.cover.SessionManager; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.lessonbuildertool.SimplePage; import org.sakaiproject.lessonbuildertool.SimplePageItem; import org.sakaiproject.lessonbuildertool.tool.beans.SimplePageBean; @@ -69,7 +69,7 @@ * */ public class AssignmentPickerProducer implements ViewComponentProducer, NavigationCaseReporter, ViewParamsReporter { - private static final Log log = LogFactory.getLog(AssignmentPickerProducer.class); + private static final Logger log = LoggerFactory.getLogger(AssignmentPickerProducer.class); public static final String VIEW_ID = "AssignmentPicker"; private SimplePageBean simplePageBean; diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/BltiPickerProducer.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/BltiPickerProducer.java index 38338330b3d5..b2219a7e2122 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/BltiPickerProducer.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/BltiPickerProducer.java @@ -41,8 +41,8 @@ import org.sakaiproject.tool.cover.SessionManager; import org.sakaiproject.tool.cover.ToolManager; import org.sakaiproject.lessonbuildertool.model.SimplePageToolDao; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.portal.util.ToolUtils; @@ -79,7 +79,7 @@ * */ public class BltiPickerProducer implements ViewComponentProducer, NavigationCaseReporter, ViewParamsReporter { - private static final Log log = LogFactory.getLog(BltiPickerProducer.class); + private static final Logger log = LoggerFactory.getLogger(BltiPickerProducer.class); public static final String VIEW_ID = "BltiPicker"; private SimplePageBean simplePageBean; diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/ChecklistProgressProducer.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/ChecklistProgressProducer.java index e358b69f2026..91eca2a2f723 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/ChecklistProgressProducer.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/ChecklistProgressProducer.java @@ -22,8 +22,8 @@ package org.sakaiproject.lessonbuildertool.tool.producers; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroup; import org.sakaiproject.authz.api.AuthzGroupService; import org.sakaiproject.authz.api.GroupNotDefinedException; @@ -53,7 +53,7 @@ import java.util.*; public class ChecklistProgressProducer implements ViewComponentProducer, NavigationCaseReporter, ViewParamsReporter { - private static Log log = LogFactory.getLog(ChecklistProgressProducer.class); + private static Logger log = LoggerFactory.getLogger(ChecklistProgressProducer.class); private SimplePageBean simplePageBean; private ShowPageProducer showPageProducer; @@ -266,4 +266,4 @@ public List reportNavigationCases() { return togo; } -} \ No newline at end of file +} diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/CommentsProducer.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/CommentsProducer.java index d29f1661f1cd..b32b7723e2ed 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/CommentsProducer.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/CommentsProducer.java @@ -14,8 +14,8 @@ import org.sakaiproject.lessonbuildertool.SimplePageComment; import org.sakaiproject.lessonbuildertool.SimplePageItem; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.lessonbuildertool.SimplePage; import org.sakaiproject.lessonbuildertool.SimplePageLogEntry; import org.sakaiproject.lessonbuildertool.SimpleStudentPage; @@ -50,7 +50,7 @@ import uk.org.ponder.rsf.viewstate.ViewParamsReporter; public class CommentsProducer implements ViewComponentProducer, ViewParamsReporter, NavigationCaseReporter { - private static final Log log = LogFactory.getLog(CommentsProducer.class); + private static final Logger log = LoggerFactory.getLogger(CommentsProducer.class); public static final String VIEW_ID = "Comments"; private SimplePageBean simplePageBean; diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/EditPageProducer.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/EditPageProducer.java index 21ed71be962b..0bb35fea9d44 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/EditPageProducer.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/EditPageProducer.java @@ -65,8 +65,8 @@ import uk.org.ponder.rsf.viewstate.ViewParameters; import uk.org.ponder.rsf.viewstate.ViewParamsReporter; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.content.cover.ContentHostingService; import org.sakaiproject.exception.IdUnusedException; @@ -80,7 +80,7 @@ */ public class EditPageProducer implements ViewComponentProducer, NavigationCaseReporter, ViewParamsReporter { - private static final Log log = LogFactory.getLog(EditPageProducer.class); + private static final Logger log = LoggerFactory.getLogger(EditPageProducer.class); private TextInputEvolver richTextEvolver; private SimplePageBean simplePageBean; private ShowPageProducer showPageProducer; diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/ForumPickerProducer.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/ForumPickerProducer.java index a3360e7c488c..10c04c9dc8c2 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/ForumPickerProducer.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/ForumPickerProducer.java @@ -28,8 +28,8 @@ import java.util.List; import org.sakaiproject.lessonbuildertool.service.LessonEntity; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.lessonbuildertool.SimplePage; import org.sakaiproject.lessonbuildertool.SimplePageItem; import org.sakaiproject.lessonbuildertool.tool.beans.SimplePageBean; @@ -66,7 +66,7 @@ * */ public class ForumPickerProducer implements ViewComponentProducer, NavigationCaseReporter, ViewParamsReporter { - private static final Log log = LogFactory.getLog(ForumPickerProducer.class); + private static final Logger log = LoggerFactory.getLogger(ForumPickerProducer.class); public static final String VIEW_ID = "ForumPicker"; private SimplePageBean simplePageBean; diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/IFrameWindowProducer.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/IFrameWindowProducer.java index 0e1337865636..778376178a8c 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/IFrameWindowProducer.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/IFrameWindowProducer.java @@ -24,8 +24,8 @@ package org.sakaiproject.lessonbuildertool.tool.producers; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.lessonbuildertool.tool.beans.SimplePageBean; import org.sakaiproject.lessonbuildertool.tool.view.GeneralViewParameters; @@ -46,7 +46,7 @@ */ public class IFrameWindowProducer implements ViewComponentProducer, ViewParamsReporter { - private static final Log log = LogFactory.getLog(IFrameWindowProducer.class); + private static final Logger log = LoggerFactory.getLogger(IFrameWindowProducer.class); private SimplePageBean simplePageBean; public LocaleGetter localeGetter; diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/LinkTrackerProducer.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/LinkTrackerProducer.java index 7e6f9d9b932d..71ded979152b 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/LinkTrackerProducer.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/LinkTrackerProducer.java @@ -44,12 +44,12 @@ import uk.org.ponder.rsf.viewstate.ViewParameters; import uk.org.ponder.rsf.viewstate.ViewParamsReporter; import org.apache.commons.lang.StringEscapeUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class LinkTrackerProducer implements ViewComponentProducer, ViewParamsReporter { - private static final Log log = LogFactory.getLog(LinkTrackerProducer.class); + private static final Logger log = LoggerFactory.getLogger(LinkTrackerProducer.class); public static final String VIEW_ID = "LinkTracker"; public String getViewID() { @@ -131,4 +131,4 @@ public static UIInternalLink make(UIContainer container, String ID, String name, public ViewParameters getViewParameters() { return new TrackerViewParameters(); } -} \ No newline at end of file +} diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/LtiFileItemProducer.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/LtiFileItemProducer.java index b8c643e7b5d7..116034abb664 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/LtiFileItemProducer.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/LtiFileItemProducer.java @@ -47,8 +47,8 @@ import org.sakaiproject.portal.util.ToolUtils; import org.sakaiproject.lti.api.LTIService; import org.tsugi.lti2.ContentItem; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.basiclti.util.SakaiBLTIUtil; import org.sakaiproject.tool.api.ToolManager; import org.sakaiproject.tool.api.Placement; @@ -85,7 +85,7 @@ * */ public class LtiFileItemProducer implements ViewComponentProducer, NavigationCaseReporter, ViewParamsReporter { - private static final Log log = LogFactory.getLog(LtiFileItemProducer.class); + private static final Logger log = LoggerFactory.getLogger(LtiFileItemProducer.class); public static final String VIEW_ID = "LtiFileItem"; private SimplePageBean simplePageBean; diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/PagePickerProducer.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/PagePickerProducer.java index 8ab59ddce0e4..be68339ad7dc 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/PagePickerProducer.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/PagePickerProducer.java @@ -43,8 +43,8 @@ import org.sakaiproject.lessonbuildertool.tool.beans.SimplePageBean; import org.sakaiproject.lessonbuildertool.tool.view.GeneralViewParameters; import org.sakaiproject.lessonbuildertool.model.SimplePageToolDao; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.content.cover.ContentTypeImageService; import org.sakaiproject.tool.api.ToolManager; @@ -86,7 +86,7 @@ * */ public class PagePickerProducer implements ViewComponentProducer, NavigationCaseReporter, ViewParamsReporter { - private static final Log log = LogFactory.getLog(PagePickerProducer.class); + private static final Logger log = LoggerFactory.getLogger(PagePickerProducer.class); public static final String VIEW_ID = "PagePicker"; private static String SITE_UPD = "site.upd"; diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/PeerEvalStatsProducer.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/PeerEvalStatsProducer.java index 4d3be6fbefc7..c24c55dab62c 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/PeerEvalStatsProducer.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/PeerEvalStatsProducer.java @@ -54,8 +54,8 @@ import org.sakaiproject.user.cover.UserDirectoryService; import org.sakaiproject.time.cover.TimeService; import org.sakaiproject.util.ResourceLoader; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.cover.SecurityService; import uk.org.ponder.messageutil.MessageLocator; @@ -76,7 +76,7 @@ import uk.org.ponder.rsf.viewstate.ViewParamsReporter; public class PeerEvalStatsProducer implements ViewComponentProducer, ViewParamsReporter, NavigationCaseReporter { - private static final Log log = LogFactory.getLog(PeerEvalStatsProducer.class); + private static final Logger log = LoggerFactory.getLogger(PeerEvalStatsProducer.class); public static final String VIEW_ID = "PeerEvalStats"; private SimplePageBean simplePageBean; diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/PreviewProducer.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/PreviewProducer.java index d4a0938dbd2c..522fe4dcf942 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/PreviewProducer.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/PreviewProducer.java @@ -26,8 +26,8 @@ import java.util.ArrayList; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.lessonbuildertool.SimplePage; import org.sakaiproject.lessonbuildertool.SimplePageItem; import org.sakaiproject.lessonbuildertool.model.SimplePageToolDao; @@ -61,7 +61,7 @@ * */ public class PreviewProducer implements ViewComponentProducer, NavigationCaseReporter, ViewParamsReporter { - private static final Log log = LogFactory.getLog(PreviewProducer.class); + private static final Logger log = LoggerFactory.getLogger(PreviewProducer.class); private SimplePageBean simplePageBean; private SimplePageToolDao simplePageToolDao; private ShowPageProducer showPageProducer; diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/QuizPickerProducer.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/QuizPickerProducer.java index 88e72c64c07d..31d1ff7840ad 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/QuizPickerProducer.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/QuizPickerProducer.java @@ -28,8 +28,8 @@ import org.sakaiproject.lessonbuildertool.service.LessonEntity; import org.sakaiproject.tool.cover.SessionManager; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.lessonbuildertool.SimplePage; import org.sakaiproject.lessonbuildertool.SimplePageItem; import org.sakaiproject.lessonbuildertool.tool.beans.SimplePageBean; @@ -69,7 +69,7 @@ * */ public class QuizPickerProducer implements ViewComponentProducer, NavigationCaseReporter, ViewParamsReporter { - private static final Log log = LogFactory.getLog(QuizPickerProducer.class); + private static final Logger log = LoggerFactory.getLogger(QuizPickerProducer.class); public static final String VIEW_ID = "QuizPicker"; private SimplePageBean simplePageBean; diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/ReorderProducer.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/ReorderProducer.java index 8ba384f140a2..ec1143b8d3c4 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/ReorderProducer.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/ReorderProducer.java @@ -27,8 +27,8 @@ import java.util.List; import org.sakaiproject.util.FormattedText; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.lessonbuildertool.SimplePage; import org.sakaiproject.lessonbuildertool.SimplePageItem; import org.sakaiproject.lessonbuildertool.model.SimplePageToolDao; @@ -67,7 +67,7 @@ * */ public class ReorderProducer implements ViewComponentProducer, NavigationCaseReporter, ViewParamsReporter { - private static final Log log = LogFactory.getLog(ReorderProducer.class); + private static final Logger log = LoggerFactory.getLogger(ReorderProducer.class); private SimplePageBean simplePageBean; private SimplePageToolDao simplePageToolDao; private ShowPageProducer showPageProducer; diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/ResourcePickerProducer.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/ResourcePickerProducer.java index f07cdb418cdf..34c0edbb5147 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/ResourcePickerProducer.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/ResourcePickerProducer.java @@ -27,8 +27,8 @@ import java.util.ArrayList; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.content.api.ContentHostingService; import org.sakaiproject.content.api.FilePickerHelper; @@ -63,7 +63,7 @@ * */ public class ResourcePickerProducer implements ViewComponentProducer, ViewParamsReporter, NavigationCaseReporter { - private static final Log log = LogFactory.getLog(ResourcePickerProducer.class); + private static final Logger log = LoggerFactory.getLogger(ResourcePickerProducer.class); public static final String VIEW_ID = "ResourcePicker"; public String getViewID() { diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/ShowPageProducer.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/ShowPageProducer.java index 0e428fa8ef6f..34b707b5ff02 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/ShowPageProducer.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/ShowPageProducer.java @@ -66,8 +66,8 @@ import javax.crypto.spec.SecretKeySpec; import javax.xml.bind.DatatypeConverter; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.content.api.ContentHostingService; @@ -164,7 +164,7 @@ * @author Eric Jeney */ public class ShowPageProducer implements ViewComponentProducer, DefaultView, NavigationCaseReporter, ViewParamsReporter { - private static Log log = LogFactory.getLog(ShowPageProducer.class); + private static Logger log = LoggerFactory.getLogger(ShowPageProducer.class); String reqStar = "*"; diff --git a/lessonbuilder/tool/src29/java/org/sakaiproject/lessonbuildertool/service/LessonsGradeInfoProvider.java b/lessonbuilder/tool/src29/java/org/sakaiproject/lessonbuildertool/service/LessonsGradeInfoProvider.java index 1a0d4f832d68..20865e365f96 100644 --- a/lessonbuilder/tool/src29/java/org/sakaiproject/lessonbuildertool/service/LessonsGradeInfoProvider.java +++ b/lessonbuilder/tool/src29/java/org/sakaiproject/lessonbuildertool/service/LessonsGradeInfoProvider.java @@ -21,8 +21,8 @@ package org.sakaiproject.lessonbuildertool.service; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroup; import org.sakaiproject.authz.api.AuthzGroupService; import org.sakaiproject.authz.api.SecurityService; @@ -44,7 +44,7 @@ public class LessonsGradeInfoProvider implements ExternalAssignmentProvider { - private Log log = LogFactory.getLog(LessonsGradeInfoProvider.class); + private Logger log = LoggerFactory.getLogger(LessonsGradeInfoProvider.class); // caching private static Cache cache = null; diff --git a/login/login-authn-tool/tool/src/java/org/sakaiproject/login/tool/AuthnPortal.java b/login/login-authn-tool/tool/src/java/org/sakaiproject/login/tool/AuthnPortal.java index 14bacc623430..7a5dfb1d2442 100644 --- a/login/login-authn-tool/tool/src/java/org/sakaiproject/login/tool/AuthnPortal.java +++ b/login/login-authn-tool/tool/src/java/org/sakaiproject/login/tool/AuthnPortal.java @@ -30,8 +30,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.tool.api.ActiveTool; import org.sakaiproject.tool.api.Placement; @@ -54,7 +54,7 @@ public class AuthnPortal extends HttpServlet { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(AuthnPortal.class); + private static Logger M_log = LoggerFactory.getLogger(AuthnPortal.class); /** messages. */ private static ResourceLoader rb = new ResourceLoader("sitenav"); diff --git a/login/login-render-engine-impl/impl/src/java/org/sakaiproject/login/impl/velocity/LoginRenderEngineContextListener.java b/login/login-render-engine-impl/impl/src/java/org/sakaiproject/login/impl/velocity/LoginRenderEngineContextListener.java index b5ab1b4c587a..c6d9b839a0fd 100644 --- a/login/login-render-engine-impl/impl/src/java/org/sakaiproject/login/impl/velocity/LoginRenderEngineContextListener.java +++ b/login/login-render-engine-impl/impl/src/java/org/sakaiproject/login/impl/velocity/LoginRenderEngineContextListener.java @@ -23,8 +23,8 @@ import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.login.api.Login; import org.sakaiproject.login.cover.LoginService; @@ -37,7 +37,7 @@ */ public class LoginRenderEngineContextListener implements ServletContextListener { - private static final Log log = LogFactory.getLog(LoginRenderEngineContextListener.class); + private static final Logger log = LoggerFactory.getLogger(LoginRenderEngineContextListener.class); private VelocityLoginRenderEngine vengine; diff --git a/login/login-render-engine-impl/impl/src/java/org/sakaiproject/login/impl/velocity/VelocityLoginRenderContext.java b/login/login-render-engine-impl/impl/src/java/org/sakaiproject/login/impl/velocity/VelocityLoginRenderContext.java index 62f9cfc340a3..dd65ca171050 100644 --- a/login/login-render-engine-impl/impl/src/java/org/sakaiproject/login/impl/velocity/VelocityLoginRenderContext.java +++ b/login/login-render-engine-impl/impl/src/java/org/sakaiproject/login/impl/velocity/VelocityLoginRenderContext.java @@ -4,8 +4,8 @@ import java.util.Iterator; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.velocity.VelocityContext; import org.apache.velocity.context.Context; import org.sakaiproject.login.api.LoginRenderContext; @@ -15,7 +15,7 @@ public class VelocityLoginRenderContext implements LoginRenderContext { // Logging - private static final Log log = LogFactory.getLog(VelocityLoginRenderContext.class); + private static final Logger log = LoggerFactory.getLogger(VelocityLoginRenderContext.class); // Member variables diff --git a/login/login-render-engine-impl/impl/src/java/org/sakaiproject/login/impl/velocity/VelocityLoginRenderEngine.java b/login/login-render-engine-impl/impl/src/java/org/sakaiproject/login/impl/velocity/VelocityLoginRenderEngine.java index 168ba3afdee4..67d1812034e9 100644 --- a/login/login-render-engine-impl/impl/src/java/org/sakaiproject/login/impl/velocity/VelocityLoginRenderEngine.java +++ b/login/login-render-engine-impl/impl/src/java/org/sakaiproject/login/impl/velocity/VelocityLoginRenderEngine.java @@ -13,8 +13,8 @@ import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.velocity.app.VelocityEngine; import org.apache.velocity.context.Context; import org.apache.velocity.runtime.RuntimeConstants; @@ -28,7 +28,7 @@ public class VelocityLoginRenderEngine implements LoginRenderEngine { // Logging - private static final Log log = LogFactory.getLog(VelocityLoginRenderEngine.class); + private static final Logger log = LoggerFactory.getLogger(VelocityLoginRenderEngine.class); // Member variables private List availableLoginSkins; diff --git a/login/login-tool/tool/src/java/org/sakaiproject/login/springframework/SafeDelegatingFilterProxy.java b/login/login-tool/tool/src/java/org/sakaiproject/login/springframework/SafeDelegatingFilterProxy.java index 2a2f424306e7..77733c6a152c 100644 --- a/login/login-tool/tool/src/java/org/sakaiproject/login/springframework/SafeDelegatingFilterProxy.java +++ b/login/login-tool/tool/src/java/org/sakaiproject/login/springframework/SafeDelegatingFilterProxy.java @@ -27,8 +27,8 @@ import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.filter.DelegatingFilterProxy; @@ -46,7 +46,7 @@ * To change this template use File | Settings | File Templates. */ public class SafeDelegatingFilterProxy extends DelegatingFilterProxy { - private static Log log = LogFactory.getLog(SafeDelegatingFilterProxy.class); + private static Logger log = LoggerFactory.getLogger(SafeDelegatingFilterProxy.class); private final Object delegateMonitor = new Object(); private boolean enabled = false; diff --git a/login/login-tool/tool/src/java/org/sakaiproject/login/tool/ContainerLogin.java b/login/login-tool/tool/src/java/org/sakaiproject/login/tool/ContainerLogin.java index ee92b912d914..be74c5b734b5 100644 --- a/login/login-tool/tool/src/java/org/sakaiproject/login/tool/ContainerLogin.java +++ b/login/login-tool/tool/src/java/org/sakaiproject/login/tool/ContainerLogin.java @@ -29,8 +29,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.event.cover.UsageSessionService; import org.sakaiproject.tool.api.Session; @@ -52,7 +52,7 @@ public class ContainerLogin extends HttpServlet private static final long serialVersionUID = -3589514330633190919L; /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(ContainerLogin.class); + private static Logger M_log = LoggerFactory.getLogger(ContainerLogin.class); private String defaultReturnUrl; diff --git a/login/login-tool/tool/src/java/org/sakaiproject/login/tool/ContainerLogout.java b/login/login-tool/tool/src/java/org/sakaiproject/login/tool/ContainerLogout.java index 3f524edf0bd6..1eea6d2397d5 100644 --- a/login/login-tool/tool/src/java/org/sakaiproject/login/tool/ContainerLogout.java +++ b/login/login-tool/tool/src/java/org/sakaiproject/login/tool/ContainerLogout.java @@ -8,8 +8,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.event.api.UsageSessionService; @@ -25,7 +25,7 @@ public class ContainerLogout extends HttpServlet { /** Our log (commons). */ - private static final Log M_log = LogFactory.getLog(ContainerLogin.class); + private static final Logger M_log = LoggerFactory.getLogger(ContainerLogin.class); private ServerConfigurationService serverConfigurationService; private UsageSessionService usageSessionService; diff --git a/login/login-tool/tool/src/java/org/sakaiproject/login/tool/SkinnableLogin.java b/login/login-tool/tool/src/java/org/sakaiproject/login/tool/SkinnableLogin.java index 848075319916..f5ddbe538bc1 100644 --- a/login/login-tool/tool/src/java/org/sakaiproject/login/tool/SkinnableLogin.java +++ b/login/login-tool/tool/src/java/org/sakaiproject/login/tool/SkinnableLogin.java @@ -34,8 +34,8 @@ import org.apache.commons.lang.StringEscapeUtils; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.event.cover.UsageSessionService; @@ -63,7 +63,7 @@ public class SkinnableLogin extends HttpServlet implements Login { private static final long serialVersionUID = 1L; /** Our log (commons). */ - private static Log log = LogFactory.getLog(SkinnableLogin.class); + private static Logger log = LoggerFactory.getLogger(SkinnableLogin.class); // Service instance variables private AuthzGroupService authzGroupService = ComponentManager.get(AuthzGroupService.class); diff --git a/mailarchive/mailarchive-impl/impl/src/java/org/sakaiproject/mailarchive/impl/BaseMailArchiveService.java b/mailarchive/mailarchive-impl/impl/src/java/org/sakaiproject/mailarchive/impl/BaseMailArchiveService.java index 34d63f96bb1e..4e1c183f971a 100644 --- a/mailarchive/mailarchive-impl/impl/src/java/org/sakaiproject/mailarchive/impl/BaseMailArchiveService.java +++ b/mailarchive/mailarchive-impl/impl/src/java/org/sakaiproject/mailarchive/impl/BaseMailArchiveService.java @@ -27,8 +27,8 @@ import java.util.Vector; import javax.mail.internet.MimeUtility; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.alias.api.AliasService; import org.sakaiproject.authz.cover.FunctionManager; import org.sakaiproject.authz.cover.SecurityService; @@ -79,7 +79,7 @@ public abstract class BaseMailArchiveService extends BaseMessage implements MailArchiveService, ContextObserver { /** Our logger. */ - private static Log M_log = LogFactory.getLog(BaseMailArchiveService.class); + private static Logger M_log = LoggerFactory.getLogger(BaseMailArchiveService.class); /********************************************************************************************************************************************************************************************************************************************************** * Constructors, Dependencies and their setter methods diff --git a/mailarchive/mailarchive-impl/impl/src/java/org/sakaiproject/mailarchive/impl/DbMailArchiveService.java b/mailarchive/mailarchive-impl/impl/src/java/org/sakaiproject/mailarchive/impl/DbMailArchiveService.java index b8052fde350e..b6a7c7c66897 100644 --- a/mailarchive/mailarchive-impl/impl/src/java/org/sakaiproject/mailarchive/impl/DbMailArchiveService.java +++ b/mailarchive/mailarchive-impl/impl/src/java/org/sakaiproject/mailarchive/impl/DbMailArchiveService.java @@ -26,8 +26,8 @@ import java.util.List; import org.apache.commons.codec.binary.Base64; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.db.api.SqlReader; import org.sakaiproject.db.api.SqlService; import org.sakaiproject.javax.Filter; @@ -55,7 +55,7 @@ public class DbMailArchiveService extends BaseMailArchiveService { /** Our logger. */ - private static Log M_log = LogFactory.getLog(DbMailArchiveService.class); + private static Logger M_log = LoggerFactory.getLogger(DbMailArchiveService.class); /** The name of the db table holding mail archive channels. */ protected String m_cTableName = "MAILARCHIVE_CHANNEL"; diff --git a/mailarchive/mailarchive-james/james/src/java/org/sakaiproject/james/JamesServlet.java b/mailarchive/mailarchive-james/james/src/java/org/sakaiproject/james/JamesServlet.java index 1ae3443c7f35..beba42b39455 100644 --- a/mailarchive/mailarchive-james/james/src/java/org/sakaiproject/james/JamesServlet.java +++ b/mailarchive/mailarchive-james/james/src/java/org/sakaiproject/james/JamesServlet.java @@ -38,8 +38,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.apache.commons.lang.StringUtils; @@ -63,7 +63,7 @@ public class JamesServlet extends HttpServlet { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(JamesServlet.class); + private static Logger M_log = LoggerFactory.getLogger(JamesServlet.class); /** config variable and system property for the james / phoenix home. */ private final static String PHOENIX_HOME = "phoenix.home"; diff --git a/mailarchive/mailarchive-james/james/src/java/org/sakaiproject/james/PhoenixLauncherMain.java b/mailarchive/mailarchive-james/james/src/java/org/sakaiproject/james/PhoenixLauncherMain.java index bcc6ffed2f73..469556c49a0b 100644 --- a/mailarchive/mailarchive-james/james/src/java/org/sakaiproject/james/PhoenixLauncherMain.java +++ b/mailarchive/mailarchive-james/james/src/java/org/sakaiproject/james/PhoenixLauncherMain.java @@ -33,8 +33,8 @@ import java.util.Map; import java.util.StringTokenizer; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** Taken from the phoenix 4.0.4 org.apache.avalon.phoenix.launcher.Main.java */ /* @@ -49,7 +49,7 @@ public final class PhoenixLauncherMain { /** Our logger. */ - private static Log M_log = LogFactory.getLog(PhoenixLauncherMain.class); + private static Logger M_log = LoggerFactory.getLogger(PhoenixLauncherMain.class); private static final String MAIN_CLASS = "org.apache.avalon.phoenix.frontends.CLIMain"; diff --git a/mailarchive/mailarchive-james/james/src/java/org/sakaiproject/james/SakaiMailet.java b/mailarchive/mailarchive-james/james/src/java/org/sakaiproject/james/SakaiMailet.java index 8f1e99c49898..166e9d5ac658 100644 --- a/mailarchive/mailarchive-james/james/src/java/org/sakaiproject/james/SakaiMailet.java +++ b/mailarchive/mailarchive-james/james/src/java/org/sakaiproject/james/SakaiMailet.java @@ -46,8 +46,8 @@ import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.mailet.GenericMailet; import org.apache.mailet.Mail; import org.apache.mailet.MailAddress; @@ -87,7 +87,7 @@ public class SakaiMailet extends GenericMailet private static ResourceLoader rb = new ResourceLoader("sakaimailet"); /** Our logger. */ - private static Log M_log = LogFactory.getLog(SakaiMailet.class); + private static Logger M_log = LoggerFactory.getLogger(SakaiMailet.class); /** The user name of the postmaster user - the one who posts incoming mail. */ public static final String POSTMASTER = "postmaster"; diff --git a/mailarchive/mailarchive-subetha/src/java/org/sakaiproject/mailarchive/SakaiMessageHandlerFactory.java b/mailarchive/mailarchive-subetha/src/java/org/sakaiproject/mailarchive/SakaiMessageHandlerFactory.java index 14d6bc503ad1..9946f4b749b4 100644 --- a/mailarchive/mailarchive-subetha/src/java/org/sakaiproject/mailarchive/SakaiMessageHandlerFactory.java +++ b/mailarchive/mailarchive-subetha/src/java/org/sakaiproject/mailarchive/SakaiMessageHandlerFactory.java @@ -2,8 +2,8 @@ import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.alias.api.AliasService; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.content.api.ContentHostingService; @@ -51,7 +51,7 @@ */ public class SakaiMessageHandlerFactory implements MessageHandlerFactory { - private Log log = LogFactory.getLog(SakaiMessageHandlerFactory.class); + private Logger log = LoggerFactory.getLogger(SakaiMessageHandlerFactory.class); /** * The user name of the postmaster user - the one who posts incoming mail. diff --git a/mailarchive/mailarchive-tool/tool/src/java/org/sakaiproject/mailarchive/entityprovider/MailArchiveEntityProvider.java b/mailarchive/mailarchive-tool/tool/src/java/org/sakaiproject/mailarchive/entityprovider/MailArchiveEntityProvider.java index e8d5a8e55f5c..1ef945c9753c 100644 --- a/mailarchive/mailarchive-tool/tool/src/java/org/sakaiproject/mailarchive/entityprovider/MailArchiveEntityProvider.java +++ b/mailarchive/mailarchive-tool/tool/src/java/org/sakaiproject/mailarchive/entityprovider/MailArchiveEntityProvider.java @@ -36,8 +36,8 @@ import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.math.NumberUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.mailarchive.api.MailArchiveChannel; import org.sakaiproject.mailarchive.api.MailArchiveMessage; import org.sakaiproject.mailarchive.api.MailArchiveMessageHeader; @@ -92,8 +92,7 @@ public class MailArchiveEntityProvider extends AbstractEntityProvider implements public final static String ENTITY_PREFIX = "mailarchive"; - private static final Log log = LogFactory - .getLog(MailArchiveEntityProvider.class); + private static final Logger log = LoggerFactory.getLogger(MailArchiveEntityProvider.class); private static ResourceLoader rb = new ResourceLoader("email"); public static int DEFAULT_NUM_MAILMESSAGES = 3; public static int DEFAULT_DAYS_IN_PAST = 10; diff --git a/mailarchive/mailarchive-tool/tool/src/java/org/sakaiproject/mailarchive/tool/MailboxAction.java b/mailarchive/mailarchive-tool/tool/src/java/org/sakaiproject/mailarchive/tool/MailboxAction.java index 81117d616152..6d5e4b315d64 100644 --- a/mailarchive/mailarchive-tool/tool/src/java/org/sakaiproject/mailarchive/tool/MailboxAction.java +++ b/mailarchive/mailarchive-tool/tool/src/java/org/sakaiproject/mailarchive/tool/MailboxAction.java @@ -27,6 +27,7 @@ import java.util.Vector; import java.util.Map.Entry; +import lombok.extern.slf4j.Slf4j; import org.sakaiproject.alias.api.Alias; import org.sakaiproject.alias.api.AliasService; import org.sakaiproject.authz.api.PermissionsHelper; @@ -75,6 +76,7 @@ * MailboxAction is a the Sakai mailbox tool. *

*/ +@Slf4j public class MailboxAction extends PagedResourceActionII { private static ResourceLoader rb = new ResourceLoader("email"); @@ -200,7 +202,7 @@ protected int sizeResources(SessionState state) } catch (Exception e) { - Log.warn("sakai", "sizeResources failed search="+search+" exeption="+e); + log.warn("failed search={} exeption={}", search, e.getMessage()); } return 0; } @@ -237,8 +239,7 @@ else if ( sort == SORT_SUBJECT ) } catch (Exception e) { - Log.warn("sakai", "readResourcesPage not able to retrieve messages sort ="+ - sort+" search = "+search+" first="+first+" last="+last); + log.warn("not able to retrieve messages sort={} search={} first={} last={}", sort, search, first, last); } // deal with no messages @@ -344,7 +345,7 @@ else if (MODE_OPTIONS.equals(mode)) else { - Log.warn("sakai", this + ".buildMainPanelContext: invalid mode: " + mode); + log.warn("invalid mode: {}", mode); return null; } @@ -390,7 +391,7 @@ private String buildViewModeContext(VelocityPortlet portlet, Context context, Ru } catch (Exception e) { - Log.warn("sakai", "Cannot find channel "+channelRef); + log.warn("Cannot find channel {}", channelRef); } // Read a single message @@ -402,7 +403,7 @@ private String buildViewModeContext(VelocityPortlet portlet, Context context, Ru // Sadly this is the only way to send this to a menu pick :( state.setAttribute(STATE_DELETE_CONFIRM_ID, msg.getId()); } else { - Log.warn("sakai", "Could not retrieve message "+channelRef); + log.warn("Could not retrieve message {}", channelRef); context.put("message", rb.getString("thiemames1")); } diff --git a/mailsender/impl/src/java/org/sakaiproject/mailsender/logic/impl/ComposeLogicImpl.java b/mailsender/impl/src/java/org/sakaiproject/mailsender/logic/impl/ComposeLogicImpl.java index e6e1bb6d348a..8b79a318009e 100644 --- a/mailsender/impl/src/java/org/sakaiproject/mailsender/logic/impl/ComposeLogicImpl.java +++ b/mailsender/impl/src/java/org/sakaiproject/mailsender/logic/impl/ComposeLogicImpl.java @@ -28,8 +28,8 @@ import java.util.Set; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroup; import org.sakaiproject.authz.api.AuthzGroupService; import org.sakaiproject.authz.api.GroupNotDefinedException; @@ -49,7 +49,7 @@ public class ComposeLogicImpl implements ComposeLogic { - private static final Log log = LogFactory.getLog(ComposeLogicImpl.class); + private static final Logger log = LoggerFactory.getLogger(ComposeLogicImpl.class); private static final int NUMBER_ROLES = 15; protected SiteService siteService; @@ -560,4 +560,4 @@ public int compare(User user1, User user2) return collator.compare(displayName1, displayName2); } } -} \ No newline at end of file +} diff --git a/mailsender/impl/src/java/org/sakaiproject/mailsender/logic/impl/ExternalLogicImpl.java b/mailsender/impl/src/java/org/sakaiproject/mailsender/logic/impl/ExternalLogicImpl.java index 27a5d4547a85..c4b60c37db5a 100644 --- a/mailsender/impl/src/java/org/sakaiproject/mailsender/logic/impl/ExternalLogicImpl.java +++ b/mailsender/impl/src/java/org/sakaiproject/mailsender/logic/impl/ExternalLogicImpl.java @@ -28,8 +28,8 @@ import javax.mail.MessagingException; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.FunctionManager; import org.sakaiproject.authz.api.SecurityService; import org.sakaiproject.component.api.ServerConfigurationService; @@ -67,7 +67,7 @@ */ public class ExternalLogicImpl implements ExternalLogic { - private static Log log = LogFactory.getLog(ExternalLogicImpl.class); + private static Logger log = LoggerFactory.getLogger(ExternalLogicImpl.class); // external service references private FunctionManager functionManager; diff --git a/mailsender/tool/src/java/org/sakaiproject/mailsender/tool/beans/EmailBean.java b/mailsender/tool/src/java/org/sakaiproject/mailsender/tool/beans/EmailBean.java index bd49a3bcf9b7..7290861be5bb 100644 --- a/mailsender/tool/src/java/org/sakaiproject/mailsender/tool/beans/EmailBean.java +++ b/mailsender/tool/src/java/org/sakaiproject/mailsender/tool/beans/EmailBean.java @@ -26,8 +26,8 @@ import java.util.Map; import java.util.Map.Entry; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.email.api.Attachment; import org.sakaiproject.exception.IdUnusedException; @@ -54,7 +54,7 @@ public class EmailBean public static final String EMAIL_CANCELLED = "emailCancelled"; private Map multipartMap; - private final Log log = LogFactory.getLog(EmailBean.class); + private final Logger log = LoggerFactory.getLogger(EmailBean.class); private ComposeLogic composeLogic; private ConfigLogic configLogic; private ExternalLogic externalLogic; @@ -260,7 +260,7 @@ public String sendEmail() catch (MailsenderException me) { //Print this exception - log.warn(me); + log.warn(me.getMessage()); messages.clear(); List> msgs = me.getMessages(); if (msgs != null) diff --git a/mailsender/tool/src/java/org/sakaiproject/mailsender/tool/producers/fragments/UserGroupingProducer.java b/mailsender/tool/src/java/org/sakaiproject/mailsender/tool/producers/fragments/UserGroupingProducer.java index 73b4bd999fcc..aa38c72fe9d6 100644 --- a/mailsender/tool/src/java/org/sakaiproject/mailsender/tool/producers/fragments/UserGroupingProducer.java +++ b/mailsender/tool/src/java/org/sakaiproject/mailsender/tool/producers/fragments/UserGroupingProducer.java @@ -18,8 +18,8 @@ import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.GroupNotDefinedException; import org.sakaiproject.exception.IdUnusedException; import org.sakaiproject.mailsender.logic.ComposeLogic; @@ -54,7 +54,7 @@ public class UserGroupingProducer implements ViewComponentProducer, ViewParamsRe { public static final String VIEW_ID = "userGroup"; - private final Log log = LogFactory.getLog(UserGroupingProducer.class); + private final Logger log = LoggerFactory.getLogger(UserGroupingProducer.class); private ComposeLogic composeLogic; private TargettedMessageList messages; private ViewStateHandler viewStateHandler; @@ -273,4 +273,4 @@ public ViewParameters getViewParameters() { return new UserGroupViewParameters(); } -} \ No newline at end of file +} diff --git a/mailsender/tool/src/java/org/sakaiproject/mailsender/tool/producers/fragments/UsersProducer.java b/mailsender/tool/src/java/org/sakaiproject/mailsender/tool/producers/fragments/UsersProducer.java index 649f04c63db7..0e35fa82de47 100644 --- a/mailsender/tool/src/java/org/sakaiproject/mailsender/tool/producers/fragments/UsersProducer.java +++ b/mailsender/tool/src/java/org/sakaiproject/mailsender/tool/producers/fragments/UsersProducer.java @@ -18,8 +18,8 @@ import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.exception.IdUnusedException; import org.sakaiproject.mailsender.logic.ComposeLogic; import org.sakaiproject.mailsender.tool.params.UsersViewParameters; @@ -43,7 +43,7 @@ public class UsersProducer implements ViewComponentProducer, ViewParamsReporter { public static final String VIEW_ID = "users"; - private final Log log = LogFactory.getLog(UsersProducer.class); + private final Logger log = LoggerFactory.getLogger(UsersProducer.class); private ComposeLogic composeLogic; private TargettedMessageList messages; @@ -150,4 +150,4 @@ public ViewParameters getViewParameters() { return new UsersViewParameters(); } -} \ No newline at end of file +} diff --git a/message/message-tool/tool/src/java/org/sakaiproject/message/tool/SynopticMessageAction.java b/message/message-tool/tool/src/java/org/sakaiproject/message/tool/SynopticMessageAction.java index 4b20f18c725f..8afe1adfa521 100644 --- a/message/message-tool/tool/src/java/org/sakaiproject/message/tool/SynopticMessageAction.java +++ b/message/message-tool/tool/src/java/org/sakaiproject/message/tool/SynopticMessageAction.java @@ -27,6 +27,7 @@ import java.util.Set; import java.util.Vector; +import lombok.extern.slf4j.Slf4j; import org.sakaiproject.cheftool.Context; import org.sakaiproject.cheftool.JetspeedRunData; import org.sakaiproject.cheftool.PortletConfig; @@ -59,6 +60,7 @@ * SynopticMessageAction is a the Sakai synopsis tool for messages (chat, announcement, discussion). *

*/ +@Slf4j public class SynopticMessageAction extends VelocityPortletPaneledAction { @@ -455,7 +457,7 @@ public boolean accept(Message message) { } catch (EntityPropertyNotDefinedException e) { releaseDate = null; } catch (EntityPropertyTypeException e) { - Log.error("chef", e.getMessage(), e); + log.error(e.getMessage(), e); releaseDate = null; } return releaseDate == null ? true : releaseDate @@ -473,7 +475,7 @@ public boolean accept(Message message) { } catch (EntityPropertyNotDefinedException e) { releaseDate = null; } catch (EntityPropertyTypeException e) { - Log.error("chef", e.getMessage(), e); + log.error(e.getMessage(), e); releaseDate = null; } // if no release-date is set, use the header-date as @@ -496,7 +498,7 @@ public boolean accept(Message message) { } catch (EntityPropertyNotDefinedException e) { expireDate = null; } catch (EntityPropertyTypeException e) { - Log.error("chef", e.getMessage(), e); + log.error(e.getMessage(), e); expireDate = null; } return expireDate == null ? true : expireDate @@ -706,7 +708,7 @@ else if (serviceName.equals(SERVICENAME_ANNOUNCEMENT)) String channel_ref = ((MessageService) state.getAttribute(STATE_SERVICE)).channelReference(placementContext, newChannel); state.setAttribute(STATE_CHANNEL_REF, channel_ref); - if (Log.getLogger("chef").isDebugEnabled()) Log.debug("chef", this + ".doUpdate(): newChannel: " + channel_ref); + log.debug("newChannel: {}", channel_ref); // updateObservationOfChannel(state, peid); // update the tool config diff --git a/message/message-util/util/src/java/org/sakaiproject/message/util/BaseMessage.java b/message/message-util/util/src/java/org/sakaiproject/message/util/BaseMessage.java index 5e337bc55574..384bd6870820 100644 --- a/message/message-util/util/src/java/org/sakaiproject/message/util/BaseMessage.java +++ b/message/message-util/util/src/java/org/sakaiproject/message/util/BaseMessage.java @@ -21,8 +21,8 @@ package org.sakaiproject.message.util; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.scheduler.ScheduledInvocationManager; import org.sakaiproject.authz.api.AuthzGroupService; import org.sakaiproject.authz.api.AuthzPermissionException; @@ -71,7 +71,7 @@ public abstract class BaseMessage implements MessageService, DoubleStorageUser { /** Our logger. */ - private static Log M_log = LogFactory.getLog(BaseMessage.class); + private static Logger M_log = LoggerFactory.getLogger(BaseMessage.class); /** A Storage object for persistent storage. */ protected Storage m_storage = null; diff --git a/message/search-adapters/impl/src/java/org/sakaiproject/search/component/adapter/message/MessageContentProducer.java b/message/search-adapters/impl/src/java/org/sakaiproject/search/component/adapter/message/MessageContentProducer.java index 482a916f9dc8..8d01d2079626 100644 --- a/message/search-adapters/impl/src/java/org/sakaiproject/search/component/adapter/message/MessageContentProducer.java +++ b/message/search-adapters/impl/src/java/org/sakaiproject/search/component/adapter/message/MessageContentProducer.java @@ -29,8 +29,8 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.entity.api.EntityManager; @@ -68,7 +68,7 @@ public class MessageContentProducer implements EntityContentProducer /** * debug logger */ - private static Log log = LogFactory.getLog(MessageContentProducer.class); + private static Logger log = LoggerFactory.getLogger(MessageContentProducer.class); // runtime dependency private String toolName = null; @@ -149,7 +149,7 @@ private Reference getReference(String reference) } catch (Exception ex) { - log.debug(ex); + log.debug(ex.getMessage()); } return null; } @@ -162,7 +162,7 @@ private EntityProducer getProducer(Reference ref) } catch (Exception ex) { - log.debug(ex); + log.debug(ex.getMessage()); } return null; } @@ -681,7 +681,7 @@ public boolean canRead(String reference) } catch (Exception ex) { - log.debug(ex); + log.debug(ex.getMessage()); } } return false; @@ -709,7 +709,7 @@ public String getId(String reference) String r = getReference(reference).getId(); if (log.isDebugEnabled()) { - log.debug("Message." + toolName + ".getContainer" + reference + ":" + r); + log.debug("Message.{}.getContainer{}:{}", toolName, reference, r); } return r; } @@ -731,7 +731,7 @@ public String getSubType(String reference) String r = getReference(reference).getSubType(); if (log.isDebugEnabled()) { - log.debug("Message." + toolName + ".getContainer" + reference + ":" + r); + log.debug("Message.{}.getContainer{}:{}", toolName, reference, r); } return r; } @@ -753,7 +753,7 @@ public String getType(String reference) String r = getReference(reference).getType(); if (log.isDebugEnabled()) { - log.debug("Message." + toolName + ".getContainer" + reference + ":" + r); + log.debug("Message.{}.getContainer{}:{}", toolName, reference, r); } return r; } @@ -773,10 +773,7 @@ public String getContainer(String reference) try { String r = getReference(reference).getContainer(); - if (log.isDebugEnabled()) - { - log.debug("Message." + toolName + ".getContainer" + reference + ":" + r); - } + log.debug("Message.{}.getContainer{}:{}", toolName, reference, r); return r; } catch (Exception ex) diff --git a/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/PermissionsMask.java b/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/PermissionsMask.java index 3812bab9492c..8f75ecfd9020 100644 --- a/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/PermissionsMask.java +++ b/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/PermissionsMask.java @@ -26,8 +26,8 @@ import java.util.Map; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * This class is critical for the interaction with AuthorizationManager. @@ -39,7 +39,7 @@ */ public class PermissionsMask implements Map { - private static final Log LOG = LogFactory.getLog(PermissionsMask.class); + private static final Logger LOG = LoggerFactory.getLogger(PermissionsMask.class); private Map map; diff --git a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/AuthzGroupComparator.java b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/AuthzGroupComparator.java index 6cd46f65bcfd..6c96d970f912 100644 --- a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/AuthzGroupComparator.java +++ b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/AuthzGroupComparator.java @@ -24,13 +24,13 @@ import java.util.Comparator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.Role; public class AuthzGroupComparator implements Comparator { - private static Log LOG = LogFactory.getLog(DiscussionForumTool.class); + private static Logger LOG = LoggerFactory.getLogger(DiscussionForumTool.class); private String m_property = null; diff --git a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/DiscussionForumTool.java b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/DiscussionForumTool.java index 6cfd2dba384d..f5d3bacca60a 100644 --- a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/DiscussionForumTool.java +++ b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/DiscussionForumTool.java @@ -62,8 +62,8 @@ import org.apache.commons.fileupload.FileItem; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.AnonymousManager; import org.sakaiproject.api.app.messageforums.Area; import org.sakaiproject.api.app.messageforums.AreaManager; @@ -154,7 +154,7 @@ */ public class DiscussionForumTool { - private static final Log LOG = LogFactory.getLog(DiscussionForumTool.class); + private static final Logger LOG = LoggerFactory.getLogger(DiscussionForumTool.class); /** * List individual forum details @@ -4267,14 +4267,14 @@ public String processDfMsgReplyMsgFromEntire() try{ messageId = Long.valueOf(messageIdStr); }catch (NumberFormatException e) { - LOG.error(e); + LOG.error(e.getMessage()); setErrorMessage(getResourceBundleString(MESSAGE_REFERENCE_NOT_FOUND)); return gotoMain(); } try{ topicId = Long.valueOf(topicIdStr); }catch (NumberFormatException e) { - LOG.error(e); + LOG.error(e.getMessage()); setErrorMessage(getResourceBundleString(TOPC_REFERENCE_NOT_FOUND)); return gotoMain(); } @@ -6547,9 +6547,7 @@ public String processDfGradeSubmit() lrss.registerStatement(getStatementForGrade(studentUid, lrss.getEventActor(event), selectedTopic.getTopic().getTitle(), gradeAsDouble), "msgcntr"); } catch (Exception e) { - if (LOG.isDebugEnabled()) { - LOG.debug(e); - } + LOG.debug(e.getMessage()); } } @@ -8358,7 +8356,7 @@ public String getMessageURL() { url = developerHelperService.getToolViewURL("sakai.forums", path, params, context); LOG.debug("url: " + url); }catch (Exception e) { - LOG.warn(e); + LOG.warn(e.getMessage()); } return url; } diff --git a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ForumsEmailService.java b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ForumsEmailService.java index 0d2809d045b0..8aed3fdf0c89 100644 --- a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ForumsEmailService.java +++ b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ForumsEmailService.java @@ -30,8 +30,8 @@ import java.util.Iterator; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.AnonymousManager; import org.sakaiproject.api.app.messageforums.Attachment; import org.sakaiproject.api.app.messageforums.BaseForum; @@ -64,7 +64,7 @@ * Really this should be part of the API, rather than the tool. */ public class ForumsEmailService { - private static Log log = LogFactory.getLog(ForumsEmailService.class); + private static Logger log = LoggerFactory.getLogger(ForumsEmailService.class); private List toEmailAddress; diff --git a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/GroupComparator.java b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/GroupComparator.java index 408328f0f551..6082e35d74df 100644 --- a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/GroupComparator.java +++ b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/GroupComparator.java @@ -24,15 +24,15 @@ import java.util.Comparator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.entity.api.EntityPropertyNotDefinedException; import org.sakaiproject.entity.api.EntityPropertyTypeException; import org.sakaiproject.site.api.Group; public class GroupComparator implements Comparator { - private Log LOG = LogFactory.getLog(DiscussionForumTool.class); + private Logger LOG = LoggerFactory.getLogger(DiscussionForumTool.class); private String m_property = null; diff --git a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/PrivateMessagesTool.java b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/PrivateMessagesTool.java index 6e998cd44216..14e86d12dd96 100644 --- a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/PrivateMessagesTool.java +++ b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/PrivateMessagesTool.java @@ -45,8 +45,8 @@ import javax.faces.model.SelectItem; import javax.servlet.http.HttpServletRequest; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.validator.EmailValidator; import org.sakaiproject.api.app.messageforums.Area; import org.sakaiproject.api.app.messageforums.Attachment; @@ -112,7 +112,7 @@ public class PrivateMessagesTool { - private static final Log LOG = LogFactory.getLog(PrivateMessagesTool.class); + private static final Logger LOG = LoggerFactory.getLogger(PrivateMessagesTool.class); private static final String MESSAGECENTER_PRIVACY_URL = "messagecenter.privacy.url"; private static final String MESSAGECENTER_PRIVACY_TEXT = "messagecenter.privacy.text"; @@ -5185,7 +5185,7 @@ public Site getCurrentSite(){ try{ return SiteService.getSite(ToolManager.getCurrentPlacement().getContext()); } catch (IdUnusedException e) { - LOG.error(e); + LOG.error(e.getMessage()); } return null; } diff --git a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/entityproviders/ForumsEntityProviderImpl.java b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/entityproviders/ForumsEntityProviderImpl.java index 6f864471c2b2..979ea8cd624d 100644 --- a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/entityproviders/ForumsEntityProviderImpl.java +++ b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/entityproviders/ForumsEntityProviderImpl.java @@ -6,8 +6,8 @@ import lombok.Setter; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.Attachment; import org.sakaiproject.api.app.messageforums.BaseForum; import org.sakaiproject.api.app.messageforums.DiscussionForum; @@ -42,7 +42,7 @@ */ public class ForumsEntityProviderImpl extends AbstractEntityProvider implements Outputable, AutoRegisterEntityProvider, ActionsExecutable, Describeable { - private static final Log LOG = LogFactory.getLog(ForumsEntityProviderImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(ForumsEntityProviderImpl.class); public final static String ENTITY_PREFIX = "forums"; diff --git a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/jsf/HierDataTableRender.java b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/jsf/HierDataTableRender.java index 83410843bde0..824f4e5159ae 100644 --- a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/jsf/HierDataTableRender.java +++ b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/jsf/HierDataTableRender.java @@ -20,8 +20,8 @@ **********************************************************************************/ package org.sakaiproject.tool.messageforums.jsf; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; @@ -51,7 +51,7 @@ */ public class HierDataTableRender extends HtmlBasicRenderer { - protected static Log log = LogFactory.getLog(HierDataTableRender.class); + protected static Logger log = LoggerFactory.getLogger(HierDataTableRender.class); private static final String RESOURCE_PATH = "/messageforums-tool"; private static final String BARIMG = RESOURCE_PATH + "/" + "images/collapse.gif"; diff --git a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/jsf/HierDataTableTag.java b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/jsf/HierDataTableTag.java index 7a614bf53d2c..97ebe96781c5 100644 --- a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/jsf/HierDataTableTag.java +++ b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/jsf/HierDataTableTag.java @@ -33,8 +33,8 @@ import javax.faces.webapp.UIComponentTag; import javax.faces.webapp.UIComponentBodyTag; import javax.servlet.jsp.JspException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @author cwen @@ -44,7 +44,7 @@ */ public class HierDataTableTag extends UIComponentTag { - public static Log log = LogFactory.getLog(HierDataTableTag.class); + public static Logger log = LoggerFactory.getLogger(HierDataTableTag.class); // // Instance Variables diff --git a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/jsf/HierPvtMsgDataTableRender.java b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/jsf/HierPvtMsgDataTableRender.java index 583640156453..c7c198180c0a 100644 --- a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/jsf/HierPvtMsgDataTableRender.java +++ b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/jsf/HierPvtMsgDataTableRender.java @@ -21,8 +21,8 @@ package org.sakaiproject.tool.messageforums.jsf; import com.sun.faces.util.Util; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.faces.component.UIColumn; import javax.faces.component.UIComponent; @@ -50,8 +50,7 @@ * Preferences - Java - Code Style - Code Templates */ public class HierPvtMsgDataTableRender extends HtmlBasicRenderer { - protected static Log log = LogFactory - .getLog(HierPvtMsgDataTableRender.class); + protected static Logger log = LoggerFactory.getLogger(HierPvtMsgDataTableRender.class); private static final String RESOURCE_PATH; diff --git a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/jsf/HierPvtMsgDataTableTag.java b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/jsf/HierPvtMsgDataTableTag.java index 6115a5ba9c98..da0f086766eb 100644 --- a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/jsf/HierPvtMsgDataTableTag.java +++ b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/jsf/HierPvtMsgDataTableTag.java @@ -33,8 +33,8 @@ import javax.faces.webapp.UIComponentTag; import javax.faces.webapp.UIComponentBodyTag; import javax.servlet.jsp.JspException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @author cwen @@ -44,7 +44,7 @@ */ public class HierPvtMsgDataTableTag extends UIComponentTag { - public static Log log = LogFactory.getLog(HierPvtMsgDataTableTag.class); + public static Logger log = LoggerFactory.getLogger(HierPvtMsgDataTableTag.class); // // Instance Variables diff --git a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/DiscussionAreaBean.java b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/DiscussionAreaBean.java index 86c3bb932393..610095b96627 100644 --- a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/DiscussionAreaBean.java +++ b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/DiscussionAreaBean.java @@ -28,8 +28,8 @@ import javax.faces.context.FacesContext; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.Area; @@ -40,7 +40,7 @@ */ public class DiscussionAreaBean { - private static final Log LOG = LogFactory.getLog(DiscussionAreaBean.class); + private static final Logger LOG = LoggerFactory.getLogger(DiscussionAreaBean.class); private Area area; private int numPendingMsgs; diff --git a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/DiscussionForumBean.java b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/DiscussionForumBean.java index 92512b49425f..50dd7be16c36 100644 --- a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/DiscussionForumBean.java +++ b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/DiscussionForumBean.java @@ -31,8 +31,8 @@ import javax.faces.model.SelectItem; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.Attachment; import org.sakaiproject.api.app.messageforums.DiscussionForum; import org.sakaiproject.api.app.messageforums.ui.DiscussionForumManager; @@ -46,8 +46,7 @@ */ public class DiscussionForumBean { - private static final Log LOG = LogFactory - .getLog(DiscussionForumBean.class); + private static final Logger LOG = LoggerFactory.getLogger(DiscussionForumBean.class); private DiscussionForum forum; private boolean markForDeletion; private boolean markForDuplication; diff --git a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/DiscussionMessageBean.java b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/DiscussionMessageBean.java index 475187d5de9d..00c6a8f6284d 100644 --- a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/DiscussionMessageBean.java +++ b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/DiscussionMessageBean.java @@ -24,8 +24,8 @@ import java.util.Iterator; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.AnonymousManager; import org.sakaiproject.api.app.messageforums.Attachment; import org.sakaiproject.api.app.messageforums.Message; @@ -48,7 +48,7 @@ public class DiscussionMessageBean { - private static final Log LOG = LogFactory.getLog(DiscussionMessageBean.class); + private static final Logger LOG = LoggerFactory.getLogger(DiscussionMessageBean.class); private boolean selected; private Message message; diff --git a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/DiscussionTopicBean.java b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/DiscussionTopicBean.java index 7d068c2863f5..a17a39c87531 100644 --- a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/DiscussionTopicBean.java +++ b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/DiscussionTopicBean.java @@ -30,8 +30,8 @@ import javax.faces.context.FacesContext; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.Attachment; import org.sakaiproject.api.app.messageforums.DiscussionForum; import org.sakaiproject.api.app.messageforums.DiscussionTopic; @@ -47,8 +47,7 @@ */ public class DiscussionTopicBean { - private static final Log LOG = LogFactory - .getLog(DiscussionTopicBean.class); + private static final Logger LOG = LoggerFactory.getLogger(DiscussionTopicBean.class); private DiscussionTopic topic; private int totalNoMessages; private int unreadNoMessages; diff --git a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/EmailNotificationBean.java b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/EmailNotificationBean.java index 0adaa165bc9a..e82f2598abf4 100644 --- a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/EmailNotificationBean.java +++ b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/EmailNotificationBean.java @@ -1,13 +1,13 @@ package org.sakaiproject.tool.messageforums.ui; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.EmailNotification; public class EmailNotificationBean { - private static final Log LOG = LogFactory.getLog(EmailNotificationBean.class); + private static final Logger LOG = LoggerFactory.getLogger(EmailNotificationBean.class); private EmailNotification emailNotification; public EmailNotificationBean(EmailNotification curroption){ diff --git a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/ForumRankBean.java b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/ForumRankBean.java index 7dde58670b0e..1fabea6c68f9 100644 --- a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/ForumRankBean.java +++ b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/ForumRankBean.java @@ -23,15 +23,15 @@ import java.util.Set; import org.sakaiproject.api.app.messageforums.Rank; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.app.messageforums.dao.hibernate.RankImpl; /** * @author lydial@stanford.edu */ public class ForumRankBean { - private static final Log LOG = LogFactory.getLog(ForumRankBean.class); + private static final Logger LOG = LoggerFactory.getLogger(ForumRankBean.class); private boolean assignErr; private Set assignToIds; diff --git a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/MessageForumStatisticsBean.java b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/MessageForumStatisticsBean.java index f1668e25845a..53d72b61bc7c 100644 --- a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/MessageForumStatisticsBean.java +++ b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/MessageForumStatisticsBean.java @@ -42,8 +42,8 @@ import javax.faces.model.SelectItem; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.AnonymousManager; import org.sakaiproject.api.app.messageforums.Attachment; import org.sakaiproject.api.app.messageforums.DiscussionForum; @@ -462,7 +462,7 @@ public void setCourseMemberMap(Map newValue){ } /** to get accces to log file */ - private static final Log LOG = LogFactory.getLog(MessageForumSynopticBean.class); + private static final Logger LOG = LoggerFactory.getLogger(MessageForumSynopticBean.class); /** Needed if within a site so we only need stats for this site */ private MessageForumsMessageManager messageManager; @@ -823,7 +823,7 @@ public List getTopicStatistics(){ } } }catch (IdUnusedException e) { - LOG.error(e); + LOG.error(e.getMessage()); } }else{ for (Iterator i = courseMemberMap.entrySet().iterator(); i.hasNext();) { @@ -2915,7 +2915,7 @@ public List getGroups() { } } }catch (IdUnusedException e){ - LOG.error(e); + LOG.error(e.getMessage()); } } return groups; diff --git a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/MessageForumSynopticBean.java b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/MessageForumSynopticBean.java index dd8d72e1d153..1f9c24127d5a 100644 --- a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/MessageForumSynopticBean.java +++ b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/MessageForumSynopticBean.java @@ -31,8 +31,8 @@ import javax.faces.context.FacesContext; import javax.faces.event.ActionEvent; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.Area; import org.sakaiproject.api.app.messageforums.AreaManager; import org.sakaiproject.api.app.messageforums.DiscussionForum; @@ -203,7 +203,7 @@ public void setForums(boolean forums) { private boolean sitesToViewSet = false; /** to get accces to log file */ - private static final Log LOG = LogFactory.getLog(MessageForumSynopticBean.class); + private static final Logger LOG = LoggerFactory.getLogger(MessageForumSynopticBean.class); /** Needed if within a site so we only need stats for this site */ private MessageForumsMessageManager messageManager; @@ -934,7 +934,7 @@ private List getMyWorkspaceContents() { } catch (IdUnusedException e) { // Wierdness has happened - pulled from SiteService but now can't - // find it. Log and skip + // find it. Logger and skip LOG.error("IdUnusedException attempting to access site " + siteId); continue; } @@ -987,7 +987,7 @@ private List getMyWorkspaceContents() { } catch (IdUnusedException e) { // Wierdness has happened - pulled from SiteService but now can't - // find it. Log and skip + // find it. Logger and skip LOG.error("IdUnusedException attempting to access site " + siteId); continue; } diff --git a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/MessageForumSynopticBeanLite.java b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/MessageForumSynopticBeanLite.java index 5fe8eeedc8dd..44b82a9c2527 100644 --- a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/MessageForumSynopticBeanLite.java +++ b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/MessageForumSynopticBeanLite.java @@ -9,8 +9,8 @@ import java.util.Iterator; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.Area; import org.sakaiproject.api.app.messageforums.AreaManager; import org.sakaiproject.api.app.messageforums.DiscussionForumService; @@ -45,7 +45,7 @@ public class MessageForumSynopticBeanLite { private transient List myContents = null; private transient DecoratedSynopticMsgcntrItem siteHomepageContent = null; /** to get accces to log file */ - private static final Log LOG = LogFactory.getLog(MessageForumSynopticBeanLite.class); + private static final Logger LOG = LoggerFactory.getLogger(MessageForumSynopticBeanLite.class); private SynopticMsgcntrManager synopticMsgcntrManager; private MessageForumsForumManager forumsManager; private MessageForumsTypeManager typeManager; diff --git a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/AnonymousManagerImpl.java b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/AnonymousManagerImpl.java index 830d1b6cf09a..dc3554a72586 100644 --- a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/AnonymousManagerImpl.java +++ b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/AnonymousManagerImpl.java @@ -11,8 +11,8 @@ import java.util.Set; import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.Hibernate; import org.hibernate.HibernateException; import org.hibernate.Query; @@ -32,7 +32,7 @@ */ public class AnonymousManagerImpl extends HibernateDaoSupport implements AnonymousManager { - private static final Log LOG = LogFactory.getLog(AnonymousManagerImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(AnonymousManagerImpl.class); // Padding used to enforce that anonIDs are always 6 characters private final String ANON_ID_PADDING = "000000"; diff --git a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/AreaManagerImpl.java b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/AreaManagerImpl.java index 2bc005a2fc1f..e4e20ef98aed 100644 --- a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/AreaManagerImpl.java +++ b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/AreaManagerImpl.java @@ -24,8 +24,8 @@ import java.util.Date; import java.util.Iterator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.Hibernate; import org.hibernate.HibernateException; import org.hibernate.Query; @@ -55,7 +55,7 @@ import org.springframework.orm.hibernate3.support.HibernateDaoSupport; public class AreaManagerImpl extends HibernateDaoSupport implements AreaManager { - private static final Log LOG = LogFactory.getLog(AreaManagerImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(AreaManagerImpl.class); private static final String QUERY_AREA_BY_CONTEXT_AND_TYPE_ID = "findAreaByContextIdAndTypeId"; private static final String QUERY_AREA_BY_TYPE = "findAreaByType"; diff --git a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/DefaultPermissionsManagerImpl.java b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/DefaultPermissionsManagerImpl.java index 6ea353bbc2e1..54ffcf60fe5f 100644 --- a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/DefaultPermissionsManagerImpl.java +++ b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/DefaultPermissionsManagerImpl.java @@ -24,8 +24,8 @@ import java.util.Collection; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.DefaultPermissionsManager; import org.sakaiproject.authz.api.AuthzGroup; import org.sakaiproject.authz.api.AuthzGroupService; @@ -39,7 +39,7 @@ public class DefaultPermissionsManagerImpl implements DefaultPermissionsManager { - private static final Log LOG = LogFactory.getLog(DefaultPermissionsManagerImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(DefaultPermissionsManagerImpl.class); //Dependency injected private FunctionManager functionManager; private AuthzGroupService authzGroupService; diff --git a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/DiscussionForumServiceImpl.java b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/DiscussionForumServiceImpl.java index 64e5d6f770d8..25dd0192444e 100644 --- a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/DiscussionForumServiceImpl.java +++ b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/DiscussionForumServiceImpl.java @@ -32,8 +32,8 @@ import java.util.ArrayList; import java.util.Map.Entry; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.codec.binary.Base64; import org.sakaiproject.api.app.messageforums.Area; import org.sakaiproject.api.app.messageforums.Attachment; @@ -129,7 +129,7 @@ public void setAuthzGroupService(AuthzGroupService authzGroupService) { this.authzGroupService = authzGroupService; } - private static final Log LOG = LogFactory.getLog(DiscussionForumService.class); + private static final Logger LOG = LoggerFactory.getLogger(DiscussionForumService.class); public void init() throws Exception { @@ -1148,9 +1148,9 @@ private Set getMembershipItemSetFromPermissionElement(Element permissionsElement } } catch (NumberFormatException nfe) { - LOG.error(nfe); + LOG.error(nfe.getMessage()); } catch (Exception e) { - LOG.error(e); + LOG.error(e.getMessage(), e); } } } diff --git a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/DummyDataHelper.java b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/DummyDataHelper.java index 4aba034c7912..a7f950383b75 100644 --- a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/DummyDataHelper.java +++ b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/DummyDataHelper.java @@ -25,8 +25,8 @@ import java.util.Iterator; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.ActorPermissions; import org.sakaiproject.api.app.messageforums.Area; import org.sakaiproject.api.app.messageforums.Attachment; @@ -64,7 +64,7 @@ public class DummyDataHelper implements DummyDataHelperApi { private MessageForumsTypeManager typeMgr; - private static final Log LOG = LogFactory.getLog(DummyDataHelper.class); + private static final Logger LOG = LoggerFactory.getLogger(DummyDataHelper.class); public void init() { diff --git a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/EmailNotificationManagerImpl.java b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/EmailNotificationManagerImpl.java index 8ed63234296e..7fd97a91f7bf 100644 --- a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/EmailNotificationManagerImpl.java +++ b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/EmailNotificationManagerImpl.java @@ -25,8 +25,8 @@ import java.util.List; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.Hibernate; import org.hibernate.HibernateException; import org.hibernate.Query; @@ -49,8 +49,7 @@ public class EmailNotificationManagerImpl extends HibernateDaoSupport implements EmailNotificationManager { - private static final Log LOG = LogFactory - .getLog(EmailNotificationManagerImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(EmailNotificationManagerImpl.class); private static final String QUERY_BY_USER_ID = "findEmailNotificationByUserId"; private static final String QUERY_USERLIST_BY_NOTIFICATION_LEVEL = "findUserIdsByNotificationLevel"; @@ -80,9 +79,7 @@ public void setDiscussionForumManager( } public EmailNotification getEmailNotification(final String userId) { - if (LOG.isDebugEnabled()) { - LOG.debug("getEmailNotification(userId: " + userId + ")"); - } + LOG.debug("getEmailNotification(userId: {})", userId); if (userId == null) { throw new IllegalArgumentException("Null Argument"); @@ -107,13 +104,13 @@ public Object doInHibernate(Session session) try { userDirectoryService.getUser(userId); } catch (UserNotDefinedException e) { - e.printStackTrace(); + LOG.error(e.getMessage()); } String notificationDefault = ServerConfigurationService.getString("mc.notificationDefault", "1"); EmailNotification newEmailNotification = new EmailNotificationImpl(); newEmailNotification.setContextId(getContextId()); newEmailNotification.setUserId(userId); - LOG.debug("notificationDefault= "+notificationDefault); + LOG.debug("notificationDefault={}", notificationDefault); if ("0".equals(notificationDefault)) { newEmailNotification .setNotificationLevel(EmailNotification.EMAIL_NONE); @@ -129,21 +126,13 @@ public Object doInHibernate(Session session) // yet saveEmailNotification(newEmailNotification); - if (LOG.isDebugEnabled()) { - LOG - .debug(userId - + " didn't set watch options. creating a new EmailNotification this user. his level : " - + newEmailNotification.getNotificationLevel()); - } + LOG.debug("{} didn't set watch options, creating EmailNotification with level: {}", + userId, newEmailNotification.getNotificationLevel()); return newEmailNotification; } else { - - if (LOG.isDebugEnabled()) { - LOG.debug(userId - + " already set watch options. his option is " - + emailNotification.getNotificationLevel()); - } + LOG.debug("{} already set watch options. his option is {}", + userId, emailNotification.getNotificationLevel()); return emailNotification; } @@ -168,9 +157,7 @@ public List getUsersToBeNotifiedByLevel(String notificationlevel) { int intlevel = Integer.parseInt(notificationlevel); List allusers = getSiteUsersByNotificationLevel(contextid, intlevel); - if (LOG.isDebugEnabled()){ - LOG.debug("total count of users to be notified = " + allusers.size()); - } + LOG.debug("total count of users to be notified = {}", allusers.size()); return allusers; } @@ -207,10 +194,10 @@ public List filterUsers(List allusers, Topic topic) { for (int i = 0; i < allusers.size(); i++) { String userId = allusers.get(i); if (readUsers.contains(userId)) { - LOG.debug("user " + userId + " has read in topic: " + topic.getId()); + LOG.debug("user {} has read in topic: {}", userId, topic.getId()); ret.add(userId); } else { - LOG.debug("Removing user: " + userId + "as they don't have read rights on topic: " + topic.getId()); + LOG.debug("Removing user: {} as they don't have read rights on topic: {}", userId, topic.getId()); } } return ret; @@ -219,11 +206,7 @@ public List filterUsers(List allusers, Topic topic) { private List getSiteUsersByNotificationLevel(final String contextid, final int notificationlevel) { - if (LOG.isDebugEnabled()) { - LOG - .debug("getEmailNotification(userid: " + notificationlevel - + ")"); - } + LOG.debug("getEmailNotification(userid: {})", notificationlevel); HibernateCallback hcb = new HibernateCallback() { public Object doInHibernate(Session session) @@ -258,10 +241,7 @@ public List getUserEmailsToBeNotifiedByLevel(List userlist) { // find emails for each user String useremail = user.getEmail(); if (useremail != null && !"".equalsIgnoreCase(useremail)) { - if (LOG.isDebugEnabled()) { - LOG.debug("Username = " + user.getDisplayId() - + " , useremail : " + useremail); - } + LOG.debug("Username = {}, email: {}", user.getDisplayId(), useremail); emaillist.add(useremail); } @@ -275,9 +255,8 @@ public List getUserEmailsToBeNotifiedByLevel(List userlist) { public void saveEmailNotification(EmailNotification emailoption) { getHibernateTemplate().saveOrUpdate(emailoption); - LOG.debug("saveEmailNotification executed for contextid= " - + emailoption.getContextId() + " userid= " - + emailoption.getUserId()); + LOG.debug("saveEmailNotification executed for contextid={} userid={}", + emailoption.getContextId(), emailoption.getUserId()); } diff --git a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/ForumScheduleNotificationImpl.java b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/ForumScheduleNotificationImpl.java index b45d68155856..2cef0a25bee4 100644 --- a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/ForumScheduleNotificationImpl.java +++ b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/ForumScheduleNotificationImpl.java @@ -3,8 +3,8 @@ import java.util.Date; import java.util.HashMap; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.scheduler.DelayedInvocation; import org.sakaiproject.api.app.scheduler.ScheduledInvocationManager; import org.sakaiproject.time.api.Time; @@ -22,7 +22,7 @@ public class ForumScheduleNotificationImpl implements ForumScheduleNotification { - private static final Log LOG = LogFactory.getLog(ForumScheduleNotificationImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(ForumScheduleNotificationImpl.class); private static final String AREA_PREFIX = "area-"; private static final String FORUM_PREFIX = "forum-"; diff --git a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/MembershipManagerImpl.java b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/MembershipManagerImpl.java index ba4072e9adc2..f2dc06ff7575 100644 --- a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/MembershipManagerImpl.java +++ b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/MembershipManagerImpl.java @@ -30,8 +30,8 @@ import java.util.Map; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.MembershipManager; import org.sakaiproject.api.app.messageforums.ui.PrivateMessageManager; import org.sakaiproject.api.privacy.PrivacyManager; @@ -54,7 +54,7 @@ public class MembershipManagerImpl implements MembershipManager{ - private static final Log LOG = LogFactory.getLog(MembershipManagerImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(MembershipManagerImpl.class); private SiteService siteService; private UserDirectoryService userDirectoryService; diff --git a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/MessageForumsForumManagerImpl.java b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/MessageForumsForumManagerImpl.java index 1beee3dbbcda..ecf5521b94d7 100644 --- a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/MessageForumsForumManagerImpl.java +++ b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/MessageForumsForumManagerImpl.java @@ -31,8 +31,8 @@ import java.util.List; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.Hibernate; import org.hibernate.HibernateException; import org.hibernate.Query; @@ -83,7 +83,7 @@ */ public class MessageForumsForumManagerImpl extends HibernateDaoSupport implements MessageForumsForumManager { - private static final Log LOG = LogFactory.getLog(MessageForumsForumManagerImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(MessageForumsForumManagerImpl.class); private static final String QUERY_FOR_PRIVATE_TOPICS = "findPrivateTopicsByForumId"; @@ -699,7 +699,7 @@ public Object doInHibernate(Session session) throws HibernateException, SQLExcep } } } catch (Exception e) { - LOG.warn(e); + LOG.warn(e.getMessage()); } return res; diff --git a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/MessageForumsMessageManagerImpl.java b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/MessageForumsMessageManagerImpl.java index 6ee6fee8611a..0ec37cc71d5a 100644 --- a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/MessageForumsMessageManagerImpl.java +++ b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/MessageForumsMessageManagerImpl.java @@ -33,8 +33,8 @@ import java.util.Map; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.Hibernate; import org.hibernate.HibernateException; import org.hibernate.Query; @@ -74,7 +74,7 @@ public class MessageForumsMessageManagerImpl extends HibernateDaoSupport implements MessageForumsMessageManager { - private static final Log LOG = LogFactory.getLog(MessageForumsMessageManagerImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(MessageForumsMessageManagerImpl.class); //private static final String QUERY_BY_MESSAGE_ID = "findMessageById"; //private static final String QUERY_ATTACHMENT_BY_ID = "findAttachmentById"; diff --git a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/MessageForumsTypeManagerImpl.java b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/MessageForumsTypeManagerImpl.java index 33d4f1932d85..c416028ad342 100644 --- a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/MessageForumsTypeManagerImpl.java +++ b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/MessageForumsTypeManagerImpl.java @@ -23,8 +23,8 @@ import java.util.HashMap; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.MessageForumsTypeManager; import org.sakaiproject.api.common.type.Type; import org.sakaiproject.api.common.type.TypeManager; @@ -36,8 +36,7 @@ */ public class MessageForumsTypeManagerImpl implements MessageForumsTypeManager { - private static final Log LOG = LogFactory - .getLog(MessageForumsTypeManagerImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(MessageForumsTypeManagerImpl.class); private static final String NOT_SPECIFIED = "notSpecified"; private static final String ALL_PARTICIPANTS = "allParticipants"; private static final String GROUP = "group"; @@ -536,4 +535,4 @@ public void setSqlService(SqlService sqlService) { public void setAutoDdl(Boolean autoDdl) { this.autoDdl = autoDdl; } -} \ No newline at end of file +} diff --git a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/MessageForumsUserManagerImpl.java b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/MessageForumsUserManagerImpl.java index 6cbeb63f54e9..bd7465cddbf2 100644 --- a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/MessageForumsUserManagerImpl.java +++ b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/MessageForumsUserManagerImpl.java @@ -22,8 +22,8 @@ import java.sql.SQLException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.Hibernate; import org.hibernate.HibernateException; import org.hibernate.Query; @@ -43,7 +43,7 @@ public class MessageForumsUserManagerImpl extends HibernateDaoSupport implements MessageForumsUserManager { - private static final Log LOG = LogFactory.getLog(MessageForumsUserManagerImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(MessageForumsUserManagerImpl.class); private static final String QUERY_BY_USER_ID = "findUserByUserId"; /** sakai dependencies */ @@ -155,4 +155,4 @@ private String getContextId() { return presentSiteId; } -} \ No newline at end of file +} diff --git a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/PermissionLevelManagerImpl.java b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/PermissionLevelManagerImpl.java index 30c48990975e..2fbd7cd7b8a1 100644 --- a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/PermissionLevelManagerImpl.java +++ b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/PermissionLevelManagerImpl.java @@ -38,8 +38,8 @@ import org.hibernate.Session; import org.apache.commons.beanutils.PropertyUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.AreaManager; import org.sakaiproject.api.app.messageforums.DBMembershipItem; import org.sakaiproject.api.app.messageforums.Topic; @@ -57,7 +57,7 @@ public class PermissionLevelManagerImpl extends HibernateDaoSupport implements PermissionLevelManager { - private static final Log LOG = LogFactory.getLog(PermissionLevelManagerImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(PermissionLevelManagerImpl.class); private EventTrackingService eventTrackingService; private SessionManager sessionManager; private IdManager idManager; diff --git a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/PermissionManagerImpl.java b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/PermissionManagerImpl.java index 9700b42ac613..d811f26df7b8 100644 --- a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/PermissionManagerImpl.java +++ b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/PermissionManagerImpl.java @@ -22,8 +22,8 @@ import java.sql.SQLException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.Hibernate; import org.hibernate.HibernateException; import org.hibernate.Query; @@ -56,7 +56,7 @@ public class PermissionManagerImpl extends HibernateDaoSupport implements PermissionManager { - private static final Log LOG = LogFactory.getLog(PermissionManagerImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(PermissionManagerImpl.class); private static final String QUERY_CP_BY_ROLE = "findAreaControlPermissionByRole"; private static final String QUERY_CP_BY_FORUM = "findForumControlPermissionByRole"; diff --git a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/RankManagerImpl.java b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/RankManagerImpl.java index d8c2e92cc3b7..2af2de9b5303 100644 --- a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/RankManagerImpl.java +++ b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/RankManagerImpl.java @@ -25,8 +25,8 @@ import java.util.Date; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.Hibernate; import org.hibernate.HibernateException; import org.hibernate.Query; @@ -57,7 +57,7 @@ import org.sakaiproject.util.Validator; public class RankManagerImpl extends HibernateDaoSupport implements RankManager { - private static final Log LOG = LogFactory.getLog(RankManagerImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(RankManagerImpl.class); private static final String QUERY_BY_CONTEXT_ID_USERID = "findRanksByContextIdUserID"; private static final String QUERY_BY_CONTEXT_ID_NUM_POSTS_BASED = "findRanksByContextIdBasedOnNumPost"; private static final String QUERY_BY_CONTEXT_ID = "findRanksByContextId"; diff --git a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/SynopticMsgcntrManagerImpl.java b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/SynopticMsgcntrManagerImpl.java index 8534185e3a79..72175299f630 100644 --- a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/SynopticMsgcntrManagerImpl.java +++ b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/SynopticMsgcntrManagerImpl.java @@ -15,8 +15,8 @@ import java.util.Map.Entry; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.Hibernate; import org.hibernate.HibernateException; import org.hibernate.Query; @@ -43,7 +43,7 @@ public class SynopticMsgcntrManagerImpl extends HibernateDaoSupport implements SynopticMsgcntrManager { - private static final Log LOG = LogFactory.getLog(SynopticMsgcntrManagerImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(SynopticMsgcntrManagerImpl.class); private static final String QUERY_WORKSPACE_SYNOPTIC_ITEMS = "findWorkspaceSynopticMsgcntrItems"; private static final String QUERY_SITE_SYNOPTIC_ITEMS = "findSiteSynopticMsgcntrItems"; private static final String QUERY_UPDATE_ALL_SITE_TITLES = "updateSiteTitles"; @@ -445,35 +445,35 @@ public void resetAllUsersSynopticInfoInSite(String siteId, List users){ } createOrUpdateSynopticToolInfo(users, siteId, site.getTitle(), unreadCounts); } catch (IdUnusedException e) { - LOG.error(e); + LOG.error(e.getMessage()); } catch (SQLException e) { - LOG.error(e); + LOG.error(e.getMessage(), e); } finally{ try { if(forumsAndTopicsRS != null) forumsAndTopicsRS.close(); } catch (Exception e) { - LOG.warn(e); + LOG.warn(e.getMessage(), e); } try { if(newMessagesCountRS != null) newMessagesCountRS.close(); } catch (Exception e) { - LOG.warn(e); + LOG.warn(e.getMessage(), e); } try { if(newMessageCountForAllUsers != null) newMessageCountForAllUsers.close(); } catch (Exception e) { - LOG.warn(e); + LOG.warn(e.getMessage(), e); } try { if(returnAllForumsAndTopics != null) returnAllForumsAndTopics.close(); } catch (Exception e) { - LOG.warn(e); + LOG.warn(e.getMessage(), e); } SqlService.returnConnection(clConnection); } @@ -544,21 +544,21 @@ public HashMap getUserToNewMessagesForForumMap(String siteId, L } } catch (IdUnusedException e) { - LOG.error(e); + LOG.error(e.getMessage(), e); } catch (SQLException e) { - LOG.error(e); + LOG.error(e.getMessage(), e); } finally{ try { if(forumsAndTopicsRS != null) forumsAndTopicsRS.close(); } catch (Exception e) { - LOG.warn(e); + LOG.warn(e.getMessage(), e); } try { if(returnAllTopicsForForum != null) returnAllTopicsForForum.close(); } catch (Exception e) { - LOG.warn(e); + LOG.warn(e.getMessage(), e); } SqlService.returnConnection(clConnection); @@ -821,21 +821,21 @@ private Map getSiteContents(String siteId }catch(IdUnusedException e) { LOG.error("IdUnusedException while trying to check if site has MF tool."); } catch (SQLException e) { - LOG.error(e); + LOG.error(e.getMessage(), e); } finally{ try { if(forumsAndTopicsRS != null) forumsAndTopicsRS.close(); } catch (Exception e) { - LOG.warn(e); + LOG.warn(e.getMessage(), e); } try { if(returnAllForumsAndTopics != null) returnAllForumsAndTopics.close(); } catch (Exception e) { - LOG.warn(e); + LOG.warn(e.getMessage(), e); } SqlService.returnConnection(clConnection); @@ -881,8 +881,7 @@ private HashMap getDecoratedForumsAndTopics(ResultSet } } } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + LOG.error(e.getMessage(), e); } return returnHM; @@ -902,7 +901,7 @@ public HashMap getUnreadMessagesHM(ResultSet rs){ returnHM.put(userId, messageCount); } }catch(Exception e){ - LOG.error(e); + LOG.error(e.getMessage(), e); } } diff --git a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/entity/ForumMessageEntityProviderImpl.java b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/entity/ForumMessageEntityProviderImpl.java index 486fc357635f..2f54df742dab 100644 --- a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/entity/ForumMessageEntityProviderImpl.java +++ b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/entity/ForumMessageEntityProviderImpl.java @@ -9,8 +9,8 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.Attachment; import org.sakaiproject.api.app.messageforums.DiscussionForum; import org.sakaiproject.api.app.messageforums.DiscussionForumService; @@ -52,7 +52,7 @@ public class ForumMessageEntityProviderImpl implements ForumMessageEntityProvide private PrivateMessageManager privateMessageManager; private UIPermissionsManager uiPermissionsManager; private MessageForumsMessageManager messageManager; - private static final Log LOG = LogFactory.getLog(ForumMessageEntityProviderImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(ForumMessageEntityProviderImpl.class); diff --git a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/entity/MessageForumsEntityContentProducer.java b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/entity/MessageForumsEntityContentProducer.java index b3846a4b7aa7..27a43987b797 100644 --- a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/entity/MessageForumsEntityContentProducer.java +++ b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/entity/MessageForumsEntityContentProducer.java @@ -8,8 +8,8 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.DiscussionForum; import org.sakaiproject.api.app.messageforums.DiscussionTopic; import org.sakaiproject.api.app.messageforums.Message; @@ -35,7 +35,7 @@ public class MessageForumsEntityContentProducer implements EntityContentProducer, PortalUrlEnabledProducer { - private static Log log = LogFactory.getLog(MessageForumsEntityContentProducer.class); + private static Logger log = LoggerFactory.getLogger(MessageForumsEntityContentProducer.class); // runtime dependency private List addEvents = null; @@ -364,10 +364,7 @@ public boolean matches(String reference) { if (toolName.equals(prefix)) return true; } catch (Exception e) { - log.warn("unable to parse reference: " + reference +", " + e); - if (log.isDebugEnabled()) { - log.debug(e); - } + log.warn("unable to parse reference: {}", reference, e); } return false; } diff --git a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/entity/SynopticMsgcntrItemEntityProviderImpl.java b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/entity/SynopticMsgcntrItemEntityProviderImpl.java index 6f22d88a3836..1991a4a8b9e4 100644 --- a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/entity/SynopticMsgcntrItemEntityProviderImpl.java +++ b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/entity/SynopticMsgcntrItemEntityProviderImpl.java @@ -5,8 +5,8 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.SynopticMsgcntrItem; import org.sakaiproject.api.app.messageforums.SynopticMsgcntrManager; import org.sakaiproject.api.app.messageforums.entity.SynopticMsgcntrItemEntityProvider; @@ -28,7 +28,7 @@ public class SynopticMsgcntrItemEntityProviderImpl implements SynopticMsgcntrItemEntityProvider, CoreEntityProvider, AutoRegisterEntityProvider, PropertyProvideable, RequestStorable, RESTful, RequestAware{ private SynopticMsgcntrManager synopticMsgcntrManager; - private static final Log LOG = LogFactory.getLog(SynopticMsgcntrItemEntityProviderImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(SynopticMsgcntrItemEntityProviderImpl.class); private RequestStorage requestStorage; public void setRequestStorage(RequestStorage requestStorage) { diff --git a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/entity/TopicEntityProviderImpl.java b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/entity/TopicEntityProviderImpl.java index 24fb962c5046..7c67f370cf4d 100644 --- a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/entity/TopicEntityProviderImpl.java +++ b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/entity/TopicEntityProviderImpl.java @@ -9,8 +9,8 @@ import java.util.Locale; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.Area; import org.sakaiproject.api.app.messageforums.Attachment; import org.sakaiproject.api.app.messageforums.DiscussionForum; @@ -64,7 +64,7 @@ public class TopicEntityProviderImpl implements TopicEntityProvider, private MessageForumsTypeManager typeManager; private PrivateMessageManager privateMessageManager; private static final ResourceLoader rb = new ResourceLoader("org.sakaiproject.api.app.messagecenter.bundle.Messages"); - private static final Log LOG = LogFactory.getLog(TopicEntityProviderImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(TopicEntityProviderImpl.class); public static final String PVTMSG_MODE_DRAFT = "Drafts"; private EntityBrokerManager entityBrokerManager; diff --git a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/jobs/UpdateSynopticMessageCounts.java b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/jobs/UpdateSynopticMessageCounts.java index e36b73da05a9..2941910c9936 100644 --- a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/jobs/UpdateSynopticMessageCounts.java +++ b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/jobs/UpdateSynopticMessageCounts.java @@ -13,8 +13,8 @@ import java.util.Set; import java.util.Map.Entry; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; @@ -40,7 +40,7 @@ public class UpdateSynopticMessageCounts implements Job{ private MessageForumsMessageManager messageManager; private SiteService siteService; - private static final Log LOG = LogFactory.getLog(UpdateSynopticMessageCounts.class); + private static final Logger LOG = LoggerFactory.getLogger(UpdateSynopticMessageCounts.class); private static final boolean runOracleSQL = false; @@ -185,43 +185,43 @@ public void execute(JobExecutionContext arg0) throws JobExecutionException } } catch (Exception e1) { - LOG.error(e1); + LOG.error(e1.getMessage(), e1); } finally { try { if(unreadMessageCountRS != null) unreadMessageCountRS.close(); } catch (Exception e) { - LOG.warn(e); + LOG.warn(e.getMessage()); } try { if(allTopicsAndForumsRS != null) allTopicsAndForumsRS.close(); } catch (Exception e) { - LOG.warn(e); + LOG.warn(e.getMessage()); } try { if(synotpicSitesRS != null) synotpicSitesRS.close(); } catch (Exception e) { - LOG.warn(e); + LOG.warn(e.getMessage()); } try { if(statement != null) statement.close(); } catch (Exception e) { - LOG.warn(e); + LOG.warn(e.getMessage()); } try{ if(unreadMessagesbySitePS != null) unreadMessagesbySitePS.close(); }catch(Exception e){ - LOG.warn(e); + LOG.warn(e.getMessage()); } try{ if(findSitesbySitePS != null) findSitesbySitePS.close(); }catch(Exception e){ - LOG.warn(e); + LOG.warn(e.getMessage()); } SqlService.returnConnection(clConnection); } @@ -264,25 +264,25 @@ private void updateSynopticToolInfoForAllUsers(String siteId, String siteTitle, isForumsPageInSite = true; } }catch (Exception e){ - LOG.warn(e); + LOG.warn(e.getMessage(), e); }finally{ try{ if(rsMessagesForums != null) rsMessagesForums.close(); }catch (Exception e){ - LOG.warn(e); + LOG.warn(e.getMessage()); } try{ if(rsMessages != null) rsMessages.close(); }catch (Exception e){ - LOG.warn(e); + LOG.warn(e.getMessage()); } try{ if(rsForusm != null) rsForusm.close(); }catch (Exception e){ - LOG.warn(e); + LOG.warn(e.getMessage()); } } } @@ -399,38 +399,38 @@ private void updateSynopticToolInfoForAllUsers(String siteId, String siteTitle, } SynopticMsgcntrManagerCover.createOrUpdateSynopticToolInfo(userIds, siteId, siteTitle, unreadCountMap); }catch (Exception e){ - LOG.warn(e); + LOG.warn(e.getMessage(), e); }finally{ try{ if(usersMap != null) usersMap.close(); }catch(Exception e){ - LOG.warn(e); + LOG.warn(e.getMessage(), e); } try{ if(getAllUsersInSiteQuery != null) getAllUsersInSiteQuery.close(); } catch (Exception e) { - LOG.warn(e); + LOG.warn(e.getMessage()); } try { if (isForumsPageInSiteQuery != null) isForumsPageInSiteQuery.close(); } catch (Exception e) { - LOG.warn(e); + LOG.warn(e.getMessage()); } try { if (isMessagesPageInSiteQuery != null) isMessagesPageInSiteQuery.close(); } catch (Exception e) { - LOG.warn(e); + LOG.warn(e.getMessage()); } try { if (isMessageForumsPageInSiteQuery != null) isMessageForumsPageInSiteQuery.close(); } catch (Exception e) { - LOG.warn(e); + LOG.warn(e.getMessage()); } } } @@ -488,7 +488,7 @@ public HashMap> getAllTopicsAndForumsH } } }catch(Exception e){ - LOG.error(e); + LOG.error(e.getMessage(), e); } } @@ -518,7 +518,7 @@ public HashMap> getSiteAndUserMessageCountHM(Re } } }catch(Exception e){ - LOG.error(e); + LOG.error(e.getMessage(), e); } } diff --git a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/ui/DiscussionForumManagerImpl.java b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/ui/DiscussionForumManagerImpl.java index 0f7fc64aca16..5a0a547f73e0 100644 --- a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/ui/DiscussionForumManagerImpl.java +++ b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/ui/DiscussionForumManagerImpl.java @@ -31,8 +31,8 @@ import java.util.Set; import java.util.Vector; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.ActorPermissions; import org.sakaiproject.api.app.messageforums.Area; import org.sakaiproject.api.app.messageforums.AreaControlPermission; @@ -95,8 +95,7 @@ public class DiscussionForumManagerImpl extends HibernateDaoSupport implements DiscussionForumManager { private static final String MC_DEFAULT = "mc.default."; - private static final Log LOG = LogFactory - .getLog(DiscussionForumManagerImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(DiscussionForumManagerImpl.class); private AreaManager areaManager; private MessageForumsForumManager forumManager; private MessageForumsMessageManager messageManager; diff --git a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/ui/PrivateMessageManagerImpl.java b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/ui/PrivateMessageManagerImpl.java index 64712959e3d1..23f8a707efed 100644 --- a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/ui/PrivateMessageManagerImpl.java +++ b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/ui/PrivateMessageManagerImpl.java @@ -33,8 +33,8 @@ import javax.mail.MessagingException; import javax.mail.internet.InternetAddress; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.Hibernate; import org.hibernate.HibernateException; import org.hibernate.LockMode; @@ -86,8 +86,7 @@ public class PrivateMessageManagerImpl extends HibernateDaoSupport implements PrivateMessageManager { - private static final Log LOG = LogFactory - .getLog(PrivateMessageManagerImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(PrivateMessageManagerImpl.class); private static final String QUERY_AGGREGATE_COUNT = "findAggregatePvtMsgCntForUserInContext"; private static final String QUERY_MESSAGES_BY_USER_TYPE_AND_CONTEXT = "findPrvtMsgsByUserTypeContext"; diff --git a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/ui/UIPermissionsManagerImpl.java b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/ui/UIPermissionsManagerImpl.java index 23e438b6e7ed..a63aa9a620a7 100644 --- a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/ui/UIPermissionsManagerImpl.java +++ b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/ui/UIPermissionsManagerImpl.java @@ -29,8 +29,8 @@ import java.util.Map; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.Area; import org.sakaiproject.api.app.messageforums.AreaManager; import org.sakaiproject.api.app.messageforums.DBMembershipItem; @@ -63,8 +63,7 @@ * @author Rashmi Shastri */ public class UIPermissionsManagerImpl implements UIPermissionsManager { - private static final Log LOG = LogFactory - .getLog(UIPermissionsManagerImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(UIPermissionsManagerImpl.class); // dependencies private AuthzGroupService authzGroupService; @@ -109,11 +108,7 @@ public void setForumManager(DiscussionForumManager forumManager) */ public void setAuthzGroupService(AuthzGroupService authzGroupService) { - if (LOG.isDebugEnabled()) - { - LOG.debug("setAuthzGroupService(AuthzGroupService " + authzGroupService - + ")"); - } + LOG.debug("setAuthzGroupService(AuthzGroupService {})", authzGroupService); this.authzGroupService = authzGroupService; } @@ -123,10 +118,7 @@ public void setAuthzGroupService(AuthzGroupService authzGroupService) */ public void setSessionManager(SessionManager sessionManager) { - if (LOG.isDebugEnabled()) - { - LOG.debug("setSessionManager(SessionManager " + sessionManager + ")"); - } + LOG.debug("setSessionManager(SessionManager {})", sessionManager); this.sessionManager = sessionManager; } @@ -136,10 +128,7 @@ public void setSessionManager(SessionManager sessionManager) */ public void setToolManager(ToolManager toolManager) { - if (LOG.isDebugEnabled()) - { - LOG.debug("setToolManager(ToolManager " + toolManager + ")"); - } + LOG.debug("setToolManager(ToolManager {})", toolManager); this.toolManager = toolManager; } @@ -149,11 +138,7 @@ public void setToolManager(ToolManager toolManager) */ public void setPermissionManager(PermissionManager permissionManager) { - if (LOG.isDebugEnabled()) - { - LOG.debug("setPermissionManager(PermissionManager " + permissionManager - + ")"); - } + LOG.debug("setPermissionManager(PermissionManager {})", permissionManager); this.permissionManager = permissionManager; } @@ -163,10 +148,7 @@ public void setPermissionManager(PermissionManager permissionManager) */ public void setTypeManager(MessageForumsTypeManager typeManager) { - if (LOG.isDebugEnabled()) - { - LOG.debug("setTypeManager(MessageForumsTypeManager " + typeManager + ")"); - } + LOG.debug("setTypeManager(MessageForumsTypeManager {})", typeManager); this.typeManager = typeManager; } @@ -176,10 +158,7 @@ public void setTypeManager(MessageForumsTypeManager typeManager) */ public void setSecurityService(SecurityService securityService) { - if (LOG.isDebugEnabled()) - { - LOG.debug("setSecurityService(SecurityService" + securityService + ")"); - } + LOG.debug("setSecurityService(SecurityService {})", securityService); this.securityService = securityService; } @@ -221,10 +200,7 @@ public boolean isNewForum() public boolean isChangeSettings(DiscussionForum forum) { - if (LOG.isDebugEnabled()) - { - LOG.debug("isChangeSettings(DiscussionForum " + forum + ")"); - } + LOG.debug("isChangeSettings(DiscussionForum {})", forum); if (isSuperUser()) { return true; @@ -262,10 +238,7 @@ public boolean isChangeSettings(DiscussionForum forum) */ public boolean isNewTopic(DiscussionForum forum) { - if (LOG.isDebugEnabled()) - { - LOG.debug("isNewTopic(DiscussionForum " + forum + ")"); - } + LOG.debug("isNewTopic(DiscussionForum {})", forum); if (isSuperUser()) { return true; @@ -300,11 +273,7 @@ public boolean isNewResponse(DiscussionTopic topic, DiscussionForum forum) } public boolean isNewResponse(DiscussionTopic topic, DiscussionForum forum, String userId, String contextId){ - if (LOG.isDebugEnabled()) - { - LOG.debug("isNewResponse(DiscussionTopic " + topic + "), DiscussionForum" - + forum + ""); - } + LOG.debug("isNewResponse(DiscussionTopic {}), DiscussionForum {}", topic, forum); try { @@ -345,13 +314,8 @@ public boolean isNewResponseToResponse(DiscussionTopic topic, return isNewResponseToResponse(topic, forum, getCurrentUserId(), getContextId()); } - public boolean isNewResponseToResponse(DiscussionTopic topic, DiscussionForum forum, String userId, String contextId) - { - if (LOG.isDebugEnabled()) - { - LOG.debug("isNewResponseToResponse(DiscussionTopic " + topic - + " , DiscussionForum" + forum + ") "); - } + public boolean isNewResponseToResponse(DiscussionTopic topic, DiscussionForum forum, String userId, String contextId) { + LOG.debug("isNewResponseToResponse(DiscussionTopic {}, DiscussionForum {})", topic, forum); try { @@ -388,11 +352,7 @@ public boolean isNewResponseToResponse(DiscussionTopic topic, DiscussionForum fo */ public boolean isMovePostings(DiscussionTopic topic, DiscussionForum forum) { - if (LOG.isDebugEnabled()) - { - LOG.debug("isMovePostings(DiscussionTopic " + topic - + "), DiscussionForum" + forum + ""); - } + LOG.debug("isMovePostings(DiscussionTopic {}), DiscussionForum {}", topic, forum); try { @@ -436,11 +396,7 @@ public boolean isChangeSettings(DiscussionTopic topic, DiscussionForum forum) public boolean isChangeSettings(DiscussionTopic topic, DiscussionForum forum, String userId) { - if (LOG.isDebugEnabled()) - { - LOG.debug("isChangeSettings(DiscussionTopic " + topic - + "), DiscussionForum" + forum + ""); - } + LOG.debug("isChangeSettings(DiscussionTopic {}), DiscussionForum {}", topic, forum); if (isSuperUser(userId)) { return true; @@ -499,11 +455,7 @@ public boolean isPostToGradebook(DiscussionTopic topic, DiscussionForum forum, S public boolean isPostToGradebook(DiscussionTopic topic, DiscussionForum forum, String userId, String contextId) { - if (LOG.isDebugEnabled()) - { - LOG.debug("isPostToGradebook(DiscussionTopic " + topic - + ", DiscussionForum" + forum + ")"); - } + LOG.debug("isPostToGradebook(DiscussionTopic {}, DiscussionForum {})", topic, forum); try { @@ -555,11 +507,7 @@ public boolean isRead(DiscussionTopic topic, DiscussionForum forum, String userI public boolean isRead(DiscussionTopic topic, DiscussionForum forum, String userId, String siteId) { - if (LOG.isDebugEnabled()) - { - LOG.debug("isRead(DiscussionTopic " + topic + ", DiscussionForum" + forum - + ")"); - } + LOG.debug("isRead(DiscussionTopic {}, DiscussionForum {})", topic, forum); return isRead(topic.getId(), topic.getDraft(), forum.getDraft(), userId, siteId); } @@ -605,11 +553,7 @@ public boolean isReviseAny(DiscussionTopic topic, DiscussionForum forum) } public boolean isReviseAny(DiscussionTopic topic, DiscussionForum forum, String userId, String contextId){ - if (LOG.isDebugEnabled()) - { - LOG.debug("isReviseAny(DiscussionTopic " + topic + ", DiscussionForum" - + forum + ")"); - } + LOG.debug("isReviseAny(DiscussionTopic {}, DiscussionForum {})", topic, forum); try { if (checkBaseConditions(topic, forum, userId, contextId)) @@ -618,12 +562,12 @@ public boolean isReviseAny(DiscussionTopic topic, DiscussionForum forum, String } if (topic.getLocked() == null || topic.getLocked().equals(Boolean.TRUE)) { - LOG.debug("This topic is locked " + topic); + LOG.debug("This topic is locked {}", topic); return false; } if (topic.getDraft() == null || topic.getDraft().equals(Boolean.TRUE)) { - LOG.debug("This topic is at draft stage " + topic); + LOG.debug("This topic is at draft stage {}", topic); } Iterator iter = getTopicItemsByUser(topic, userId, contextId); while (iter.hasNext()) @@ -658,11 +602,7 @@ public boolean isReviseOwn(DiscussionTopic topic, DiscussionForum forum) } public boolean isReviseOwn(DiscussionTopic topic, DiscussionForum forum, String userId, String contextId){ - if (LOG.isDebugEnabled()) - { - LOG.debug("isReviseOwn(DiscussionTopic " + topic + ", DiscussionForum" - + forum + ")"); - } + LOG.debug("isReviseOwn(DiscussionTopic {}, DiscussionForum {})", topic, forum); if (checkBaseConditions(topic, forum, userId, contextId)) { return true; @@ -676,12 +616,12 @@ public boolean isReviseOwn(DiscussionTopic topic, DiscussionForum forum, String if (topic.getLocked() == null || topic.getLocked().equals(Boolean.TRUE)) { - LOG.debug("This topic is locked " + topic); + LOG.debug("This topic is locked {}", topic); return false; } if (topic.getDraft() == null || topic.getDraft().equals(Boolean.TRUE)) { - LOG.debug("This topic is at draft stage " + topic); + LOG.debug("This topic is at draft stage {}", topic); } Iterator iter = getTopicItemsByUser(topic, userId, contextId); while (iter.hasNext()) @@ -716,11 +656,7 @@ public boolean isDeleteAny(DiscussionTopic topic, DiscussionForum forum) } public boolean isDeleteAny(DiscussionTopic topic, DiscussionForum forum, String userId, String contextId){ - if (LOG.isDebugEnabled()) - { - LOG.debug("isDeleteAny(DiscussionTopic " + topic + ", DiscussionForum" - + forum + ")"); - } + LOG.debug("isDeleteAny(DiscussionTopic {}, DiscussionForum {})", topic, forum); if (checkBaseConditions(topic, forum, userId, contextId)) { return true; @@ -733,12 +669,12 @@ public boolean isDeleteAny(DiscussionTopic topic, DiscussionForum forum, String } if (topic.getLocked() == null || topic.getLocked().equals(Boolean.TRUE)) { - LOG.debug("This topic is locked " + topic); + LOG.debug("This topic is locked {}", topic); return false; } if (topic.getDraft() == null || topic.getDraft().equals(Boolean.TRUE)) { - LOG.debug("This topic is at draft stage " + topic); + LOG.debug("This topic is at draft stage {}", topic); } Iterator iter = getTopicItemsByUser(topic, userId, contextId); while (iter.hasNext()) @@ -773,11 +709,7 @@ public boolean isDeleteOwn(DiscussionTopic topic, DiscussionForum forum) } public boolean isDeleteOwn(DiscussionTopic topic, DiscussionForum forum, String userId, String contextId){ - if (LOG.isDebugEnabled()) - { - LOG.debug("isDeleteOwn(DiscussionTopic " + topic + ", DiscussionForum" - + forum + ")"); - } + LOG.debug("isDeleteOwn(DiscussionTopic {}, DiscussionForum {})", topic, forum); if (checkBaseConditions(topic, forum, userId, contextId)) { return true; @@ -790,12 +722,12 @@ public boolean isDeleteOwn(DiscussionTopic topic, DiscussionForum forum, String } if (topic.getLocked() == null || topic.getLocked().equals(Boolean.TRUE)) { - LOG.debug("This topic is locked " + topic); + LOG.debug("This topic is locked {}", topic); return false; } if (topic.getDraft() == null || topic.getDraft().equals(Boolean.TRUE)) { - LOG.debug("This topic is at draft stage " + topic); + LOG.debug("This topic is at draft stage {}", topic); } Iterator iter = getTopicItemsByUser(topic, userId, contextId); while (iter.hasNext()) @@ -826,11 +758,7 @@ public boolean isDeleteOwn(DiscussionTopic topic, DiscussionForum forum, String */ public boolean isMarkAsRead(DiscussionTopic topic, DiscussionForum forum) { - if (LOG.isDebugEnabled()) - { - LOG.debug("isMarkAsRead(DiscussionTopic " + topic + ", DiscussionForum" - + forum + ")"); - } + LOG.debug("isMarkAsRead(DiscussionTopic {}, DiscussionForum {})", topic, forum); if (checkBaseConditions(topic, forum)) { return true; @@ -838,12 +766,12 @@ public boolean isMarkAsRead(DiscussionTopic topic, DiscussionForum forum) if (topic.getLocked() == null || topic.getLocked().equals(Boolean.TRUE)) { - LOG.debug("This topic is locked " + topic); + LOG.debug("This topic is locked {}", topic); return false; } if (topic.getDraft() == null || topic.getDraft().equals(Boolean.TRUE)) { - LOG.debug("This topic is at draft stage " + topic); + LOG.debug("This topic is at draft stage {}", topic); } try { @@ -853,12 +781,12 @@ public boolean isMarkAsRead(DiscussionTopic topic, DiscussionForum forum) } if (topic.getLocked() == null || topic.getLocked().equals(Boolean.TRUE)) { - LOG.debug("This topic is locked " + topic); + LOG.debug("This topic is locked {}", topic); return false; } if (topic.getDraft() == null || topic.getDraft().equals(Boolean.TRUE)) { - LOG.debug("This topic is at draft stage " + topic); + LOG.debug("This topic is at draft stage {}", topic); } Iterator iter = getTopicItemsByCurrentUser(topic); while (iter.hasNext()) @@ -919,7 +847,7 @@ public boolean isModeratePostings(Long topicId, Boolean isForumLocked, Boolean i if (isTopicDraft == null || isTopicDraft.equals(Boolean.TRUE)) { - LOG.debug("This topic is at draft stage " + topicId); + LOG.debug("This topic is at draft stage {}", topicId); } Iterator iter = getTopicItemsByUser(topicId, userId, siteId); while (iter.hasNext()) @@ -1068,11 +996,8 @@ private DBMembershipItem getAreaItemByUserRole() private Iterator getAreaItemsByCurrentUser() { - if (LOG.isDebugEnabled()) - { - LOG.debug("getAreaItemsByCurrentUser()"); - } - + LOG.debug("getAreaItemsByCurrentUser()"); + List areaItems = new ArrayList(); if (ThreadLocalManager.get("message_center_permission_set") == null || !((Boolean)ThreadLocalManager.get("message_center_permission_set")).booleanValue()) @@ -1397,10 +1322,7 @@ public boolean isInstructor() */ private boolean isInstructor(User user) { - if (LOG.isDebugEnabled()) - { - LOG.debug("isInstructor(User " + user + ")"); - } + LOG.debug("isInstructor(User {})", user); if (user != null) return securityService.unlock(user, "site.upd", getContextSiteId()); else @@ -1533,11 +1455,7 @@ private boolean checkBaseConditions(DiscussionTopic topic, private boolean checkBaseConditions(DiscussionTopic topic, DiscussionForum forum, String userId, String contextSiteId) { - if (LOG.isDebugEnabled()) - { - LOG.debug("checkBaseConditions(DiscussionTopic " + topic - + ", DiscussionForum " + forum + ")"); - } + LOG.debug("checkBaseConditions(DiscussionTopic {}, DiscussionForum {})", topic, forum); if (isSuperUser(userId)) { return true; @@ -1547,10 +1465,7 @@ private boolean checkBaseConditions(DiscussionTopic topic, private boolean isRoleMember(String roleId) { - if (LOG.isDebugEnabled()) - { - LOG.debug("isRoleMember(String " + roleId + ")"); - } + LOG.debug("isRoleMember(String {})", roleId); if (getCurrentUserRole().equals(roleId)) { return true; @@ -1560,11 +1475,7 @@ private boolean isRoleMember(String roleId) private boolean isGroupMember(String groupId) { - if (LOG.isDebugEnabled()) - { - LOG.debug("setAuthzGroupService(AuthzGroupService " + authzGroupService - + ")"); - } + LOG.debug("setAuthzGroupService(AuthzGroupService {})", authzGroupService); try { Site site = SiteService.getSite(toolManager.getCurrentPlacement().getContext()); @@ -1580,7 +1491,7 @@ private boolean isGroupMember(String groupId) } catch (IdUnusedException e) { - LOG.debug("Group with id " + groupId + " not found"); + LOG.debug("Group with id {} not found", groupId); return false; } diff --git a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/ActorPermissionsImpl.java b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/ActorPermissionsImpl.java index aae77ea03283..c95037067d6a 100644 --- a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/ActorPermissionsImpl.java +++ b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/ActorPermissionsImpl.java @@ -22,15 +22,15 @@ import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.ActorPermissions; import org.sakaiproject.api.app.messageforums.MessageForumsUser; import org.sakaiproject.api.app.messageforums.UniqueArrayList; public class ActorPermissionsImpl implements ActorPermissions { - private static final Log LOG = LogFactory.getLog(ActorPermissionsImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(ActorPermissionsImpl.class); private List contributors = new UniqueArrayList(); private List accessors = new UniqueArrayList(); diff --git a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/AreaImpl.java b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/AreaImpl.java index 51d30536e5f7..7081bd876e01 100644 --- a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/AreaImpl.java +++ b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/AreaImpl.java @@ -26,8 +26,8 @@ import java.util.Set; import java.util.TreeSet; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.Area; import org.sakaiproject.api.app.messageforums.BaseForum; import org.sakaiproject.api.app.messageforums.DBMembershipItem; @@ -35,7 +35,7 @@ public class AreaImpl extends MutableEntityImpl implements Area { - private static final Log LOG = LogFactory.getLog(AreaImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(AreaImpl.class); private String contextId; diff --git a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/AttachmentImpl.java b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/AttachmentImpl.java index 667aa55a0258..4aad49fd3394 100644 --- a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/AttachmentImpl.java +++ b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/AttachmentImpl.java @@ -20,8 +20,8 @@ **********************************************************************************/ package org.sakaiproject.component.app.messageforums.dao.hibernate; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.Attachment; import org.sakaiproject.api.app.messageforums.BaseForum; import org.sakaiproject.api.app.messageforums.Message; @@ -31,7 +31,7 @@ public class AttachmentImpl extends MutableEntityImpl implements Attachment { - private static final Log LOG = LogFactory.getLog(AttachmentImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(AttachmentImpl.class); private String attachmentId; diff --git a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/BaseForumImpl.java b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/BaseForumImpl.java index 4cda9fdc91c3..b5957dac8c50 100644 --- a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/BaseForumImpl.java +++ b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/BaseForumImpl.java @@ -27,8 +27,8 @@ import java.util.SortedSet; import java.util.TreeSet; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.Area; import org.sakaiproject.api.app.messageforums.Attachment; import org.sakaiproject.api.app.messageforums.BaseForum; @@ -39,7 +39,7 @@ public class BaseForumImpl extends MutableEntityImpl implements BaseForum { - private static final Log LOG = LogFactory.getLog(BaseForumImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(BaseForumImpl.class); private String title; private String shortDescription; diff --git a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/ControlPermissionsImpl.java b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/ControlPermissionsImpl.java index 02e3bd4b25ae..f1254013a889 100644 --- a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/ControlPermissionsImpl.java +++ b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/ControlPermissionsImpl.java @@ -20,8 +20,8 @@ **********************************************************************************/ package org.sakaiproject.component.app.messageforums.dao.hibernate; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.Area; import org.sakaiproject.api.app.messageforums.BaseForum; import org.sakaiproject.api.app.messageforums.ControlPermissions; @@ -29,7 +29,7 @@ public class ControlPermissionsImpl implements ControlPermissions { - private static final Log LOG = LogFactory.getLog(ControlPermissionsImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(ControlPermissionsImpl.class); private String role; diff --git a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/DateRestrictionsImpl.java b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/DateRestrictionsImpl.java index d0d90a38484b..657a7056125c 100644 --- a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/DateRestrictionsImpl.java +++ b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/DateRestrictionsImpl.java @@ -22,13 +22,13 @@ import java.util.Date; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.DateRestrictions; public class DateRestrictionsImpl implements DateRestrictions { - private static final Log LOG = LogFactory.getLog(DateRestrictionsImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(DateRestrictionsImpl.class); private Date visible; private Boolean visiblePostOnSchedule; diff --git a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/DiscussionForumImpl.java b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/DiscussionForumImpl.java index 4ee00b786c12..a3dbe1228525 100644 --- a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/DiscussionForumImpl.java +++ b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/DiscussionForumImpl.java @@ -22,8 +22,8 @@ import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.ActorPermissions; import org.sakaiproject.api.app.messageforums.DateRestrictions; import org.sakaiproject.api.app.messageforums.DiscussionForum; @@ -32,7 +32,7 @@ public class DiscussionForumImpl extends OpenForumImpl implements DiscussionForum { - private static final Log LOG = LogFactory.getLog(DiscussionForumImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(DiscussionForumImpl.class); private List labels = new UniqueArrayList(); private DateRestrictions dateRestrictions; diff --git a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/DiscussionTopicImpl.java b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/DiscussionTopicImpl.java index 1ce52636d501..658d01a84ddd 100644 --- a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/DiscussionTopicImpl.java +++ b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/DiscussionTopicImpl.java @@ -22,8 +22,8 @@ import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.ActorPermissions; import org.sakaiproject.api.app.messageforums.DateRestrictions; import org.sakaiproject.api.app.messageforums.DiscussionTopic; @@ -32,7 +32,7 @@ public class DiscussionTopicImpl extends OpenTopicImpl implements DiscussionTopic { - private static final Log LOG = LogFactory.getLog(DiscussionTopicImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(DiscussionTopicImpl.class); private Boolean confidentialResponses; private Boolean mustRespondBeforeReading; diff --git a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/EmailNotificationImpl.java b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/EmailNotificationImpl.java index 23c0f1fe3b0e..8806ede24d22 100644 --- a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/EmailNotificationImpl.java +++ b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/EmailNotificationImpl.java @@ -21,13 +21,13 @@ package org.sakaiproject.component.app.messageforums.dao.hibernate; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.EmailNotification; public class EmailNotificationImpl implements EmailNotification { - private static final Log LOG = LogFactory.getLog(EmailNotificationImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(EmailNotificationImpl.class); private Long id; private String notificationLevel; diff --git a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/LabelImpl.java b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/LabelImpl.java index b94c5f44eaf8..522715bda415 100644 --- a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/LabelImpl.java +++ b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/LabelImpl.java @@ -20,15 +20,15 @@ **********************************************************************************/ package org.sakaiproject.component.app.messageforums.dao.hibernate; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.DiscussionForum; import org.sakaiproject.api.app.messageforums.DiscussionTopic; import org.sakaiproject.api.app.messageforums.Label; public class LabelImpl extends MutableEntityImpl implements Label { - private static final Log LOG = LogFactory.getLog(LabelImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(LabelImpl.class); private String key; private String value; diff --git a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/MessageImpl.java b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/MessageImpl.java index 08d579023c38..9039f8e5b1dc 100644 --- a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/MessageImpl.java +++ b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/MessageImpl.java @@ -26,8 +26,8 @@ import java.util.List; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.Attachment; import org.sakaiproject.api.app.messageforums.Message; import org.sakaiproject.api.app.messageforums.Topic; @@ -35,7 +35,7 @@ public class MessageImpl extends MutableEntityImpl implements Message { - private static final Log LOG = LogFactory.getLog(MessageImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(MessageImpl.class); private String title; private String body; diff --git a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/MessagePermissionsImpl.java b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/MessagePermissionsImpl.java index a4497cadff59..0bdc928466df 100644 --- a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/MessagePermissionsImpl.java +++ b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/MessagePermissionsImpl.java @@ -20,8 +20,8 @@ **********************************************************************************/ package org.sakaiproject.component.app.messageforums.dao.hibernate; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.Area; import org.sakaiproject.api.app.messageforums.BaseForum; import org.sakaiproject.api.app.messageforums.MessagePermissions; @@ -29,7 +29,7 @@ public class MessagePermissionsImpl implements MessagePermissions { - private static final Log LOG = LogFactory.getLog(MessagePermissionsImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(MessagePermissionsImpl.class); private String role; diff --git a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/MutableEntityImpl.java b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/MutableEntityImpl.java index d98334f6e463..e9b712f823cb 100644 --- a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/MutableEntityImpl.java +++ b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/MutableEntityImpl.java @@ -22,13 +22,13 @@ import java.util.Date; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.MutableEntity; public class MutableEntityImpl implements MutableEntity { - private static final Log LOG = LogFactory.getLog(MutableEntityImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(MutableEntityImpl.class); protected Long id; protected String uuid; diff --git a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/OpenForumImpl.java b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/OpenForumImpl.java index 84599fdbecff..d8f5b1a0d7ea 100644 --- a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/OpenForumImpl.java +++ b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/OpenForumImpl.java @@ -22,14 +22,14 @@ import java.util.Date; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.OpenForum; import org.sakaiproject.api.app.messageforums.DBMembershipItem; public class OpenForumImpl extends BaseForumImpl implements OpenForum { - private static final Log LOG = LogFactory.getLog(OpenForumImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(OpenForumImpl.class); private Boolean draft; private Boolean locked; diff --git a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/OpenTopicImpl.java b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/OpenTopicImpl.java index 03069ad89494..ac0d8342a592 100644 --- a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/OpenTopicImpl.java +++ b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/OpenTopicImpl.java @@ -20,13 +20,13 @@ **********************************************************************************/ package org.sakaiproject.component.app.messageforums.dao.hibernate; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.OpenTopic; public class OpenTopicImpl extends TopicImpl implements OpenTopic { - private static final Log LOG = LogFactory.getLog(OpenTopicImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(OpenTopicImpl.class); private Boolean locked; private Boolean draft; diff --git a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/PrivateForumImpl.java b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/PrivateForumImpl.java index 332c827350d3..4930f889d73a 100644 --- a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/PrivateForumImpl.java +++ b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/PrivateForumImpl.java @@ -20,13 +20,13 @@ **********************************************************************************/ package org.sakaiproject.component.app.messageforums.dao.hibernate; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.PrivateForum; public class PrivateForumImpl extends BaseForumImpl implements PrivateForum { - private static final Log LOG = LogFactory.getLog(PrivateForumImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(PrivateForumImpl.class); private String owner; private Boolean autoForward; diff --git a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/PrivateMessageImpl.java b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/PrivateMessageImpl.java index f49e4ce88d7d..7e543be7e38d 100644 --- a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/PrivateMessageImpl.java +++ b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/PrivateMessageImpl.java @@ -23,14 +23,14 @@ import java.util.Comparator; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.MessageForumsUser; import org.sakaiproject.api.app.messageforums.PrivateMessage; public class PrivateMessageImpl extends MessageImpl implements PrivateMessage { - private static final Log LOG = LogFactory.getLog(PrivateMessageImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(PrivateMessageImpl.class); private List recipients = null;//new UniqueArrayList(); addRecipient(MessageForumsUser user) private Boolean externalEmail; diff --git a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/PrivateTopicImpl.java b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/PrivateTopicImpl.java index a5549d538e09..48e28b0c65f0 100644 --- a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/PrivateTopicImpl.java +++ b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/PrivateTopicImpl.java @@ -26,14 +26,14 @@ import java.util.List; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.PrivateTopic; import org.sakaiproject.api.app.messageforums.Topic; public class PrivateTopicImpl extends TopicImpl implements PrivateTopic { - private static final Log LOG = LogFactory.getLog(PrivateTopicImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(PrivateTopicImpl.class); private String userId; private String contextId; diff --git a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/RankImageImpl.java b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/RankImageImpl.java index 272fafd0b1e4..b41a6b7871bc 100644 --- a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/RankImageImpl.java +++ b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/RankImageImpl.java @@ -20,14 +20,14 @@ **********************************************************************************/ package org.sakaiproject.component.app.messageforums.dao.hibernate; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.Rank; import org.sakaiproject.api.app.messageforums.RankImage; public class RankImageImpl extends MutableEntityImpl implements RankImage { - private static final Log LOG = LogFactory.getLog(RankImageImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(RankImageImpl.class); private Long rankImageId; diff --git a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/RankImpl.java b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/RankImpl.java index 547156542257..a08e353e9973 100644 --- a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/RankImpl.java +++ b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/RankImpl.java @@ -26,8 +26,8 @@ import java.util.TreeSet; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.Rank; import org.sakaiproject.api.app.messageforums.RankImage; import org.sakaiproject.component.app.messageforums.dao.hibernate.util.comparator.AttachmentByCreatedDateDesc; @@ -36,7 +36,7 @@ public class RankImpl extends MutableEntityImpl implements Rank { - private static final Log LOG = LogFactory.getLog(RankImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(RankImpl.class); private String title; private String type; private Set assignToIds; diff --git a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/TopicImpl.java b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/TopicImpl.java index 75c7c6ef11da..96e40a37c6e8 100644 --- a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/TopicImpl.java +++ b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/TopicImpl.java @@ -28,8 +28,8 @@ import java.util.SortedSet; import java.util.TreeSet; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.AnonymousManager; import org.sakaiproject.api.app.messageforums.Attachment; import org.sakaiproject.api.app.messageforums.BaseForum; @@ -45,7 +45,7 @@ public abstract class TopicImpl extends MutableEntityImpl implements Topic { - private static final Log LOG = LogFactory.getLog(TopicImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(TopicImpl.class); private String title; private String shortDescription; diff --git a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/UnreadStatusImpl.java b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/UnreadStatusImpl.java index 419ca5504514..be2ac9fede73 100644 --- a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/UnreadStatusImpl.java +++ b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/UnreadStatusImpl.java @@ -20,13 +20,13 @@ **********************************************************************************/ package org.sakaiproject.component.app.messageforums.dao.hibernate; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.UnreadStatus; public class UnreadStatusImpl implements UnreadStatus { - private static final Log LOG = LogFactory.getLog(UnreadStatusImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(UnreadStatusImpl.class); private Long topicId; private Long messageId; diff --git a/oauth/api/src/java/org/sakaiproject/oauth/filter/OAuthPostFilter.java b/oauth/api/src/java/org/sakaiproject/oauth/filter/OAuthPostFilter.java index dd4e85a8e0dd..1d4d0639b122 100755 --- a/oauth/api/src/java/org/sakaiproject/oauth/filter/OAuthPostFilter.java +++ b/oauth/api/src/java/org/sakaiproject/oauth/filter/OAuthPostFilter.java @@ -1,8 +1,8 @@ package org.sakaiproject.oauth.filter; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ComponentManager; import org.sakaiproject.event.api.UsageSessionService; import org.sakaiproject.tool.api.SessionManager; @@ -31,7 +31,7 @@ * @author Colin Hebert */ public class OAuthPostFilter implements Filter { - private static final Log log = LogFactory.getLog(OAuthPostFilter.class); + private static final Logger log = LoggerFactory.getLogger(OAuthPostFilter.class); private OAuthHttpService oAuthHttpService; private SessionManager sessionManager; private UserDirectoryService userDirectoryService; diff --git a/podcasts/podcasts-app/src/java/org/sakaiproject/tool/podcasts/podHomeBean.java b/podcasts/podcasts-app/src/java/org/sakaiproject/tool/podcasts/podHomeBean.java index 9ce3f3120490..d8b0e9e7142e 100644 --- a/podcasts/podcasts-app/src/java/org/sakaiproject/tool/podcasts/podHomeBean.java +++ b/podcasts/podcasts-app/src/java/org/sakaiproject/tool/podcasts/podHomeBean.java @@ -48,8 +48,8 @@ import javax.servlet.http.HttpServletRequest; import org.apache.commons.fileupload.FileItem; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.podcasts.PodcastPermissionsService; import org.sakaiproject.api.app.podcasts.PodcastService; import org.sakaiproject.api.app.podcasts.exception.PodcastException; @@ -387,7 +387,7 @@ public void setHidden(boolean hidden) { private PodcastService podcastService; private PodcastPermissionsService podcastPermissionsService; - private Log LOG = LogFactory.getLog(podHomeBean.class); + private Logger LOG = LoggerFactory.getLogger(podHomeBean.class); // variables to hold miscellanous information private List contents; diff --git a/podcasts/podcasts-app/src/java/org/sakaiproject/tool/podcasts/podPermBean.java b/podcasts/podcasts-app/src/java/org/sakaiproject/tool/podcasts/podPermBean.java index 7aa950240b50..5e7e22dd473a 100644 --- a/podcasts/podcasts-app/src/java/org/sakaiproject/tool/podcasts/podPermBean.java +++ b/podcasts/podcasts-app/src/java/org/sakaiproject/tool/podcasts/podPermBean.java @@ -37,8 +37,8 @@ import javax.faces.el.ValueBinding; import javax.faces.model.SelectItem; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.podcasts.PodcastService; import org.sakaiproject.authz.api.AuthzGroup; import org.sakaiproject.authz.api.GroupNotDefinedException; @@ -353,7 +353,7 @@ public void setNumColumns(int numColumns) { private List checkboxTableValues; // injected beans - private Log LOG = LogFactory.getLog(podPermBean.class); + private Logger LOG = LoggerFactory.getLogger(podPermBean.class); private PodcastService podcastService; /** diff --git a/podcasts/podcasts-impl/impl/src/java/org/sakaiproject/component/app/podcasts/BasicPodfeedService.java b/podcasts/podcasts-impl/impl/src/java/org/sakaiproject/component/app/podcasts/BasicPodfeedService.java index 5f79fcbd0023..019e9111fc97 100644 --- a/podcasts/podcasts-impl/impl/src/java/org/sakaiproject/component/app/podcasts/BasicPodfeedService.java +++ b/podcasts/podcasts-impl/impl/src/java/org/sakaiproject/component/app/podcasts/BasicPodfeedService.java @@ -34,8 +34,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.podcasts.PodcastPermissionsService; import org.sakaiproject.api.app.podcasts.PodcastService; import org.sakaiproject.api.app.podcasts.PodfeedService; @@ -109,7 +109,7 @@ public class BasicPodfeedService implements PodfeedService { private final String PODFEED_MESSAGE_BUNDLE = "org.sakaiproject.api.podcasts.bundle.Messages"; private ResourceLoader resbud = new ResourceLoader(PODFEED_MESSAGE_BUNDLE); - private static final Log LOG = LogFactory.getLog(BasicPodfeedService.class); + private static final Logger LOG = LoggerFactory.getLogger(BasicPodfeedService.class); private PodcastService podcastService; private PodcastPermissionsService podcastPermissionsService; diff --git a/podcasts/podcasts-impl/impl/src/java/org/sakaiproject/component/app/podcasts/PodcastComparator.java b/podcasts/podcasts-impl/impl/src/java/org/sakaiproject/component/app/podcasts/PodcastComparator.java index 674bef5d5eca..2162add2ae50 100644 --- a/podcasts/podcasts-impl/impl/src/java/org/sakaiproject/component/app/podcasts/PodcastComparator.java +++ b/podcasts/podcasts-impl/impl/src/java/org/sakaiproject/component/app/podcasts/PodcastComparator.java @@ -24,8 +24,8 @@ import java.util.Comparator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.content.api.ContentResource; import org.sakaiproject.entity.api.EntityPropertyNotDefinedException; import org.sakaiproject.entity.api.EntityPropertyTypeException; @@ -33,7 +33,7 @@ public class PodcastComparator implements Comparator { - private Log LOG = LogFactory.getLog(PodcastServiceImpl.class); + private Logger LOG = LoggerFactory.getLogger(PodcastServiceImpl.class); private String m_property = null; diff --git a/podcasts/podcasts-impl/impl/src/java/org/sakaiproject/component/app/podcasts/PodcastServiceImpl.java b/podcasts/podcasts-impl/impl/src/java/org/sakaiproject/component/app/podcasts/PodcastServiceImpl.java index 5322839efeef..3d0e89beb6cf 100644 --- a/podcasts/podcasts-impl/impl/src/java/org/sakaiproject/component/app/podcasts/PodcastServiceImpl.java +++ b/podcasts/podcasts-impl/impl/src/java/org/sakaiproject/component/app/podcasts/PodcastServiceImpl.java @@ -31,8 +31,8 @@ import java.util.Iterator; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.podcasts.PodcastPermissionsService; import org.sakaiproject.api.app.podcasts.PodcastService; import org.sakaiproject.api.app.podcasts.exception.PodcastException; @@ -102,7 +102,7 @@ public class PodcastServiceImpl implements PodcastService { private static final int PUBLIC = 0; private static final int SITE = 1; - private static Log LOG = LogFactory.getLog(PodcastServiceImpl.class); + private static Logger LOG = LoggerFactory.getLogger(PodcastServiceImpl.class); private Reference siteRef; @@ -1057,7 +1057,7 @@ public List checkDISPLAY_DATE(List resourcesList, String siteId) { aResource = getAResource(id); } catch (Exception e) { - LOG.error(e); + LOG.error(e.getMessage()); } } } @@ -1094,7 +1094,7 @@ public List checkDISPLAY_DATE(List resourcesList, String siteId) { } catch (Exception e1) { // PermissionException, IdUnusedException from getAResource - LOG.error(e1); + LOG.error(e1.getMessage()); } } catch (EntityPropertyTypeException e) { @@ -1667,4 +1667,4 @@ public boolean allowOptions(int option) { return true; } -} \ No newline at end of file +} diff --git a/podcasts/podcasts/src/java/org/sakaiproject/tool/podcasts/RSSPodfeedServlet.java b/podcasts/podcasts/src/java/org/sakaiproject/tool/podcasts/RSSPodfeedServlet.java index 77cf9bf3dc74..27e40fae143b 100644 --- a/podcasts/podcasts/src/java/org/sakaiproject/tool/podcasts/RSSPodfeedServlet.java +++ b/podcasts/podcasts/src/java/org/sakaiproject/tool/podcasts/RSSPodfeedServlet.java @@ -29,8 +29,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.codec.binary.Base64; import org.sakaiproject.api.app.podcasts.PodfeedService; import org.sakaiproject.component.cover.ComponentManager; @@ -59,7 +59,7 @@ public class RSSPodfeedServlet extends HttpServlet { private PodfeedService podfeedService; - private final Log LOG = LogFactory.getLog(RSSPodfeedServlet.class); + private final Logger LOG = LoggerFactory.getLogger(RSSPodfeedServlet.class); /** * The doGet method of the servlet.
diff --git a/polls/impl/src/java/org/sakaiproject/poll/dao/impl/PollDoaImpl.java b/polls/impl/src/java/org/sakaiproject/poll/dao/impl/PollDoaImpl.java index 57add4862173..08d18e78b624 100644 --- a/polls/impl/src/java/org/sakaiproject/poll/dao/impl/PollDoaImpl.java +++ b/polls/impl/src/java/org/sakaiproject/poll/dao/impl/PollDoaImpl.java @@ -23,8 +23,8 @@ import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.Query; import org.hibernate.Session; import org.sakaiproject.genericdao.hibernate.HibernateGeneralGenericDao; @@ -33,7 +33,7 @@ public class PollDoaImpl extends HibernateGeneralGenericDao implements PollDao { - private static Log log = LogFactory.getLog(PollDoaImpl.class); + private static Logger log = LoggerFactory.getLogger(PollDoaImpl.class); public void init() { log.debug("init"); diff --git a/polls/impl/src/java/org/sakaiproject/poll/logic/impl/ExternalLogicImpl.java b/polls/impl/src/java/org/sakaiproject/poll/logic/impl/ExternalLogicImpl.java index 217e56b3a4a0..1d244e9e00d7 100644 --- a/polls/impl/src/java/org/sakaiproject/poll/logic/impl/ExternalLogicImpl.java +++ b/polls/impl/src/java/org/sakaiproject/poll/logic/impl/ExternalLogicImpl.java @@ -39,8 +39,8 @@ import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroup; import org.sakaiproject.authz.api.AuthzGroupService; import org.sakaiproject.authz.api.AuthzPermissionException; @@ -87,7 +87,7 @@ public class ExternalLogicImpl implements ExternalLogic { - private static Log log = LogFactory.getLog(ExternalLogicImpl.class); + private static Logger log = LoggerFactory.getLogger(ExternalLogicImpl.class); private static final String /* Email template constants */ diff --git a/polls/impl/src/java/org/sakaiproject/poll/service/impl/PollListManagerImpl.java b/polls/impl/src/java/org/sakaiproject/poll/service/impl/PollListManagerImpl.java index 5246f2a8b6d9..672f2db3b269 100644 --- a/polls/impl/src/java/org/sakaiproject/poll/service/impl/PollListManagerImpl.java +++ b/polls/impl/src/java/org/sakaiproject/poll/service/impl/PollListManagerImpl.java @@ -34,8 +34,8 @@ import java.util.UUID; import java.util.Vector; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.entity.api.Entity; import org.sakaiproject.entity.api.EntityManager; import org.sakaiproject.entity.api.EntityTransferrer; @@ -64,7 +64,7 @@ public class PollListManagerImpl implements PollListManager,EntityTransferrer { // use commons logger - private static Log log = LogFactory.getLog(PollListManagerImpl.class); + private static Logger log = LoggerFactory.getLogger(PollListManagerImpl.class); public static final String REFERENCE_ROOT = Entity.SEPARATOR + "poll"; diff --git a/polls/impl/src/java/org/sakaiproject/poll/service/impl/PollVoteManagerImpl.java b/polls/impl/src/java/org/sakaiproject/poll/service/impl/PollVoteManagerImpl.java index 782f273d2544..906fba6a9993 100644 --- a/polls/impl/src/java/org/sakaiproject/poll/service/impl/PollVoteManagerImpl.java +++ b/polls/impl/src/java/org/sakaiproject/poll/service/impl/PollVoteManagerImpl.java @@ -27,8 +27,8 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.genericdao.api.search.Restriction; import org.sakaiproject.genericdao.api.search.Search; import org.sakaiproject.poll.dao.PollDao; @@ -44,7 +44,7 @@ public class PollVoteManagerImpl implements PollVoteManager { // use commons logger - private static Log log = LogFactory.getLog(PollListManagerImpl.class); + private static Logger log = LoggerFactory.getLogger(PollListManagerImpl.class); private ExternalLogic externalLogic; public void setExternalLogic(ExternalLogic externalLogic) { diff --git a/polls/impl/src/test/org/sakaiproject/poll/logic/test/PollListManagerTest.java b/polls/impl/src/test/org/sakaiproject/poll/logic/test/PollListManagerTest.java index f33b8b56a3c5..d78a3f33e647 100644 --- a/polls/impl/src/test/org/sakaiproject/poll/logic/test/PollListManagerTest.java +++ b/polls/impl/src/test/org/sakaiproject/poll/logic/test/PollListManagerTest.java @@ -23,8 +23,8 @@ import java.util.Date; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -45,7 +45,7 @@ "classpath:org/sakaiproject/poll/spring-hibernate.xml" }) public class PollListManagerTest extends AbstractJUnit4SpringContextTests { - private static Log log = LogFactory.getLog(PollListManagerTest.class); + private static Logger log = LoggerFactory.getLogger(PollListManagerTest.class); private TestDataPreload tdp = new TestDataPreload(); diff --git a/polls/tool/src/java/org/sakaiproject/poll/tool/entityproviders/PollVoteEntityProvider.java b/polls/tool/src/java/org/sakaiproject/poll/tool/entityproviders/PollVoteEntityProvider.java index 5dd8c831226c..89af1dc83500 100644 --- a/polls/tool/src/java/org/sakaiproject/poll/tool/entityproviders/PollVoteEntityProvider.java +++ b/polls/tool/src/java/org/sakaiproject/poll/tool/entityproviders/PollVoteEntityProvider.java @@ -32,8 +32,8 @@ import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.entitybroker.EntityReference; import org.sakaiproject.entitybroker.EntityView; import org.sakaiproject.entitybroker.entityprovider.CoreEntityProvider; @@ -68,7 +68,7 @@ public class PollVoteEntityProvider extends AbstractEntityProvider implements CoreEntityProvider, Createable, CollectionResolvable, Outputable, Inputable, Describeable, ActionsExecutable, Redirectable { - private static Log log = LogFactory.getLog(PollVoteEntityProvider.class); + private static Logger log = LoggerFactory.getLogger(PollVoteEntityProvider.class); private PollListManager pollListManager; public void setPollListManager(final PollListManager pollListManager) { this.pollListManager = pollListManager; @@ -119,7 +119,7 @@ public String createEntity(EntityReference ref, Object entity, Map staticCacheHolder = new ThreadLocal<>(); - private static final Log log = LogFactory.getLog(StaticHandler.class); + private static final Logger log = LoggerFactory.getLogger(StaticHandler.class); public StaticHandler() { diff --git a/portal/portal-impl/impl/src/java/org/sakaiproject/portal/charon/handlers/ToolHandler.java b/portal/portal-impl/impl/src/java/org/sakaiproject/portal/charon/handlers/ToolHandler.java index 7c7acb22773a..df465256ba55 100644 --- a/portal/portal-impl/impl/src/java/org/sakaiproject/portal/charon/handlers/ToolHandler.java +++ b/portal/portal-impl/impl/src/java/org/sakaiproject/portal/charon/handlers/ToolHandler.java @@ -29,8 +29,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.SecurityAdvisor; import org.sakaiproject.authz.cover.SecurityService; @@ -64,7 +64,7 @@ */ public class ToolHandler extends BasePortalHandler { - private static Log M_log = LogFactory.getLog(ToolHandler.class); + private static Logger M_log = LoggerFactory.getLogger(ToolHandler.class); private static final String URL_FRAGMENT = "tool"; diff --git a/portal/portal-impl/impl/src/java/org/sakaiproject/portal/charon/handlers/WorksiteHandler.java b/portal/portal-impl/impl/src/java/org/sakaiproject/portal/charon/handlers/WorksiteHandler.java index 075ec5c5071f..13b2ea6d5581 100644 --- a/portal/portal-impl/impl/src/java/org/sakaiproject/portal/charon/handlers/WorksiteHandler.java +++ b/portal/portal-impl/impl/src/java/org/sakaiproject/portal/charon/handlers/WorksiteHandler.java @@ -27,8 +27,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.exception.IdUnusedException; import org.sakaiproject.exception.PermissionException; @@ -57,7 +57,7 @@ public class WorksiteHandler extends PageHandler private static final String URL_FRAGMENT = "worksite"; - private static final Log log = LogFactory.getLog(WorksiteHandler.class); + private static final Logger log = LoggerFactory.getLogger(WorksiteHandler.class); public WorksiteHandler() { diff --git a/portal/portal-impl/impl/src/java/org/sakaiproject/portal/charon/site/DefaultSiteViewImpl.java b/portal/portal-impl/impl/src/java/org/sakaiproject/portal/charon/site/DefaultSiteViewImpl.java index 01eaad7a6fbb..e07f0642293f 100644 --- a/portal/portal-impl/impl/src/java/org/sakaiproject/portal/charon/site/DefaultSiteViewImpl.java +++ b/portal/portal-impl/impl/src/java/org/sakaiproject/portal/charon/site/DefaultSiteViewImpl.java @@ -28,8 +28,8 @@ import javax.servlet.http.HttpServletRequest; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.entity.api.ResourceProperties; @@ -51,7 +51,7 @@ */ public class DefaultSiteViewImpl extends AbstractSiteViewImpl { - private static final Log LOG = LogFactory.getLog(DefaultSiteViewImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(DefaultSiteViewImpl.class); /** * @param siteHelper diff --git a/portal/portal-impl/impl/src/java/org/sakaiproject/portal/charon/site/MoreSiteViewImpl.java b/portal/portal-impl/impl/src/java/org/sakaiproject/portal/charon/site/MoreSiteViewImpl.java index f055ad168780..c02b7a5049f5 100644 --- a/portal/portal-impl/impl/src/java/org/sakaiproject/portal/charon/site/MoreSiteViewImpl.java +++ b/portal/portal-impl/impl/src/java/org/sakaiproject/portal/charon/site/MoreSiteViewImpl.java @@ -34,8 +34,8 @@ import javax.servlet.http.HttpServletRequest; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.entity.api.ResourceProperties; @@ -62,7 +62,7 @@ */ public class MoreSiteViewImpl extends AbstractSiteViewImpl { - private static final Log LOG = LogFactory.getLog(MoreSiteViewImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(MoreSiteViewImpl.class); /** messages. */ private static ResourceLoader rb = new ResourceLoader("sitenav"); diff --git a/portal/portal-impl/impl/src/java/org/sakaiproject/portal/charon/site/PortalSiteHelperImpl.java b/portal/portal-impl/impl/src/java/org/sakaiproject/portal/charon/site/PortalSiteHelperImpl.java index 99897c6c333f..d7ca001b6dde 100644 --- a/portal/portal-impl/impl/src/java/org/sakaiproject/portal/charon/site/PortalSiteHelperImpl.java +++ b/portal/portal-impl/impl/src/java/org/sakaiproject/portal/charon/site/PortalSiteHelperImpl.java @@ -37,8 +37,8 @@ import javax.servlet.http.HttpServletRequest; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.alias.api.Alias; import org.sakaiproject.alias.api.AliasService; import org.sakaiproject.authz.cover.SecurityService; @@ -91,7 +91,7 @@ public class PortalSiteHelperImpl implements PortalSiteHelper // Alias prefix for page aliases. Use Entity.SEPARATOR as IDs shouldn't contain it. private static final String PAGE_ALIAS = Entity.SEPARATOR+ "pagealias"+ Entity.SEPARATOR; - private static final Log log = LogFactory.getLog(PortalSiteHelper.class); + private static final Logger log = LoggerFactory.getLogger(PortalSiteHelper.class); private final String PROP_PARENT_ID = SiteService.PROP_PARENT_ID; diff --git a/portal/portal-render-engine-impl/impl/src/java/org/sakaiproject/portal/charon/velocity/PortalRenderEngineContextListener.java b/portal/portal-render-engine-impl/impl/src/java/org/sakaiproject/portal/charon/velocity/PortalRenderEngineContextListener.java index 427ad6b5f203..de7f82125223 100644 --- a/portal/portal-render-engine-impl/impl/src/java/org/sakaiproject/portal/charon/velocity/PortalRenderEngineContextListener.java +++ b/portal/portal-render-engine-impl/impl/src/java/org/sakaiproject/portal/charon/velocity/PortalRenderEngineContextListener.java @@ -24,8 +24,8 @@ import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.portal.api.Portal; import org.sakaiproject.portal.api.cover.PortalService; @@ -41,8 +41,7 @@ public class PortalRenderEngineContextListener implements ServletContextListener { - private static final Log log = LogFactory - .getLog(PortalRenderEngineContextListener.class); + private static final Logger log = LoggerFactory.getLogger(PortalRenderEngineContextListener.class); private VelocityPortalRenderEngine vengine; diff --git a/portal/portal-render-engine-impl/impl/src/java/org/sakaiproject/portal/charon/velocity/VelocityPortalRenderContext.java b/portal/portal-render-engine-impl/impl/src/java/org/sakaiproject/portal/charon/velocity/VelocityPortalRenderContext.java index 187262143ff1..22f25322e7e8 100644 --- a/portal/portal-render-engine-impl/impl/src/java/org/sakaiproject/portal/charon/velocity/VelocityPortalRenderContext.java +++ b/portal/portal-render-engine-impl/impl/src/java/org/sakaiproject/portal/charon/velocity/VelocityPortalRenderContext.java @@ -26,8 +26,8 @@ import java.util.Map; import java.util.Map.Entry; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.velocity.VelocityContext; import org.apache.velocity.context.Context; import org.sakaiproject.portal.api.PortalRenderContext; @@ -43,7 +43,7 @@ public class VelocityPortalRenderContext implements PortalRenderContext { - private static final Log log = LogFactory.getLog(VelocityPortalRenderContext.class); + private static final Logger log = LoggerFactory.getLogger(VelocityPortalRenderContext.class); private Context vcontext = new VelocityContext(); diff --git a/portal/portal-render-engine-impl/impl/src/java/org/sakaiproject/portal/charon/velocity/VelocityPortalRenderEngine.java b/portal/portal-render-engine-impl/impl/src/java/org/sakaiproject/portal/charon/velocity/VelocityPortalRenderEngine.java index 4ac10c98385b..83632450c381 100644 --- a/portal/portal-render-engine-impl/impl/src/java/org/sakaiproject/portal/charon/velocity/VelocityPortalRenderEngine.java +++ b/portal/portal-render-engine-impl/impl/src/java/org/sakaiproject/portal/charon/velocity/VelocityPortalRenderEngine.java @@ -35,8 +35,8 @@ import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.velocity.app.VelocityEngine; import org.apache.velocity.context.Context; import org.apache.velocity.runtime.RuntimeConstants; @@ -58,7 +58,7 @@ public class VelocityPortalRenderEngine implements PortalRenderEngine { - private static final Log log = LogFactory.getLog(VelocityPortalRenderEngine.class); + private static final Logger log = LoggerFactory.getLogger(VelocityPortalRenderEngine.class); private VelocityEngine vengine; diff --git a/portal/portal-render-engine-impl/pack/src/test/org/sakaiproject/portal/charon/test/MockCharonPortal.java b/portal/portal-render-engine-impl/pack/src/test/org/sakaiproject/portal/charon/test/MockCharonPortal.java index 999ec14459fa..344823cb8f80 100644 --- a/portal/portal-render-engine-impl/pack/src/test/org/sakaiproject/portal/charon/test/MockCharonPortal.java +++ b/portal/portal-render-engine-impl/pack/src/test/org/sakaiproject/portal/charon/test/MockCharonPortal.java @@ -36,8 +36,8 @@ import javax.servlet.http.HttpServlet; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.portal.api.PortalRenderContext; import org.sakaiproject.portal.charon.velocity.VelocityPortalRenderEngine; import org.w3c.tidy.Tidy; @@ -53,7 +53,7 @@ public class MockCharonPortal extends HttpServlet { /** Our log (commons). */ - private static Log log = LogFactory.getLog(MockCharonPortal.class); + private static Logger log = LoggerFactory.getLogger(MockCharonPortal.class); private VelocityPortalRenderEngine rengine; diff --git a/portal/portal-render-engine-impl/pack/src/test/org/sakaiproject/portal/charon/test/PortalRenderTest.java b/portal/portal-render-engine-impl/pack/src/test/org/sakaiproject/portal/charon/test/PortalRenderTest.java index de2213271138..4917f6926f32 100644 --- a/portal/portal-render-engine-impl/pack/src/test/org/sakaiproject/portal/charon/test/PortalRenderTest.java +++ b/portal/portal-render-engine-impl/pack/src/test/org/sakaiproject/portal/charon/test/PortalRenderTest.java @@ -23,8 +23,8 @@ import java.io.File; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import junit.framework.TestCase; @@ -38,7 +38,7 @@ public class PortalRenderTest extends TestCase { - private static final Log log = LogFactory.getLog(PortalRenderTest.class); + private static final Logger log = LoggerFactory.getLogger(PortalRenderTest.class); public static void main(String[] args) { diff --git a/portal/portal-render-engine-impl/pack/src/test/org/sakaiproject/portal/charon/test/PortalTestFileUtils.java b/portal/portal-render-engine-impl/pack/src/test/org/sakaiproject/portal/charon/test/PortalTestFileUtils.java index fc75f7df024e..2e63cdd08818 100644 --- a/portal/portal-render-engine-impl/pack/src/test/org/sakaiproject/portal/charon/test/PortalTestFileUtils.java +++ b/portal/portal-render-engine-impl/pack/src/test/org/sakaiproject/portal/charon/test/PortalTestFileUtils.java @@ -33,8 +33,8 @@ import java.util.zip.ZipInputStream; import java.util.zip.ZipOutputStream; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @author ieb @@ -65,7 +65,7 @@ public interface RecurseAction } - private static final Log log = LogFactory.getLog(PortalTestFileUtils.class); + private static final Logger log = LoggerFactory.getLogger(PortalTestFileUtils.class); /** * delete all files under this file and including this file diff --git a/portal/portal-render-engine-impl/pack/src/test/org/sakaiproject/portal/charon/test/http/AnonPortalTest.java b/portal/portal-render-engine-impl/pack/src/test/org/sakaiproject/portal/charon/test/http/AnonPortalTest.java index 2ca8c0b305e7..162d08686311 100644 --- a/portal/portal-render-engine-impl/pack/src/test/org/sakaiproject/portal/charon/test/http/AnonPortalTest.java +++ b/portal/portal-render-engine-impl/pack/src/test/org/sakaiproject/portal/charon/test/http/AnonPortalTest.java @@ -29,8 +29,8 @@ import junit.framework.TestCase; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.xml.sax.SAXException; import com.meterware.httpunit.GetMethodWebRequest; @@ -48,7 +48,7 @@ public class AnonPortalTest extends TestCase { - private static final Log log = LogFactory.getLog(AnonPortalTest.class); + private static final Logger log = LoggerFactory.getLogger(AnonPortalTest.class); private static final String TEST_URL = "http://localhost:8080/library/js/headscripts.js"; diff --git a/portal/portal-render-engine-impl/pack/src/test/org/sakaiproject/portal/charon/test/http/LoginActionHandler.java b/portal/portal-render-engine-impl/pack/src/test/org/sakaiproject/portal/charon/test/http/LoginActionHandler.java index 3ac580356497..1f65372833b2 100644 --- a/portal/portal-render-engine-impl/pack/src/test/org/sakaiproject/portal/charon/test/http/LoginActionHandler.java +++ b/portal/portal-render-engine-impl/pack/src/test/org/sakaiproject/portal/charon/test/http/LoginActionHandler.java @@ -23,8 +23,8 @@ import java.io.IOException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.xml.sax.SAXException; import com.meterware.httpunit.SubmitButton; @@ -38,7 +38,7 @@ public class LoginActionHandler implements ActionHandler { - private static final Log log = LogFactory.getLog(LoginActionHandler.class); + private static final Logger log = LoggerFactory.getLogger(LoginActionHandler.class); private String userName; diff --git a/portal/portal-render-impl/impl/src/java/org/sakaiproject/portal/render/compat/CompatibilityToolRenderService.java b/portal/portal-render-impl/impl/src/java/org/sakaiproject/portal/render/compat/CompatibilityToolRenderService.java index ee2e17235a55..76983e72f49b 100644 --- a/portal/portal-render-impl/impl/src/java/org/sakaiproject/portal/render/compat/CompatibilityToolRenderService.java +++ b/portal/portal-render-impl/impl/src/java/org/sakaiproject/portal/render/compat/CompatibilityToolRenderService.java @@ -29,8 +29,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.portal.api.Portal; import org.sakaiproject.portal.render.api.RenderResult; import org.sakaiproject.portal.render.api.ToolRenderException; @@ -47,8 +47,7 @@ public class CompatibilityToolRenderService implements ToolRenderService { - private static final Log LOG = LogFactory - .getLog(CompatibilityToolRenderService.class); + private static final Logger LOG = LoggerFactory.getLogger(CompatibilityToolRenderService.class); private List renderServices = null; diff --git a/portal/portal-render-impl/impl/src/java/org/sakaiproject/portal/render/fragment/FragmentToolRenderService.java b/portal/portal-render-impl/impl/src/java/org/sakaiproject/portal/render/fragment/FragmentToolRenderService.java index 88930a918b24..e44a0fce7606 100644 --- a/portal/portal-render-impl/impl/src/java/org/sakaiproject/portal/render/fragment/FragmentToolRenderService.java +++ b/portal/portal-render-impl/impl/src/java/org/sakaiproject/portal/render/fragment/FragmentToolRenderService.java @@ -28,8 +28,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.exception.IdUnusedException; import org.sakaiproject.exception.PermissionException; @@ -66,7 +66,7 @@ public class FragmentToolRenderService implements ToolRenderService private static final String TOOL_FRAGMENT_PRODUCER_ID = "fragment-producer"; - private static final Log log = LogFactory.getLog(FragmentToolRenderService.class); + private static final Logger log = LoggerFactory.getLogger(FragmentToolRenderService.class); private PortalService portal; diff --git a/portal/portal-render-impl/impl/src/java/org/sakaiproject/portal/render/iframe/IFrameToolRenderService.java b/portal/portal-render-impl/impl/src/java/org/sakaiproject/portal/render/iframe/IFrameToolRenderService.java index 0ba35bd38efa..647bc916ddd6 100644 --- a/portal/portal-render-impl/impl/src/java/org/sakaiproject/portal/render/iframe/IFrameToolRenderService.java +++ b/portal/portal-render-impl/impl/src/java/org/sakaiproject/portal/render/iframe/IFrameToolRenderService.java @@ -28,8 +28,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.exception.IdUnusedException; import org.sakaiproject.exception.PermissionException; @@ -63,7 +63,7 @@ public class IFrameToolRenderService implements ToolRenderService { - private static final Log LOG = LogFactory.getLog(IFrameToolRenderService.class); + private static final Logger LOG = LoggerFactory.getLogger(IFrameToolRenderService.class); private PortalService portalService; diff --git a/portal/portal-render-impl/impl/src/java/org/sakaiproject/portal/render/portlet/PortletToolRenderService.java b/portal/portal-render-impl/impl/src/java/org/sakaiproject/portal/render/portlet/PortletToolRenderService.java index 7cd5c2dc7bc3..5dac5a6e7687 100644 --- a/portal/portal-render-impl/impl/src/java/org/sakaiproject/portal/render/portlet/PortletToolRenderService.java +++ b/portal/portal-render-impl/impl/src/java/org/sakaiproject/portal/render/portlet/PortletToolRenderService.java @@ -38,8 +38,8 @@ import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.pluto.PortletContainer; import org.apache.pluto.PortletContainerException; import org.apache.pluto.PortletContainerFactory; @@ -83,9 +83,9 @@ public class PortletToolRenderService implements ToolRenderService { /** - * Log instance used for all instances of this service. + * Logger instance used for all instances of this service. */ - private static final Log LOG = LogFactory.getLog(PortletToolRenderService.class); + private static final Logger LOG = LoggerFactory.getLogger(PortletToolRenderService.class); /** * Portlet Container instance used by this service. diff --git a/portal/portal-render-impl/impl/src/java/org/sakaiproject/portal/render/portlet/services/SakaiOptionalPortletContainerServices.java b/portal/portal-render-impl/impl/src/java/org/sakaiproject/portal/render/portlet/services/SakaiOptionalPortletContainerServices.java index 8cffa76deeca..3164e3a8f6f4 100644 --- a/portal/portal-render-impl/impl/src/java/org/sakaiproject/portal/render/portlet/services/SakaiOptionalPortletContainerServices.java +++ b/portal/portal-render-impl/impl/src/java/org/sakaiproject/portal/render/portlet/services/SakaiOptionalPortletContainerServices.java @@ -32,8 +32,8 @@ import javax.portlet.PortletRequest; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.pluto.OptionalContainerServices; import org.apache.pluto.PortletContainerException; import org.apache.pluto.PortletWindow; @@ -71,8 +71,7 @@ public class SakaiOptionalPortletContainerServices implements OptionalContainerServices { - private static Log M_log = LogFactory - .getLog(SakaiOptionalPortletContainerServices.class); + private static Logger M_log = LoggerFactory.getLogger(SakaiOptionalPortletContainerServices.class); protected final static String CURRENT_PLACEMENT = "sakai:ToolComponent:current.placement"; diff --git a/portal/portal-render-impl/impl/src/java/org/sakaiproject/portal/render/portlet/services/SakaiPortalCallbackService.java b/portal/portal-render-impl/impl/src/java/org/sakaiproject/portal/render/portlet/services/SakaiPortalCallbackService.java index 171b28eb7682..ce7541f7be16 100644 --- a/portal/portal-render-impl/impl/src/java/org/sakaiproject/portal/render/portlet/services/SakaiPortalCallbackService.java +++ b/portal/portal-render-impl/impl/src/java/org/sakaiproject/portal/render/portlet/services/SakaiPortalCallbackService.java @@ -27,8 +27,8 @@ import javax.portlet.WindowState; import javax.servlet.http.HttpServletRequest; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.pluto.PortletWindow; import org.apache.pluto.spi.PortalCallbackService; import org.apache.pluto.spi.PortletURLProvider; @@ -48,7 +48,7 @@ public class SakaiPortalCallbackService implements PortalCallbackService { - private static final Log LOG = LogFactory.getLog(SakaiPortalCallbackService.class); + private static final Logger LOG = LoggerFactory.getLogger(SakaiPortalCallbackService.class); public static final String PORTLET_STATE_QUERY_PARAM = "org.sakaiproject.portal.pluto.PORTLET_STATE"; diff --git a/portal/portal-render-impl/impl/src/java/org/sakaiproject/portal/render/portlet/services/state/EnhancedPortletStateEncoder.java b/portal/portal-render-impl/impl/src/java/org/sakaiproject/portal/render/portlet/services/state/EnhancedPortletStateEncoder.java index 4b288b5082df..75eff76f312e 100644 --- a/portal/portal-render-impl/impl/src/java/org/sakaiproject/portal/render/portlet/services/state/EnhancedPortletStateEncoder.java +++ b/portal/portal-render-impl/impl/src/java/org/sakaiproject/portal/render/portlet/services/state/EnhancedPortletStateEncoder.java @@ -33,8 +33,8 @@ import javax.portlet.PortletMode; import javax.portlet.WindowState; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Enhanced version of the PortletStateEncoder. This implementation translates @@ -51,7 +51,7 @@ public class EnhancedPortletStateEncoder implements PortletStateEncoder { - private static final Log LOG = LogFactory.getLog(EnhancedPortletStateEncoder.class); + private static final Logger LOG = LoggerFactory.getLogger(EnhancedPortletStateEncoder.class); // // Implementation Note: diff --git a/portal/portal-render-impl/impl/src/java/org/sakaiproject/portal/render/portlet/services/state/PortletState.java b/portal/portal-render-impl/impl/src/java/org/sakaiproject/portal/render/portlet/services/state/PortletState.java index db481613e487..23702cb1a8e5 100644 --- a/portal/portal-render-impl/impl/src/java/org/sakaiproject/portal/render/portlet/services/state/PortletState.java +++ b/portal/portal-render-impl/impl/src/java/org/sakaiproject/portal/render/portlet/services/state/PortletState.java @@ -31,8 +31,8 @@ import javax.portlet.PortletMode; import javax.portlet.WindowState; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @author ddwolf @@ -43,7 +43,7 @@ public class PortletState implements Serializable { - private static final Log LOG = LogFactory.getLog(PortletState.class); + private static final Logger LOG = LoggerFactory.getLogger(PortletState.class); // // Session Scoped State diff --git a/portal/portal-service-impl/impl/src/java/org/sakaiproject/portal/service/AliasingSiteAdvisor.java b/portal/portal-service-impl/impl/src/java/org/sakaiproject/portal/service/AliasingSiteAdvisor.java index a4cf42d26e5e..f92d61e36e12 100644 --- a/portal/portal-service-impl/impl/src/java/org/sakaiproject/portal/service/AliasingSiteAdvisor.java +++ b/portal/portal-service-impl/impl/src/java/org/sakaiproject/portal/service/AliasingSiteAdvisor.java @@ -4,8 +4,8 @@ import java.util.Observable; import java.util.Observer; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.alias.api.Alias; import org.sakaiproject.alias.api.AliasService; import org.sakaiproject.component.api.ServerConfigurationService; @@ -36,7 +36,7 @@ public class AliasingSiteAdvisor implements Observer */ private static final String PORTAL_USE_PAGE_ALIASES = "portal.use.page.aliases"; - private static Log log = LogFactory.getLog(AliasingSiteAdvisor.class); + private static Logger log = LoggerFactory.getLogger(AliasingSiteAdvisor.class); private static String PAGE_ALIAS = Entity.SEPARATOR+ "pagealias"+ Entity.SEPARATOR; @@ -140,7 +140,7 @@ public void update(Site site) } catch (PermissionException e) { - // Log and there isn't any point in carrying on. + // Logger and there isn't any point in carrying on. log.warn("Lack of permission to create alias: "+ e.getMessage()); break; } diff --git a/portal/portal-service-impl/impl/src/java/org/sakaiproject/portal/service/PortalServiceImpl.java b/portal/portal-service-impl/impl/src/java/org/sakaiproject/portal/service/PortalServiceImpl.java index efd1c5d1c767..1c30ff99d8ad 100644 --- a/portal/portal-service-impl/impl/src/java/org/sakaiproject/portal/service/PortalServiceImpl.java +++ b/portal/portal-service-impl/impl/src/java/org/sakaiproject/portal/service/PortalServiceImpl.java @@ -30,8 +30,8 @@ import javax.servlet.http.HttpServletRequest; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.pluto.core.PortletContextManager; import org.apache.pluto.descriptors.portlet.PortletAppDD; import org.apache.pluto.descriptors.portlet.PortletDD; @@ -69,7 +69,7 @@ public class PortalServiceImpl implements PortalService { - private static final Log log = LogFactory.getLog(PortalServiceImpl.class); + private static final Logger log = LoggerFactory.getLogger(PortalServiceImpl.class); /** * Parameter to force state reset diff --git a/portal/portal-service-impl/impl/src/java/org/sakaiproject/portal/service/PortletTool.java b/portal/portal-service-impl/impl/src/java/org/sakaiproject/portal/service/PortletTool.java index 68a352575451..89bd92b571e0 100644 --- a/portal/portal-service-impl/impl/src/java/org/sakaiproject/portal/service/PortletTool.java +++ b/portal/portal-service-impl/impl/src/java/org/sakaiproject/portal/service/PortletTool.java @@ -28,8 +28,8 @@ import javax.servlet.ServletContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.pluto.descriptors.portlet.PortletDD; import org.apache.pluto.descriptors.portlet.PortletInfoDD; import org.apache.pluto.internal.InternalPortletContext; @@ -49,7 +49,7 @@ public class PortletTool implements org.sakaiproject.tool.api.Tool, Comparable { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(PortletTool.class); + private static Logger M_log = LoggerFactory.getLogger(PortletTool.class); /** The access security. */ protected PortletTool.AccessSecurity m_accessSecurity = PortletTool.AccessSecurity.PORTAL; diff --git a/portal/portal-service-impl/impl/src/java/org/sakaiproject/portal/service/SakaiPortletRegistryListener.java b/portal/portal-service-impl/impl/src/java/org/sakaiproject/portal/service/SakaiPortletRegistryListener.java index b5acca89ca42..0e0ccd305d2b 100644 --- a/portal/portal-service-impl/impl/src/java/org/sakaiproject/portal/service/SakaiPortletRegistryListener.java +++ b/portal/portal-service-impl/impl/src/java/org/sakaiproject/portal/service/SakaiPortletRegistryListener.java @@ -28,8 +28,8 @@ import javax.servlet.ServletContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.pluto.PortletContainerException; import org.apache.pluto.core.PortletContextManager; import org.apache.pluto.descriptors.portlet.PortletAppDD; @@ -50,7 +50,7 @@ public class SakaiPortletRegistryListener implements PortletRegistryListener { - private static final Log log = LogFactory.getLog(SakaiPortletRegistryListener.class); + private static final Logger log = LoggerFactory.getLogger(SakaiPortletRegistryListener.class); private PortletContextManager registry; diff --git a/portal/portal-service-impl/impl/src/java/org/sakaiproject/portal/service/SiteNeighbourhoodServiceImpl.java b/portal/portal-service-impl/impl/src/java/org/sakaiproject/portal/service/SiteNeighbourhoodServiceImpl.java index 32ec3b908b95..8eb751e19ed0 100644 --- a/portal/portal-service-impl/impl/src/java/org/sakaiproject/portal/service/SiteNeighbourhoodServiceImpl.java +++ b/portal/portal-service-impl/impl/src/java/org/sakaiproject/portal/service/SiteNeighbourhoodServiceImpl.java @@ -32,8 +32,8 @@ import javax.servlet.http.HttpServletRequest; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.alias.api.Alias; import org.sakaiproject.alias.api.AliasService; import org.sakaiproject.component.api.ServerConfigurationService; @@ -59,7 +59,7 @@ public class SiteNeighbourhoodServiceImpl implements SiteNeighbourhoodService private static final String SITE_ALIAS = "/sitealias/"; - private static final Log log = LogFactory.getLog(SiteNeighbourhoodServiceImpl.class); + private static final Logger log = LoggerFactory.getLogger(SiteNeighbourhoodServiceImpl.class); private SiteService siteService; diff --git a/portal/portal-tool/tool/src/java/org/sakaiproject/portal/tool/ToolPortal.java b/portal/portal-tool/tool/src/java/org/sakaiproject/portal/tool/ToolPortal.java index d3c1066608bc..f8938346d8f4 100644 --- a/portal/portal-tool/tool/src/java/org/sakaiproject/portal/tool/ToolPortal.java +++ b/portal/portal-tool/tool/src/java/org/sakaiproject/portal/tool/ToolPortal.java @@ -31,8 +31,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.exception.IdUnusedException; import org.sakaiproject.exception.PermissionException; @@ -65,7 +65,7 @@ public class ToolPortal extends HttpServlet { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(ToolPortal.class); + private static Logger M_log = LoggerFactory.getLogger(ToolPortal.class); // SAK-22384 private static final String MATHJAX_ENABLED = "mathJaxEnabled"; diff --git a/portal/portal-util/util/src/java/org/sakaiproject/portal/util/ErrorReporter.java b/portal/portal-util/util/src/java/org/sakaiproject/portal/util/ErrorReporter.java index ce2870247279..eb8b01213294 100644 --- a/portal/portal-util/util/src/java/org/sakaiproject/portal/util/ErrorReporter.java +++ b/portal/portal-util/util/src/java/org/sakaiproject/portal/util/ErrorReporter.java @@ -36,8 +36,8 @@ import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.cover.SecurityService; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.email.cover.EmailService; @@ -66,7 +66,7 @@ public class ErrorReporter { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(ErrorReporter.class); + private static Logger M_log = LoggerFactory.getLogger(ErrorReporter.class); /** messages. */ private static ResourceLoader rb = new ResourceLoader("portal-util"); @@ -244,7 +244,7 @@ protected String throwableDisplay(Throwable t) } /** - * Log and email the error report details. + * Logger and email the error report details. * * @param usageSessionId * The end-user's usage session id. diff --git a/portal/portal-util/util/src/java/org/sakaiproject/portal/util/URLUtils.java b/portal/portal-util/util/src/java/org/sakaiproject/portal/util/URLUtils.java index d63780b9eb16..d600352434c9 100644 --- a/portal/portal-util/util/src/java/org/sakaiproject/portal/util/URLUtils.java +++ b/portal/portal-util/util/src/java/org/sakaiproject/portal/util/URLUtils.java @@ -26,8 +26,8 @@ import javax.servlet.http.HttpServletRequest; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @author ieb @@ -41,7 +41,7 @@ public class URLUtils /** * Our log (commons). */ - private static Log M_log = LogFactory.getLog(URLUtils.class); + private static Logger M_log = LoggerFactory.getLogger(URLUtils.class); public static String addParameter(String URL, String name, String value) { diff --git a/postem/postem-app/src/java/org/sakaiproject/tool/postem/PostemTool.java b/postem/postem-app/src/java/org/sakaiproject/tool/postem/PostemTool.java index e30bcb23bd44..f5735ae7fab7 100644 --- a/postem/postem-app/src/java/org/sakaiproject/tool/postem/PostemTool.java +++ b/postem/postem-app/src/java/org/sakaiproject/tool/postem/PostemTool.java @@ -41,8 +41,8 @@ import javax.faces.context.FacesContext; import org.apache.commons.lang.StringEscapeUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.myfaces.shared_impl.util.MessageUtils; import org.sakaiproject.api.app.postem.data.Gradebook; import org.sakaiproject.api.app.postem.data.GradebookManager; @@ -139,7 +139,7 @@ public class PostemTool { private AuthzGroupService authzGroupService; - private static final Log LOG = LogFactory.getLog(PostemTool.class); + private static final Logger LOG = LoggerFactory.getLogger(PostemTool.class); public int getColumn() { return column; diff --git a/presence/presence-impl/impl/src/java/org/sakaiproject/presence/impl/BasePresenceService.java b/presence/presence-impl/impl/src/java/org/sakaiproject/presence/impl/BasePresenceService.java index b7d83c1023fa..524678fb44ed 100644 --- a/presence/presence-impl/impl/src/java/org/sakaiproject/presence/impl/BasePresenceService.java +++ b/presence/presence-impl/impl/src/java/org/sakaiproject/presence/impl/BasePresenceService.java @@ -29,8 +29,8 @@ import java.util.Set; import java.util.Vector; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.privacy.PrivacyManager; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.courier.api.PresenceUpdater; @@ -61,7 +61,7 @@ public abstract class BasePresenceService implements PresenceService, PresenceUpdater { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(BasePresenceService.class); + private static Logger M_log = LoggerFactory.getLogger(BasePresenceService.class); /** SessionState key. */ protected final static String SESSION_KEY = "sakai.presence.service"; diff --git a/presence/presence-impl/impl/src/java/org/sakaiproject/presence/impl/ClusterPresenceService.java b/presence/presence-impl/impl/src/java/org/sakaiproject/presence/impl/ClusterPresenceService.java index 2dc67894eb32..222ca36c940b 100644 --- a/presence/presence-impl/impl/src/java/org/sakaiproject/presence/impl/ClusterPresenceService.java +++ b/presence/presence-impl/impl/src/java/org/sakaiproject/presence/impl/ClusterPresenceService.java @@ -23,8 +23,8 @@ import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.db.api.SqlService; import org.sakaiproject.event.api.UsageSession; @@ -36,7 +36,7 @@ public class ClusterPresenceService extends BasePresenceService { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(ClusterPresenceService.class); + private static Logger M_log = LoggerFactory.getLogger(ClusterPresenceService.class); /** * Allocate a new storage object. diff --git a/presence/presence-tool/tool/src/java/org/sakaiproject/presence/tool/PresenceTool.java b/presence/presence-tool/tool/src/java/org/sakaiproject/presence/tool/PresenceTool.java index 51255b50462a..205db646af82 100644 --- a/presence/presence-tool/tool/src/java/org/sakaiproject/presence/tool/PresenceTool.java +++ b/presence/presence-tool/tool/src/java/org/sakaiproject/presence/tool/PresenceTool.java @@ -32,8 +32,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.event.api.UsageSession; import org.sakaiproject.event.cover.UsageSessionService; import org.sakaiproject.presence.cover.PresenceService; @@ -60,7 +60,7 @@ public class PresenceTool extends HttpServlet private static final long serialVersionUID = 1L; /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(PresenceTool.class); + private static Logger M_log = LoggerFactory.getLogger(PresenceTool.class); /** Request parameter to generate a fragment only. */ protected static final String OUTPUT_FRAGMENT = "output_fragment"; diff --git a/providers/allhands/src/java/org/sakaiproject/provider/authzGroup/AllHandsGroupProvider.java b/providers/allhands/src/java/org/sakaiproject/provider/authzGroup/AllHandsGroupProvider.java index c683809e9a97..26cc6e4af905 100644 --- a/providers/allhands/src/java/org/sakaiproject/provider/authzGroup/AllHandsGroupProvider.java +++ b/providers/allhands/src/java/org/sakaiproject/provider/authzGroup/AllHandsGroupProvider.java @@ -24,8 +24,8 @@ import java.util.HashMap; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.GroupProvider; import org.apache.commons.lang.StringUtils; @@ -43,7 +43,7 @@ public class AllHandsGroupProvider implements GroupProvider { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(AllHandsGroupProvider.class); + private static Logger M_log = LoggerFactory.getLogger(AllHandsGroupProvider.class); /********************************************************************************************************************************************************************************************************************************************************** * Init and Destroy diff --git a/providers/cm-authz-provider/src/java/org/sakaiproject/coursemanagement/impl/provider/BaseRoleResolver.java b/providers/cm-authz-provider/src/java/org/sakaiproject/coursemanagement/impl/provider/BaseRoleResolver.java index 96f1e3416947..da5ce0321962 100644 --- a/providers/cm-authz-provider/src/java/org/sakaiproject/coursemanagement/impl/provider/BaseRoleResolver.java +++ b/providers/cm-authz-provider/src/java/org/sakaiproject/coursemanagement/impl/provider/BaseRoleResolver.java @@ -24,11 +24,11 @@ import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public abstract class BaseRoleResolver implements RoleResolver { - static final Log log = LogFactory.getLog(BaseRoleResolver.class); + static final Logger log = LoggerFactory.getLogger(BaseRoleResolver.class); /** Map of CM section roles to Sakai roles */ protected Map roleMap; diff --git a/providers/cm-authz-provider/src/java/org/sakaiproject/coursemanagement/impl/provider/CourseManagementGroupProvider.java b/providers/cm-authz-provider/src/java/org/sakaiproject/coursemanagement/impl/provider/CourseManagementGroupProvider.java index 53a09cc8e961..3444edba6474 100644 --- a/providers/cm-authz-provider/src/java/org/sakaiproject/coursemanagement/impl/provider/CourseManagementGroupProvider.java +++ b/providers/cm-authz-provider/src/java/org/sakaiproject/coursemanagement/impl/provider/CourseManagementGroupProvider.java @@ -27,8 +27,8 @@ import java.util.Map.Entry; import java.util.regex.Pattern; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.GroupProvider; import org.sakaiproject.coursemanagement.api.CourseManagementService; import org.sakaiproject.coursemanagement.api.Section; @@ -41,7 +41,7 @@ * based on memberships in parent objects such as CourseSets. */ public class CourseManagementGroupProvider implements GroupProvider { - private static final Log log = LogFactory.getLog(CourseManagementGroupProvider.class); + private static final Logger log = LoggerFactory.getLogger(CourseManagementGroupProvider.class); // Configuration keys. public static final String SITE_ROLE_RESOLUTION_ORDER = "siteRoleResolutionOrder"; diff --git a/providers/cm-authz-provider/src/java/org/sakaiproject/coursemanagement/impl/provider/CourseOfferingRoleResolver.java b/providers/cm-authz-provider/src/java/org/sakaiproject/coursemanagement/impl/provider/CourseOfferingRoleResolver.java index 9e5a07d02d83..4c112581d834 100644 --- a/providers/cm-authz-provider/src/java/org/sakaiproject/coursemanagement/impl/provider/CourseOfferingRoleResolver.java +++ b/providers/cm-authz-provider/src/java/org/sakaiproject/coursemanagement/impl/provider/CourseOfferingRoleResolver.java @@ -27,8 +27,8 @@ import java.util.Set; import java.util.Map.Entry; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.coursemanagement.api.CourseManagementService; import org.sakaiproject.coursemanagement.api.CourseOffering; import org.sakaiproject.coursemanagement.api.Membership; @@ -39,7 +39,7 @@ * */ public class CourseOfferingRoleResolver extends BaseRoleResolver { - private static final Log log = LogFactory.getLog(CourseOfferingRoleResolver.class); + private static final Logger log = LoggerFactory.getLogger(CourseOfferingRoleResolver.class); // Configuration keys. public static final String COURSE_OFFERING_ROLE_TO_SITE_ROLE = "courseOfferingRoleToSiteRole"; diff --git a/providers/cm-authz-provider/src/java/org/sakaiproject/coursemanagement/impl/provider/CourseSetRoleResolver.java b/providers/cm-authz-provider/src/java/org/sakaiproject/coursemanagement/impl/provider/CourseSetRoleResolver.java index d63db0741d8d..2ecc5e233e94 100644 --- a/providers/cm-authz-provider/src/java/org/sakaiproject/coursemanagement/impl/provider/CourseSetRoleResolver.java +++ b/providers/cm-authz-provider/src/java/org/sakaiproject/coursemanagement/impl/provider/CourseSetRoleResolver.java @@ -26,8 +26,8 @@ import java.util.Set; import java.util.Map.Entry; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.coursemanagement.api.CanonicalCourse; import org.sakaiproject.coursemanagement.api.CourseManagementService; import org.sakaiproject.coursemanagement.api.CourseOffering; @@ -40,7 +40,7 @@ * */ public class CourseSetRoleResolver extends BaseRoleResolver { - private static final Log log = LogFactory.getLog(CourseSetRoleResolver.class); + private static final Logger log = LoggerFactory.getLogger(CourseSetRoleResolver.class); // Configuration keys. public static final String COURSE_SET_ROLE_TO_SITE_ROLE = "courseSetRoleToSiteRole"; diff --git a/providers/cm-authz-provider/src/java/org/sakaiproject/coursemanagement/impl/provider/SectionRoleResolver.java b/providers/cm-authz-provider/src/java/org/sakaiproject/coursemanagement/impl/provider/SectionRoleResolver.java index c8527bde747f..e8e497254605 100644 --- a/providers/cm-authz-provider/src/java/org/sakaiproject/coursemanagement/impl/provider/SectionRoleResolver.java +++ b/providers/cm-authz-provider/src/java/org/sakaiproject/coursemanagement/impl/provider/SectionRoleResolver.java @@ -26,8 +26,8 @@ import java.util.Set; import java.util.Map.Entry; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.coursemanagement.api.CourseManagementService; import org.sakaiproject.coursemanagement.api.Enrollment; import org.sakaiproject.coursemanagement.api.EnrollmentSet; @@ -38,7 +38,7 @@ * Resolves users roles in sections. */ public class SectionRoleResolver extends BaseRoleResolver { - static final Log log = LogFactory.getLog(SectionRoleResolver.class); + static final Logger log = LoggerFactory.getLogger(SectionRoleResolver.class); // Configuration keys. public static final String OFFICIAL_INSTRUCTOR_TO_SITE_ROLE = "officialInstructorToSiteRole"; diff --git a/providers/federating/src/java/org/sakaiproject/provider/user/FilterUserDirectoryProvider.java b/providers/federating/src/java/org/sakaiproject/provider/user/FilterUserDirectoryProvider.java index da0c2a40738a..9a6e76ce6170 100644 --- a/providers/federating/src/java/org/sakaiproject/provider/user/FilterUserDirectoryProvider.java +++ b/providers/federating/src/java/org/sakaiproject/provider/user/FilterUserDirectoryProvider.java @@ -32,8 +32,8 @@ import java.util.List; import java.util.Vector; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.user.api.ExternalUserSearchUDP; import org.sakaiproject.user.api.AuthenticationIdUDP; @@ -85,7 +85,7 @@ public class FilterUserDirectoryProvider implements UserDirectoryProvider, ExternalUserSearchUDP, UsersShareEmailUDP, AuthenticationIdUDP { /** Our log (commons). */ - private static Log m_logger = LogFactory.getLog(FilterUserDirectoryProvider.class); + private static Logger m_logger = LoggerFactory.getLogger(FilterUserDirectoryProvider.class); private static ThreadLocal authenticatedProvider = new ThreadLocal(); diff --git a/providers/imsent/src/java/org/sakaiproject/component/imsent/user/IMSEntUserDirectoryProvider.java b/providers/imsent/src/java/org/sakaiproject/component/imsent/user/IMSEntUserDirectoryProvider.java index 8ceeade79ebd..f2ba2fbb8312 100644 --- a/providers/imsent/src/java/org/sakaiproject/component/imsent/user/IMSEntUserDirectoryProvider.java +++ b/providers/imsent/src/java/org/sakaiproject/component/imsent/user/IMSEntUserDirectoryProvider.java @@ -27,8 +27,8 @@ import java.util.Iterator; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.db.api.SqlReader; import org.sakaiproject.db.api.SqlService; import org.sakaiproject.user.api.UserDirectoryProvider; @@ -42,7 +42,7 @@ public class IMSEntUserDirectoryProvider implements UserDirectoryProvider { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(IMSEntUserDirectoryProvider.class); + private static Logger M_log = LoggerFactory.getLogger(IMSEntUserDirectoryProvider.class); /********************************************************************************************************************************************************************************************************************************************************** * Dependencies and their setter methods diff --git a/providers/jldap/src/java/edu/amc/sakai/user/ConsensusLdapConnectionLivenessValidator.java b/providers/jldap/src/java/edu/amc/sakai/user/ConsensusLdapConnectionLivenessValidator.java index fb3a3b003944..15aaef2eec30 100644 --- a/providers/jldap/src/java/edu/amc/sakai/user/ConsensusLdapConnectionLivenessValidator.java +++ b/providers/jldap/src/java/edu/amc/sakai/user/ConsensusLdapConnectionLivenessValidator.java @@ -24,8 +24,8 @@ import java.util.ArrayList; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.novell.ldap.LDAPConnection; @@ -47,7 +47,7 @@ public class ConsensusLdapConnectionLivenessValidator implements LdapConnectionLivenessValidator { /** Class-specific logger */ - private static Log log = LogFactory.getLog(ConsensusLdapConnectionLivenessValidator.class); + private static Logger log = LoggerFactory.getLogger(ConsensusLdapConnectionLivenessValidator.class); private List delegates = new ArrayList(0); diff --git a/providers/jldap/src/java/edu/amc/sakai/user/EmptyStringUserTypeMapper.java b/providers/jldap/src/java/edu/amc/sakai/user/EmptyStringUserTypeMapper.java index b1e9711e1241..385f4951a063 100644 --- a/providers/jldap/src/java/edu/amc/sakai/user/EmptyStringUserTypeMapper.java +++ b/providers/jldap/src/java/edu/amc/sakai/user/EmptyStringUserTypeMapper.java @@ -21,8 +21,8 @@ package edu.amc.sakai.user; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.novell.ldap.LDAPEntry; @@ -36,7 +36,7 @@ public class EmptyStringUserTypeMapper extends StringUserTypeMapper { /** Class-specific logger */ - private static Log M_log = LogFactory.getLog(EmptyStringUserTypeMapper.class); + private static Logger M_log = LoggerFactory.getLogger(EmptyStringUserTypeMapper.class); /** * Initializes the cached user type String to an diff --git a/providers/jldap/src/java/edu/amc/sakai/user/EntryAttributeToUserTypeMapper.java b/providers/jldap/src/java/edu/amc/sakai/user/EntryAttributeToUserTypeMapper.java index 40086a85686d..254205266716 100644 --- a/providers/jldap/src/java/edu/amc/sakai/user/EntryAttributeToUserTypeMapper.java +++ b/providers/jldap/src/java/edu/amc/sakai/user/EntryAttributeToUserTypeMapper.java @@ -26,8 +26,8 @@ import java.util.Map; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.novell.ldap.LDAPAttribute; import com.novell.ldap.LDAPEntry; @@ -46,7 +46,7 @@ public class EntryAttributeToUserTypeMapper implements UserTypeMapper { /** Class-specific logger */ - private static Log M_log = LogFactory.getLog(EntryAttributeToUserTypeMapper.class); + private static Logger M_log = LoggerFactory.getLogger(EntryAttributeToUserTypeMapper.class); /** map of attribute values to Sakai user types */ private Map attributeValueToSakaiUserTypeMap = new HashMap(); diff --git a/providers/jldap/src/java/edu/amc/sakai/user/EntryContainerRdnToUserTypeMapper.java b/providers/jldap/src/java/edu/amc/sakai/user/EntryContainerRdnToUserTypeMapper.java index 02daf74dd3af..a0c8f32f38c8 100644 --- a/providers/jldap/src/java/edu/amc/sakai/user/EntryContainerRdnToUserTypeMapper.java +++ b/providers/jldap/src/java/edu/amc/sakai/user/EntryContainerRdnToUserTypeMapper.java @@ -26,8 +26,8 @@ import java.util.Vector; import java.util.Iterator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.novell.ldap.LDAPEntry; import com.novell.ldap.util.DN; @@ -42,7 +42,7 @@ public class EntryContainerRdnToUserTypeMapper implements UserTypeMapper { /** Class-specific logger */ - private static Log M_log = LogFactory.getLog(EntryContainerRdnToUserTypeMapper.class); + private static Logger M_log = LoggerFactory.getLogger(EntryContainerRdnToUserTypeMapper.class); /** map of container RDN values to Sakai user types */ private Map rdnToSakaiUserTypeMap = new HashMap(); diff --git a/providers/jldap/src/java/edu/amc/sakai/user/JLDAPDirectoryProvider.java b/providers/jldap/src/java/edu/amc/sakai/user/JLDAPDirectoryProvider.java index 8c3538347001..20b302c87256 100644 --- a/providers/jldap/src/java/edu/amc/sakai/user/JLDAPDirectoryProvider.java +++ b/providers/jldap/src/java/edu/amc/sakai/user/JLDAPDirectoryProvider.java @@ -29,8 +29,8 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.user.api.*; import org.apache.commons.lang.StringUtils; @@ -96,7 +96,7 @@ public class JLDAPDirectoryProvider implements UserDirectoryProvider, LdapConnec public static final boolean DEFAULT_AUTHENTICATE_WITH_PROVIDER_FIRST = false; /** Class-specific logger */ - private static Log M_log = LogFactory.getLog(JLDAPDirectoryProvider.class); + private static Logger M_log = LoggerFactory.getLogger(JLDAPDirectoryProvider.class); /** LDAP host address */ private String ldapHost; diff --git a/providers/jldap/src/java/edu/amc/sakai/user/MaxLifetimeLdapConnectionLivenessValidator.java b/providers/jldap/src/java/edu/amc/sakai/user/MaxLifetimeLdapConnectionLivenessValidator.java index 8c5b7383a0c5..13cf9d1eadd6 100644 --- a/providers/jldap/src/java/edu/amc/sakai/user/MaxLifetimeLdapConnectionLivenessValidator.java +++ b/providers/jldap/src/java/edu/amc/sakai/user/MaxLifetimeLdapConnectionLivenessValidator.java @@ -21,8 +21,8 @@ package edu.amc.sakai.user; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.novell.ldap.LDAPConnection; @@ -34,7 +34,7 @@ public class MaxLifetimeLdapConnectionLivenessValidator implements LdapConnectionLivenessValidator { /** Class-specific logger */ - private static Log log = LogFactory.getLog(MaxLifetimeLdapConnectionLivenessValidator.class); + private static Logger log = LoggerFactory.getLogger(MaxLifetimeLdapConnectionLivenessValidator.class); public static final long DEFAULT_MAX_TTL = -1L; diff --git a/providers/jldap/src/java/edu/amc/sakai/user/NativeLdapConnectionLivenessValidator.java b/providers/jldap/src/java/edu/amc/sakai/user/NativeLdapConnectionLivenessValidator.java index b210757c7c95..355e0656fa3d 100644 --- a/providers/jldap/src/java/edu/amc/sakai/user/NativeLdapConnectionLivenessValidator.java +++ b/providers/jldap/src/java/edu/amc/sakai/user/NativeLdapConnectionLivenessValidator.java @@ -21,8 +21,8 @@ package edu.amc.sakai.user; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.novell.ldap.LDAPConnection; @@ -30,7 +30,7 @@ public class NativeLdapConnectionLivenessValidator implements LdapConnectionLivenessValidator { /** Class-specific logger */ - private static Log log = LogFactory.getLog(NativeLdapConnectionLivenessValidator.class); + private static Logger log = LoggerFactory.getLogger(NativeLdapConnectionLivenessValidator.class); public boolean isConnectionAlive(LDAPConnection connectionToTest) { if ( log.isDebugEnabled() ) { diff --git a/providers/jldap/src/java/edu/amc/sakai/user/PooledLDAPConnection.java b/providers/jldap/src/java/edu/amc/sakai/user/PooledLDAPConnection.java index 653876ed2f66..a7e99ef2f5c8 100644 --- a/providers/jldap/src/java/edu/amc/sakai/user/PooledLDAPConnection.java +++ b/providers/jldap/src/java/edu/amc/sakai/user/PooledLDAPConnection.java @@ -24,8 +24,8 @@ import java.util.Date; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.novell.ldap.LDAPConnection; import com.novell.ldap.LDAPConstraints; @@ -42,7 +42,7 @@ public class PooledLDAPConnection extends LDAPConnection { /** Class-specific logger */ - private static Log log = LogFactory.getLog(PooledLDAPConnection.class); + private static Logger log = LoggerFactory.getLogger(PooledLDAPConnection.class); /** is this pooled connection currently active (i.e. used) */ private boolean active = false; diff --git a/providers/jldap/src/java/edu/amc/sakai/user/PooledLDAPConnectionFactory.java b/providers/jldap/src/java/edu/amc/sakai/user/PooledLDAPConnectionFactory.java index ebc2a43a61c7..872e45941ddd 100644 --- a/providers/jldap/src/java/edu/amc/sakai/user/PooledLDAPConnectionFactory.java +++ b/providers/jldap/src/java/edu/amc/sakai/user/PooledLDAPConnectionFactory.java @@ -25,8 +25,8 @@ import java.net.UnknownHostException; import java.util.*; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.pool.PoolableObjectFactory; import com.novell.ldap.LDAPConnection; @@ -46,7 +46,7 @@ public class PooledLDAPConnectionFactory implements PoolableObjectFactory { /** Class-specific logger */ - private static Log log = LogFactory.getLog(PooledLDAPConnectionFactory.class); + private static Logger log = LoggerFactory.getLogger(PooledLDAPConnectionFactory.class); /** the controlling connection manager */ private LdapConnectionManager connectionManager; diff --git a/providers/jldap/src/java/edu/amc/sakai/user/PoolingLdapConnectionManager.java b/providers/jldap/src/java/edu/amc/sakai/user/PoolingLdapConnectionManager.java index 26de30bcbb4b..07738b847979 100644 --- a/providers/jldap/src/java/edu/amc/sakai/user/PoolingLdapConnectionManager.java +++ b/providers/jldap/src/java/edu/amc/sakai/user/PoolingLdapConnectionManager.java @@ -22,8 +22,8 @@ package edu.amc.sakai.user; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.pool.ObjectPool; import org.apache.commons.pool.impl.GenericObjectPool; import org.apache.commons.pool.impl.GenericObjectPool.Config; @@ -46,7 +46,7 @@ public class PoolingLdapConnectionManager extends SimpleLdapConnectionManager { /** Class-specific logger */ - private static Log log = LogFactory.getLog(PoolingLdapConnectionManager.class); + private static Logger log = LoggerFactory.getLogger(PoolingLdapConnectionManager.class); /** LDAP connection pool */ private ObjectPool pool; diff --git a/providers/jldap/src/java/edu/amc/sakai/user/SearchExecutingLdapConnectionLivenessValidator.java b/providers/jldap/src/java/edu/amc/sakai/user/SearchExecutingLdapConnectionLivenessValidator.java index 67601a74c92e..e86f80bab585 100644 --- a/providers/jldap/src/java/edu/amc/sakai/user/SearchExecutingLdapConnectionLivenessValidator.java +++ b/providers/jldap/src/java/edu/amc/sakai/user/SearchExecutingLdapConnectionLivenessValidator.java @@ -25,8 +25,8 @@ import java.net.UnknownHostException; import java.text.MessageFormat; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ServerConfigurationService; import com.novell.ldap.LDAPConnection; @@ -74,7 +74,7 @@ public class SearchExecutingLdapConnectionLivenessValidator public static final String DEFAULT_HOST_NAME = "UNKNOWN_HOST"; /** Class-specific logger */ - private static Log log = LogFactory.getLog(SearchExecutingLdapConnectionLivenessValidator.class); + private static Logger log = LoggerFactory.getLogger(SearchExecutingLdapConnectionLivenessValidator.class); /** * An ID for this instance diff --git a/providers/jldap/src/java/edu/amc/sakai/user/SimpleLdapAttributeMapper.java b/providers/jldap/src/java/edu/amc/sakai/user/SimpleLdapAttributeMapper.java index 0c2cb8279673..8ee452f82eee 100644 --- a/providers/jldap/src/java/edu/amc/sakai/user/SimpleLdapAttributeMapper.java +++ b/providers/jldap/src/java/edu/amc/sakai/user/SimpleLdapAttributeMapper.java @@ -35,8 +35,8 @@ import java.util.Set; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.entity.api.ResourceProperties; import org.sakaiproject.user.api.UserEdit; @@ -57,7 +57,7 @@ public class SimpleLdapAttributeMapper implements LdapAttributeMapper { /** Class-specific logger */ - private static Log M_log = LogFactory.getLog(SimpleLdapAttributeMapper.class); + private static Logger M_log = LoggerFactory.getLogger(SimpleLdapAttributeMapper.class); /** * User entry attribute mappings. Keys are logical attr names, diff --git a/providers/jldap/src/java/edu/amc/sakai/user/SimpleLdapConnectionManager.java b/providers/jldap/src/java/edu/amc/sakai/user/SimpleLdapConnectionManager.java index 026a8a8a5348..1f7c5b5ab6fd 100644 --- a/providers/jldap/src/java/edu/amc/sakai/user/SimpleLdapConnectionManager.java +++ b/providers/jldap/src/java/edu/amc/sakai/user/SimpleLdapConnectionManager.java @@ -3,8 +3,8 @@ import java.io.UnsupportedEncodingException; import com.novell.ldap.*; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Allocates connected, constrained, and optionally @@ -22,7 +22,7 @@ public class SimpleLdapConnectionManager implements LdapConnectionManager { "javax.net.ssl.trustStorePassword"; /** Class-specific logger */ - private static Log M_log = LogFactory.getLog(SimpleLdapConnectionManager.class); + private static Logger M_log = LoggerFactory.getLogger(SimpleLdapConnectionManager.class); /** connection allocation configuration */ private LdapConnectionManagerConfig config; diff --git a/providers/jldap/src/java/edu/amc/sakai/user/StringUserTypeMapper.java b/providers/jldap/src/java/edu/amc/sakai/user/StringUserTypeMapper.java index 80f907c08157..0254734c7999 100644 --- a/providers/jldap/src/java/edu/amc/sakai/user/StringUserTypeMapper.java +++ b/providers/jldap/src/java/edu/amc/sakai/user/StringUserTypeMapper.java @@ -20,8 +20,8 @@ **********************************************************************************/ package edu.amc.sakai.user; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.novell.ldap.LDAPEntry; @@ -35,7 +35,7 @@ public class StringUserTypeMapper implements UserTypeMapper { /** Class-specific logger */ - private static Log M_log = LogFactory.getLog(StringUserTypeMapper.class); + private static Logger M_log = LoggerFactory.getLogger(StringUserTypeMapper.class); private String userType; diff --git a/providers/jldap/src/java/edu/amc/sakai/user/UserAttributeRoleProvider.java b/providers/jldap/src/java/edu/amc/sakai/user/UserAttributeRoleProvider.java index 8adf45454cc7..1ed9f1203f6a 100644 --- a/providers/jldap/src/java/edu/amc/sakai/user/UserAttributeRoleProvider.java +++ b/providers/jldap/src/java/edu/amc/sakai/user/UserAttributeRoleProvider.java @@ -6,8 +6,8 @@ import java.util.Map; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.RoleProvider; import org.sakaiproject.user.api.User; import org.sakaiproject.user.api.UserDirectoryService; @@ -22,7 +22,7 @@ */ public class UserAttributeRoleProvider implements RoleProvider { - private static final Log log = LogFactory.getLog(UserAttributeRoleProvider.class); + private static final Logger log = LoggerFactory.getLogger(UserAttributeRoleProvider.class); private String statusAttribute; diff --git a/providers/kerberos/src/java/org/sakaiproject/component/kerberos/user/JassAuthenticate.java b/providers/kerberos/src/java/org/sakaiproject/component/kerberos/user/JassAuthenticate.java index 5a4a6c00f3b7..e8d2181ab6cf 100644 --- a/providers/kerberos/src/java/org/sakaiproject/component/kerberos/user/JassAuthenticate.java +++ b/providers/kerberos/src/java/org/sakaiproject/component/kerberos/user/JassAuthenticate.java @@ -26,8 +26,8 @@ import javax.security.auth.login.LoginContext; import javax.security.auth.login.LoginException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.ietf.jgss.GSSContext; import org.ietf.jgss.GSSCredential; import org.ietf.jgss.GSSException; @@ -43,7 +43,7 @@ */ public class JassAuthenticate { - private final static Log log = LogFactory.getLog(JassAuthenticate.class); + private final static Logger log = LoggerFactory.getLogger(JassAuthenticate.class); private GSSContext clientContext; private GSSContext serverContext; diff --git a/providers/kerberos/src/java/org/sakaiproject/component/kerberos/user/KerberosUserDirectoryProvider.java b/providers/kerberos/src/java/org/sakaiproject/component/kerberos/user/KerberosUserDirectoryProvider.java index 7d7f1d26ee99..ef2330973594 100644 --- a/providers/kerberos/src/java/org/sakaiproject/component/kerberos/user/KerberosUserDirectoryProvider.java +++ b/providers/kerberos/src/java/org/sakaiproject/component/kerberos/user/KerberosUserDirectoryProvider.java @@ -29,8 +29,8 @@ import javax.security.auth.login.LoginContext; import javax.security.auth.login.LoginException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.user.api.UserDirectoryProvider; import org.sakaiproject.user.api.UserEdit; @@ -47,7 +47,7 @@ public class KerberosUserDirectoryProvider implements UserDirectoryProvider { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(KerberosUserDirectoryProvider.class); + private static Logger M_log = LoggerFactory.getLogger(KerberosUserDirectoryProvider.class); // Should we attempt ticket verification? private boolean m_verifyTicket; diff --git a/providers/openldap/src/java/es/udl/asic/user/OpenLdapDirectoryProvider.java b/providers/openldap/src/java/es/udl/asic/user/OpenLdapDirectoryProvider.java index 40666cc1e5f1..dd5e3cebd0b2 100644 --- a/providers/openldap/src/java/es/udl/asic/user/OpenLdapDirectoryProvider.java +++ b/providers/openldap/src/java/es/udl/asic/user/OpenLdapDirectoryProvider.java @@ -35,8 +35,8 @@ import javax.naming.directory.SearchControls; import javax.naming.directory.SearchResult; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.user.api.UserDirectoryProvider; import org.sakaiproject.user.api.UserEdit; @@ -50,7 +50,7 @@ public class OpenLdapDirectoryProvider implements UserDirectoryProvider { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(OpenLdapDirectoryProvider.class); + private static Logger M_log = LoggerFactory.getLogger(OpenLdapDirectoryProvider.class); private String ldapHost = ""; // address of ldap server diff --git a/providers/sample/src/java/org/sakaiproject/provider/authzGroup/SampleGroupProvider.java b/providers/sample/src/java/org/sakaiproject/provider/authzGroup/SampleGroupProvider.java index ab8bebbbf06c..60d18c2f71fc 100644 --- a/providers/sample/src/java/org/sakaiproject/provider/authzGroup/SampleGroupProvider.java +++ b/providers/sample/src/java/org/sakaiproject/provider/authzGroup/SampleGroupProvider.java @@ -29,8 +29,8 @@ import java.util.Map; import java.util.Properties; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.GroupProvider; import org.apache.commons.lang.StringUtils; @@ -59,7 +59,7 @@ public class SampleGroupProvider implements GroupProvider { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(SampleGroupProvider.class); + private static Logger M_log = LoggerFactory.getLogger(SampleGroupProvider.class); /********************************************************************************************************************************************************************************************************************************************************** * Dependencies and their setter methods diff --git a/providers/sample/src/java/org/sakaiproject/provider/user/SampleUserDirectoryProvider.java b/providers/sample/src/java/org/sakaiproject/provider/user/SampleUserDirectoryProvider.java index 5c1dc4fd0ce6..4702cb7baecd 100644 --- a/providers/sample/src/java/org/sakaiproject/provider/user/SampleUserDirectoryProvider.java +++ b/providers/sample/src/java/org/sakaiproject/provider/user/SampleUserDirectoryProvider.java @@ -27,8 +27,8 @@ import java.util.Iterator; import java.util.Vector; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.user.api.DisplayAdvisorUDP; import org.sakaiproject.user.api.User; import org.sakaiproject.user.api.UserDirectoryProvider; @@ -47,7 +47,7 @@ public class SampleUserDirectoryProvider implements UserDirectoryProvider, Users public static final String EMAIL_DOMAIN = "@example.edu"; /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(SampleUserDirectoryProvider.class); + private static Logger M_log = LoggerFactory.getLogger(SampleUserDirectoryProvider.class); /********************************************************************************************************************************************************************************************************************************************************** * Dependencies and their setter methods diff --git a/reset-pass/account-validator-impl/src/java/org/sakaiproject/accountvalidator/impl/jobs/CheckAccountsJob.java b/reset-pass/account-validator-impl/src/java/org/sakaiproject/accountvalidator/impl/jobs/CheckAccountsJob.java index 65b7082cc31f..49e80072ff62 100644 --- a/reset-pass/account-validator-impl/src/java/org/sakaiproject/accountvalidator/impl/jobs/CheckAccountsJob.java +++ b/reset-pass/account-validator-impl/src/java/org/sakaiproject/accountvalidator/impl/jobs/CheckAccountsJob.java @@ -21,8 +21,8 @@ import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; @@ -33,7 +33,7 @@ public class CheckAccountsJob implements Job { - private static Log log = LogFactory.getLog(CheckAccountsJob.class); + private static Logger log = LoggerFactory.getLogger(CheckAccountsJob.class); private UserDirectoryService userDirectoryService; public void setUserDirectoryService(UserDirectoryService uds) { diff --git a/reset-pass/account-validator-impl/src/java/org/sakaiproject/accountvalidator/impl/jobs/CheckValidations.java b/reset-pass/account-validator-impl/src/java/org/sakaiproject/accountvalidator/impl/jobs/CheckValidations.java index 24fef55699b9..7ec82164eb55 100644 --- a/reset-pass/account-validator-impl/src/java/org/sakaiproject/accountvalidator/impl/jobs/CheckValidations.java +++ b/reset-pass/account-validator-impl/src/java/org/sakaiproject/accountvalidator/impl/jobs/CheckValidations.java @@ -31,8 +31,8 @@ import java.util.Set; import java.util.Map.Entry; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.joda.time.DateTime; import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormatter; @@ -62,7 +62,7 @@ public class CheckValidations implements Job { - private static Log log = LogFactory.getLog(CheckValidations.class); + private static Logger log = LoggerFactory.getLogger(CheckValidations.class); private ValidationLogic validationLogic; diff --git a/reset-pass/account-validator-impl/src/java/org/sakaiproject/accountvalidator/logic/impl/ValidationLogicImpl.java b/reset-pass/account-validator-impl/src/java/org/sakaiproject/accountvalidator/logic/impl/ValidationLogicImpl.java index 0ea232fffe8d..5805cfb7648a 100644 --- a/reset-pass/account-validator-impl/src/java/org/sakaiproject/accountvalidator/logic/impl/ValidationLogicImpl.java +++ b/reset-pass/account-validator-impl/src/java/org/sakaiproject/accountvalidator/logic/impl/ValidationLogicImpl.java @@ -35,8 +35,8 @@ import java.util.Map; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.lang.StringUtils; import org.jdom.Document; import org.jdom.Element; @@ -91,7 +91,7 @@ public class ValidationLogicImpl implements ValidationLogic { private static final String TEMPLATE_KEY_ACKNOWLEDGE_PASSWORD_RESET = "acknowledge.passwordReset"; private static final int VALIDATION_PERIOD_MONTHS = -36; - private static Log log = LogFactory.getLog(ValidationLogicImpl.class); + private static Logger log = LoggerFactory.getLogger(ValidationLogicImpl.class); private static final String MAX_PASSWORD_RESET_MINUTES = "accountValidator.maxPasswordResetMinutes"; diff --git a/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/otp/AcountValidationLocator.java b/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/otp/AcountValidationLocator.java index 3cc25dbc03a4..5a4a954c43fa 100644 --- a/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/otp/AcountValidationLocator.java +++ b/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/otp/AcountValidationLocator.java @@ -19,8 +19,8 @@ */ package org.sakaiproject.accountvalidator.tool.otp; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.joda.time.DateTime; import org.joda.time.format.DateTimeFormatter; import org.joda.time.format.ISODateTimeFormat; @@ -51,7 +51,7 @@ import java.util.Map; public class AcountValidationLocator implements BeanLocator { - private static Log log = LogFactory.getLog(AcountValidationLocator.class); + private static Logger log = LoggerFactory.getLogger(AcountValidationLocator.class); public static final String NEW_PREFIX = "new"; public static final String UNKOWN_PREFIX = "unkown"; diff --git a/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/otp/ClaimLocator.java b/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/otp/ClaimLocator.java index c74d418d78f8..4b52dfca53a4 100644 --- a/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/otp/ClaimLocator.java +++ b/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/otp/ClaimLocator.java @@ -25,8 +25,8 @@ import javax.servlet.http.HttpServletRequest; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.accountvalidator.logic.ValidationException; import org.sakaiproject.accountvalidator.logic.ValidationLogic; import org.sakaiproject.accountvalidator.model.ValidationAccount; @@ -48,7 +48,7 @@ import uk.org.ponder.messageutil.TargettedMessageList; public class ClaimLocator implements BeanLocator { - private static Log log = LogFactory.getLog(ClaimLocator.class); + private static Logger log = LoggerFactory.getLogger(ClaimLocator.class); private ValidationLogic validationLogic; public void setValidationLogic(ValidationLogic vl) { diff --git a/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/producers/BaseValidationProducer.java b/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/producers/BaseValidationProducer.java index 7e420edf7d76..cb722bb24fd4 100644 --- a/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/producers/BaseValidationProducer.java +++ b/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/producers/BaseValidationProducer.java @@ -1,7 +1,7 @@ package org.sakaiproject.accountvalidator.tool.producers; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.accountvalidator.logic.ValidationLogic; import org.sakaiproject.accountvalidator.model.ValidationAccount; import org.sakaiproject.accountvalidator.tool.params.ValidationViewParams; @@ -28,7 +28,7 @@ public class BaseValidationProducer implements ViewParamsReporter { - private static Log log = LogFactory.getLog(BaseValidationProducer.class); + private static Logger log = LoggerFactory.getLogger(BaseValidationProducer.class); protected ServerConfigurationService serverConfigurationService; public void setServerConfigurationService (ServerConfigurationService serverConfigurationService) diff --git a/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/producers/MainProducer.java b/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/producers/MainProducer.java index f221e60f1ed9..f2a330299e37 100644 --- a/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/producers/MainProducer.java +++ b/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/producers/MainProducer.java @@ -19,8 +19,8 @@ */ package org.sakaiproject.accountvalidator.tool.producers; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.accountvalidator.model.ValidationAccount; import org.sakaiproject.accountvalidator.tool.otp.AcountValidationLocator; import org.sakaiproject.accountvalidator.tool.params.ValidationViewParams; @@ -39,7 +39,7 @@ public class MainProducer implements ViewComponentProducer, DefaultView, ActionResultInterceptor { - private static Log log = LogFactory.getLog(MainProducer.class); + private static Logger log = LoggerFactory.getLogger(MainProducer.class); public static final String VIEW_ID = "main"; public String getViewID() { diff --git a/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/producers/NewUserProducer.java b/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/producers/NewUserProducer.java index 7ae2e0777a88..7894ec377317 100644 --- a/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/producers/NewUserProducer.java +++ b/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/producers/NewUserProducer.java @@ -19,8 +19,8 @@ */ package org.sakaiproject.accountvalidator.tool.producers; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.accountvalidator.model.ValidationAccount; import org.sakaiproject.entitybroker.EntityReference; import org.sakaiproject.exception.IdUnusedException; @@ -45,7 +45,7 @@ */ public class NewUserProducer extends BaseValidationProducer implements ViewComponentProducer, ActionResultInterceptor { - private static Log log = LogFactory.getLog(NewUserProducer.class); + private static Logger log = LoggerFactory.getLogger(NewUserProducer.class); public static final String VIEW_ID = "newUser"; public String getViewID() { diff --git a/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/producers/PasswordResetProducer.java b/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/producers/PasswordResetProducer.java index 9241b38a611f..cb0c32e5b06a 100644 --- a/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/producers/PasswordResetProducer.java +++ b/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/producers/PasswordResetProducer.java @@ -19,8 +19,8 @@ */ package org.sakaiproject.accountvalidator.tool.producers; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.joda.time.Period; import org.joda.time.format.PeriodFormat; import org.joda.time.format.PeriodFormatter; @@ -44,7 +44,7 @@ */ public class PasswordResetProducer extends BaseValidationProducer implements ViewComponentProducer, ActionResultInterceptor { - private static Log log = LogFactory.getLog(PasswordResetProducer.class); + private static Logger log = LoggerFactory.getLogger(PasswordResetProducer.class); public static final String VIEW_ID = "passwordReset"; private static final String MAX_PASSWORD_RESET_MINUTES = "accountValidator.maxPasswordResetMinutes"; private static LocaleGetter localeGetter; diff --git a/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/producers/RequestAccountProducer.java b/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/producers/RequestAccountProducer.java index d9113ffc4669..8c858f5acd73 100644 --- a/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/producers/RequestAccountProducer.java +++ b/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/producers/RequestAccountProducer.java @@ -1,7 +1,7 @@ package org.sakaiproject.accountvalidator.tool.producers; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.accountvalidator.model.ValidationAccount; import org.sakaiproject.entitybroker.EntityReference; import org.sakaiproject.user.api.User; @@ -20,7 +20,7 @@ */ public class RequestAccountProducer extends BaseValidationProducer implements ViewComponentProducer, ActionResultInterceptor { - private static final Log log = LogFactory.getLog(RequestAccountProducer.class); + private static final Logger log = LoggerFactory.getLogger(RequestAccountProducer.class); public static final String VIEW_ID = "requestAccount"; public String getViewID() diff --git a/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/producers/TransferMembershipsProducer.java b/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/producers/TransferMembershipsProducer.java index 6e9f24ce1621..3a577ea6e828 100644 --- a/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/producers/TransferMembershipsProducer.java +++ b/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/producers/TransferMembershipsProducer.java @@ -24,8 +24,8 @@ import java.util.List; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.accountvalidator.model.ValidationAccount; import org.sakaiproject.accountvalidator.tool.otp.AcountValidationLocator; import org.sakaiproject.accountvalidator.tool.params.ValidationViewParams; @@ -64,7 +64,7 @@ */ public class TransferMembershipsProducer extends BaseValidationProducer implements ViewComponentProducer, ActionResultInterceptor { - private static Log log = LogFactory.getLog(NewUserProducer.class); + private static Logger log = LoggerFactory.getLogger(NewUserProducer.class); public static final String VIEW_ID = "transferMemberships"; public String getViewID() diff --git a/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/producers/ValidationProducer.java b/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/producers/ValidationProducer.java index 948e0a69ba5d..fd25fbe4324f 100644 --- a/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/producers/ValidationProducer.java +++ b/reset-pass/account-validator-tool/src/java/org/sakaiproject/accountvalidator/tool/producers/ValidationProducer.java @@ -24,8 +24,8 @@ import java.util.List; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.accountvalidator.logic.ValidationLogic; import org.sakaiproject.accountvalidator.model.ValidationAccount; import org.sakaiproject.accountvalidator.tool.params.ValidationViewParams; @@ -65,7 +65,7 @@ public class ValidationProducer implements ViewComponentProducer, ViewParamsReporter, ActionResultInterceptor { - private static Log log = LogFactory.getLog(ValidationProducer.class); + private static Logger log = LoggerFactory.getLogger(ValidationProducer.class); public static final String VIEW_ID = "validate"; private static final String MAX_PASSWORD_RESET_MINUTES = "accountValidator.maxPasswordResetMinutes"; diff --git a/reset-pass/reset-pass/src/java/org/sakaiproject/tool/resetpass/FormHandler.java b/reset-pass/reset-pass/src/java/org/sakaiproject/tool/resetpass/FormHandler.java index 8e1336b93922..cccfb09b00a6 100644 --- a/reset-pass/reset-pass/src/java/org/sakaiproject/tool/resetpass/FormHandler.java +++ b/reset-pass/reset-pass/src/java/org/sakaiproject/tool/resetpass/FormHandler.java @@ -4,8 +4,8 @@ import java.util.List; import java.util.Random; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.accountvalidator.logic.ValidationLogic; import org.sakaiproject.accountvalidator.model.ValidationAccount; import org.sakaiproject.authz.api.SecurityAdvisor; @@ -66,7 +66,7 @@ public void setValidationLogic(ValidationLogic validationLogic) { } - private static Log m_log = LogFactory.getLog(FormHandler.class); + private static Logger m_log = LoggerFactory.getLogger(FormHandler.class); public String processAction() { //siteManage.validateNewUsers = false use the classic method: diff --git a/reset-pass/reset-pass/src/java/org/sakaiproject/tool/resetpass/UserValidator.java b/reset-pass/reset-pass/src/java/org/sakaiproject/tool/resetpass/UserValidator.java index 78578c1e565e..a8c3e6f7c837 100644 --- a/reset-pass/reset-pass/src/java/org/sakaiproject/tool/resetpass/UserValidator.java +++ b/reset-pass/reset-pass/src/java/org/sakaiproject/tool/resetpass/UserValidator.java @@ -6,8 +6,8 @@ import java.util.List; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.user.api.User; import org.sakaiproject.user.api.UserDirectoryService; @@ -19,7 +19,7 @@ public class UserValidator implements Validator { - private static Log m_log = LogFactory.getLog(UserValidator.class); + private static Logger m_log = LoggerFactory.getLogger(UserValidator.class); // prefix for error messages - indicates they are to be pulled from tool configuration rather than a resource bundle private final String TOOL_CONFIG_PREFIX = "toolconfig_"; diff --git a/rights/rights-impl/impl/src/java/org/sakaiproject/rights/impl/BaseRightsService.java b/rights/rights-impl/impl/src/java/org/sakaiproject/rights/impl/BaseRightsService.java index 03468fb6bcdb..a0a20074bfcf 100644 --- a/rights/rights-impl/impl/src/java/org/sakaiproject/rights/impl/BaseRightsService.java +++ b/rights/rights-impl/impl/src/java/org/sakaiproject/rights/impl/BaseRightsService.java @@ -27,8 +27,8 @@ import java.util.Set; import java.util.Stack; import java.util.TreeSet; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.exception.IdUnusedException; import org.sakaiproject.id.cover.IdManager; import org.sakaiproject.rights.api.Copyright; @@ -458,7 +458,7 @@ public interface Storage /** Our logger. */ - private static Log M_log = LogFactory.getLog(BaseRightsService.class); + private static Logger M_log = LoggerFactory.getLogger(BaseRightsService.class); protected Storage m_storage = null; diff --git a/roster2/src/java/org/sakaiproject/roster/api/RosterMemberComparator.java b/roster2/src/java/org/sakaiproject/roster/api/RosterMemberComparator.java index 68226b76d7d8..d350a2dab6f3 100644 --- a/roster2/src/java/org/sakaiproject/roster/api/RosterMemberComparator.java +++ b/roster2/src/java/org/sakaiproject/roster/api/RosterMemberComparator.java @@ -24,8 +24,8 @@ import lombok.RequiredArgsConstructor; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Comparator for RosterMembers. @@ -35,7 +35,7 @@ @RequiredArgsConstructor public class RosterMemberComparator implements Comparator { - private static final Log log = LogFactory.getLog(RosterMemberComparator.class); + private static final Logger log = LoggerFactory.getLogger(RosterMemberComparator.class); private final boolean firstNameLastName; private final Collator collator = Collator.getInstance(); diff --git a/roster2/src/java/org/sakaiproject/roster/impl/SakaiProxyImpl.java b/roster2/src/java/org/sakaiproject/roster/impl/SakaiProxyImpl.java index dc7fcbb6122a..86ccbcef74c8 100644 --- a/roster2/src/java/org/sakaiproject/roster/impl/SakaiProxyImpl.java +++ b/roster2/src/java/org/sakaiproject/roster/impl/SakaiProxyImpl.java @@ -22,8 +22,8 @@ import java.util.*; import org.apache.commons.lang.ArrayUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.privacy.PrivacyManager; import org.sakaiproject.authz.api.AuthzGroup; import org.sakaiproject.authz.api.FunctionManager; @@ -75,7 +75,7 @@ @Setter public class SakaiProxyImpl implements SakaiProxy, Observer { - private static final Log log = LogFactory.getLog(SakaiProxyImpl.class); + private static final Logger log = LoggerFactory.getLogger(SakaiProxyImpl.class); private CourseManagementService courseManagementService; private EventTrackingService eventTrackingService; diff --git a/roster2/src/java/org/sakaiproject/roster/tool/RosterTool.java b/roster2/src/java/org/sakaiproject/roster/tool/RosterTool.java index d1b2059cdc6f..abaf84a6d540 100644 --- a/roster2/src/java/org/sakaiproject/roster/tool/RosterTool.java +++ b/roster2/src/java/org/sakaiproject/roster/tool/RosterTool.java @@ -31,8 +31,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.roster.api.SakaiProxy; import org.sakaiproject.util.ResourceLoader; @@ -50,7 +50,7 @@ public class RosterTool extends HttpServlet { private static final long serialVersionUID = 1L; - private static final Log log = LogFactory.getLog(RosterTool.class); + private static final Logger log = LoggerFactory.getLogger(RosterTool.class); private SakaiProxy sakaiProxy; diff --git a/roster2/src/java/org/sakaiproject/roster/tool/entityprovider/RosterPOIEntityProvider.java b/roster2/src/java/org/sakaiproject/roster/tool/entityprovider/RosterPOIEntityProvider.java index b455d852bb71..7d051455251b 100644 --- a/roster2/src/java/org/sakaiproject/roster/tool/entityprovider/RosterPOIEntityProvider.java +++ b/roster2/src/java/org/sakaiproject/roster/tool/entityprovider/RosterPOIEntityProvider.java @@ -32,8 +32,8 @@ import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; @@ -67,7 +67,7 @@ public class RosterPOIEntityProvider extends AbstractEntityProvider implements AutoRegisterEntityProvider, ActionsExecutable, RequestAware { - private static final Log log = LogFactory.getLog(RosterPOIEntityProvider.class); + private static final Logger log = LoggerFactory.getLogger(RosterPOIEntityProvider.class); public final static String ENTITY_PREFIX = "roster-export"; public final static String DEFAULT_ID = ":ID:"; diff --git a/roster2/src/java/org/sakaiproject/roster/tool/entityprovider/RosterSiteEntityProvider.java b/roster2/src/java/org/sakaiproject/roster/tool/entityprovider/RosterSiteEntityProvider.java index c44c34b195bb..c65f23bfebf2 100644 --- a/roster2/src/java/org/sakaiproject/roster/tool/entityprovider/RosterSiteEntityProvider.java +++ b/roster2/src/java/org/sakaiproject/roster/tool/entityprovider/RosterSiteEntityProvider.java @@ -25,8 +25,8 @@ import java.util.HashMap; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.entitybroker.EntityReference; import org.sakaiproject.entitybroker.EntityView; import org.sakaiproject.entitybroker.entityprovider.annotations.EntityCustomAction; @@ -58,7 +58,7 @@ public class RosterSiteEntityProvider extends AbstractEntityProvider implements AutoRegisterEntityProvider, ActionsExecutable, Outputable { @SuppressWarnings("unused") - private static final Log log = LogFactory.getLog(RosterSiteEntityProvider.class); + private static final Logger log = LoggerFactory.getLogger(RosterSiteEntityProvider.class); public final static String ENTITY_PREFIX = "roster-membership"; public final static String DEFAULT_ID = ":ID:"; diff --git a/rwiki/rwiki-access-tool/src/java/uk/ac/cam/caret/sakai/rwiki/access/WikiAccessServlet.java b/rwiki/rwiki-access-tool/src/java/uk/ac/cam/caret/sakai/rwiki/access/WikiAccessServlet.java index 30b4dd9ff4ba..98509ca5f47e 100644 --- a/rwiki/rwiki-access-tool/src/java/uk/ac/cam/caret/sakai/rwiki/access/WikiAccessServlet.java +++ b/rwiki/rwiki-access-tool/src/java/uk/ac/cam/caret/sakai/rwiki/access/WikiAccessServlet.java @@ -29,8 +29,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.entity.api.EntityAccessOverloadException; import org.sakaiproject.entity.api.EntityNotDefinedException; import org.sakaiproject.entity.api.EntityPermissionException; @@ -58,7 +58,7 @@ public class WikiAccessServlet extends HttpServlet { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(WikiAccessServlet.class); + private static Logger M_log = LoggerFactory.getLogger(WikiAccessServlet.class); protected BasicAuth basicAuth = null; diff --git a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/dao/impl/RWikiCurrentObjectContentDaoImpl.java b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/dao/impl/RWikiCurrentObjectContentDaoImpl.java index 173452a5c251..c92b80253170 100644 --- a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/dao/impl/RWikiCurrentObjectContentDaoImpl.java +++ b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/dao/impl/RWikiCurrentObjectContentDaoImpl.java @@ -22,8 +22,8 @@ import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.HibernateException; import org.hibernate.Session; import org.hibernate.criterion.Expression; @@ -42,8 +42,7 @@ public class RWikiCurrentObjectContentDaoImpl extends HibernateDaoSupport implements RWikiObjectContentDao { - private static Log log = LogFactory - .getLog(RWikiCurrentObjectContentDaoImpl.class); + private static Logger log = LoggerFactory.getLogger(RWikiCurrentObjectContentDaoImpl.class); public RWikiObjectContent getContentObject(final RWikiObject parent) { @@ -64,18 +63,10 @@ public Object doInHibernate(Session session) List found = (List) getHibernateTemplate().execute(callback); if (found.size() == 0) { - if (log.isDebugEnabled()) - { - log.debug("Found " + found.size() + " objects with id " - + parent.getId()); - } + log.debug("Found {} objects with id {}", found.size(), parent.getId()); return null; } - if (log.isDebugEnabled()) - { - log.debug("Found " + found.size() + " objects with name " - + parent.getId() + " returning most recent one."); - } + log.debug("Found {} objects with name {} returning most recent one.", found.size(), parent.getId()); return (RWikiObjectContent) found.get(0); } finally diff --git a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/dao/impl/RWikiCurrentObjectDaoImpl.java b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/dao/impl/RWikiCurrentObjectDaoImpl.java index dd277e8b4f0b..9d716b8c0623 100644 --- a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/dao/impl/RWikiCurrentObjectDaoImpl.java +++ b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/dao/impl/RWikiCurrentObjectDaoImpl.java @@ -25,8 +25,8 @@ import java.util.Date; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.Hibernate; import org.hibernate.HibernateException; import org.hibernate.Session; @@ -52,7 +52,7 @@ public class RWikiCurrentObjectDaoImpl extends HibernateDaoSupport implements RWikiCurrentObjectDao, ObjectProxy { - private static Log log = LogFactory.getLog(RWikiCurrentObjectDaoImpl.class); + private static Logger log = LoggerFactory.getLogger(RWikiCurrentObjectDaoImpl.class); protected RWikiObjectContentDao contentDAO = null; diff --git a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/dao/impl/RWikiHistoryObjectContentDaoImpl.java b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/dao/impl/RWikiHistoryObjectContentDaoImpl.java index 3acbfdcdd74a..afd98262c3a7 100644 --- a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/dao/impl/RWikiHistoryObjectContentDaoImpl.java +++ b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/dao/impl/RWikiHistoryObjectContentDaoImpl.java @@ -22,8 +22,8 @@ import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.HibernateException; import org.hibernate.Session; import org.hibernate.criterion.Expression; @@ -42,8 +42,7 @@ public class RWikiHistoryObjectContentDaoImpl extends HibernateDaoSupport implements RWikiObjectContentDao { - private static Log log = LogFactory - .getLog(RWikiHistoryObjectContentDaoImpl.class); + private static Logger log = LoggerFactory.getLogger(RWikiHistoryObjectContentDaoImpl.class); public RWikiObjectContent getContentObject(final RWikiObject parent) { @@ -64,18 +63,10 @@ public Object doInHibernate(Session session) List found = (List) getHibernateTemplate().execute(callback); if (found.size() == 0) { - if (log.isDebugEnabled()) - { - log.debug("Found " + found.size() + " objects with id " - + parent.getId()); - } + log.debug("Found {} objects with id {}", found.size(), parent.getId()); return null; } - if (log.isDebugEnabled()) - { - log.debug("Found " + found.size() + " objects with name " - + parent.getId() + " returning most recent one."); - } + log.debug("Found {} objects with name {} returning most recent one.", found.size(), parent.getId()); return (RWikiObjectContent) found.get(0); } finally diff --git a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/dao/impl/RWikiHistoryObjectDaoImpl.java b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/dao/impl/RWikiHistoryObjectDaoImpl.java index 1c2745c8080f..766360a5a1f0 100644 --- a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/dao/impl/RWikiHistoryObjectDaoImpl.java +++ b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/dao/impl/RWikiHistoryObjectDaoImpl.java @@ -22,8 +22,8 @@ import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.HibernateException; import org.hibernate.Session; import org.hibernate.criterion.Expression; @@ -48,7 +48,7 @@ public class RWikiHistoryObjectDaoImpl extends HibernateDaoSupport implements private RWikiObjectContentDao contentDAO; - private static Log log = LogFactory.getLog(RWikiHistoryObjectDaoImpl.class); + private static Logger log = LoggerFactory.getLogger(RWikiHistoryObjectDaoImpl.class); /** * @see uk.ac.cam.caret.sakai.rwiki.service.api.api.dao.RWikiHistoryObjectDao#update(uk.ac.cam.caret.sakai.rwiki.service.api.api.model.RWikiHistoryObject) diff --git a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/dao/impl/RWikiPropertyDaoImpl.java b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/dao/impl/RWikiPropertyDaoImpl.java index 16c09353e975..72b161468364 100644 --- a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/dao/impl/RWikiPropertyDaoImpl.java +++ b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/dao/impl/RWikiPropertyDaoImpl.java @@ -22,8 +22,8 @@ import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.HibernateException; import org.hibernate.Session; import org.hibernate.criterion.Expression; @@ -41,7 +41,7 @@ public class RWikiPropertyDaoImpl extends HibernateDaoSupport implements RWikiPropertyDao { - private static Log log = LogFactory.getLog(RWikiPropertyDaoImpl.class); + private static Logger log = LoggerFactory.getLogger(RWikiPropertyDaoImpl.class); private String schemaVersion; diff --git a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/macros/SakaiLinkMacro.java b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/macros/SakaiLinkMacro.java index d88881cccfb6..63336278908a 100755 --- a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/macros/SakaiLinkMacro.java +++ b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/macros/SakaiLinkMacro.java @@ -24,8 +24,8 @@ import java.io.IOException; import java.io.Writer; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.radeox.api.engine.ImageRenderEngine; import org.radeox.api.engine.RenderEngine; @@ -45,7 +45,7 @@ public class SakaiLinkMacro extends BaseLocaleMacro { - private static Log log = LogFactory.getLog(SakaiLinkMacro.class); + private static Logger log = LoggerFactory.getLogger(SakaiLinkMacro.class); public String[] getParamDescription() { diff --git a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/message/MessageServiceImpl.java b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/message/MessageServiceImpl.java index 0cfe0069a982..70b6805f0fe0 100644 --- a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/message/MessageServiceImpl.java +++ b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/message/MessageServiceImpl.java @@ -24,8 +24,8 @@ import java.util.Date; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import uk.ac.cam.caret.sakai.rwiki.service.message.api.MessageService; import uk.ac.cam.caret.sakai.rwiki.service.message.api.dao.MessageDao; @@ -38,7 +38,7 @@ */ public class MessageServiceImpl implements MessageService { - private static Log log = LogFactory.getLog(MessageServiceImpl.class); + private static Logger log = LoggerFactory.getLogger(MessageServiceImpl.class); private MessageDao messageDao; diff --git a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/message/PreferenceServiceImpl.java b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/message/PreferenceServiceImpl.java index 1b4720a953bd..c0aba0c18ffb 100644 --- a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/message/PreferenceServiceImpl.java +++ b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/message/PreferenceServiceImpl.java @@ -25,8 +25,8 @@ import java.util.Iterator; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import uk.ac.cam.caret.sakai.rwiki.service.message.api.PreferenceService; import uk.ac.cam.caret.sakai.rwiki.service.message.api.dao.PreferenceDao; @@ -38,7 +38,7 @@ public class PreferenceServiceImpl implements PreferenceService { - private static Log log = LogFactory.getLog(MessageServiceImpl.class); + private static Logger log = LoggerFactory.getLogger(MessageServiceImpl.class); private PreferenceDao preferenceDao = null; diff --git a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/message/TriggerServiceImpl.java b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/message/TriggerServiceImpl.java index bfa705edbbf8..89d4a5d054ee 100644 --- a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/message/TriggerServiceImpl.java +++ b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/message/TriggerServiceImpl.java @@ -25,8 +25,8 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import uk.ac.cam.caret.sakai.rwiki.service.message.api.TriggerHandler; import uk.ac.cam.caret.sakai.rwiki.service.message.api.TriggerService; @@ -38,7 +38,7 @@ */ public class TriggerServiceImpl implements TriggerService { - private static Log log = LogFactory.getLog(TriggerServiceImpl.class); + private static Logger log = LoggerFactory.getLogger(TriggerServiceImpl.class); private TriggerDao triggerDao; diff --git a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/message/dao/impl/MessageDaoImpl.java b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/message/dao/impl/MessageDaoImpl.java index 700fbd74f568..453817f40a16 100644 --- a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/message/dao/impl/MessageDaoImpl.java +++ b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/message/dao/impl/MessageDaoImpl.java @@ -24,8 +24,8 @@ import java.util.Date; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.HibernateException; import org.hibernate.Session; import org.hibernate.criterion.Expression; @@ -42,7 +42,7 @@ */ public class MessageDaoImpl extends HibernateDaoSupport implements MessageDao { - private static Log log = LogFactory.getLog(MessageDaoImpl.class); + private static Logger log = LoggerFactory.getLogger(MessageDaoImpl.class); /* * (non-Javadoc) diff --git a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/message/dao/impl/PagePresenceDaoImpl.java b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/message/dao/impl/PagePresenceDaoImpl.java index f3eff852170f..f353a693e1a1 100644 --- a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/message/dao/impl/PagePresenceDaoImpl.java +++ b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/message/dao/impl/PagePresenceDaoImpl.java @@ -24,8 +24,8 @@ import java.util.Date; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.HibernateException; import org.hibernate.Session; import org.hibernate.criterion.Expression; @@ -44,7 +44,7 @@ public class PagePresenceDaoImpl extends HibernateDaoSupport implements PagePresenceDao { - private static Log log = LogFactory.getLog(PagePresenceDaoImpl.class); + private static Logger log = LoggerFactory.getLogger(PagePresenceDaoImpl.class); /* * (non-Javadoc) diff --git a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/message/dao/impl/PreferenceDaoImpl.java b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/message/dao/impl/PreferenceDaoImpl.java index 161ccb52e515..ca437433d1dd 100644 --- a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/message/dao/impl/PreferenceDaoImpl.java +++ b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/message/dao/impl/PreferenceDaoImpl.java @@ -25,8 +25,8 @@ import java.util.Iterator; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.HibernateException; import org.hibernate.Session; import org.hibernate.criterion.Expression; @@ -44,7 +44,7 @@ public class PreferenceDaoImpl extends HibernateDaoSupport implements PreferenceDao { - private static Log log = LogFactory.getLog(PreferenceDaoImpl.class); + private static Logger log = LoggerFactory.getLogger(PreferenceDaoImpl.class); /** * {@inheritDoc} diff --git a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/message/dao/impl/TriggerDaoImpl.java b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/message/dao/impl/TriggerDaoImpl.java index 7f4abe6e3d08..75d31d6cf21e 100644 --- a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/message/dao/impl/TriggerDaoImpl.java +++ b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/message/dao/impl/TriggerDaoImpl.java @@ -24,8 +24,8 @@ import java.util.Date; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.HibernateException; import org.hibernate.Session; import org.hibernate.criterion.Expression; @@ -42,7 +42,7 @@ */ public class TriggerDaoImpl extends HibernateDaoSupport implements TriggerDao { - private static Log log = LogFactory.getLog(TriggerDaoImpl.class); + private static Logger log = LoggerFactory.getLogger(TriggerDaoImpl.class); /* * (non-Javadoc) diff --git a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/model/impl/DataMigrationSpecification.java b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/model/impl/DataMigrationSpecification.java index eecf68b03d52..ea07747d2948 100644 --- a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/model/impl/DataMigrationSpecification.java +++ b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/model/impl/DataMigrationSpecification.java @@ -24,9 +24,11 @@ import java.util.Iterator; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.Marker; +import org.slf4j.MarkerFactory; import uk.ac.cam.caret.sakai.rwiki.service.api.dao.RWikiPropertyDao; import uk.ac.cam.caret.sakai.rwiki.service.api.model.DataMigrationAgent; import uk.ac.cam.caret.sakai.rwiki.service.api.model.DataMigrationController; @@ -40,8 +42,8 @@ public class DataMigrationSpecification implements DataMigrationController { - private static Log log = LogFactory - .getLog(DataMigrationSpecification.class); + private static Logger log = LoggerFactory.getLogger(DataMigrationSpecification.class); + private static final Marker fatal = MarkerFactory.getMarker("FATAL"); private RWikiProperty targetVersion; @@ -76,8 +78,7 @@ public void update() throws Exception if (currentVersionString != null && currentVersionString.equals(targetVersionString)) { - log.info("No data migration performed, target version present " - + targetVersionString); + log.info("No data migration performed, target version present {}", targetVersionString); return; } @@ -102,18 +103,14 @@ public void update() throws Exception if (currentVersionString != null && currentVersionString.equals(targetVersionString)) { - log.info("RWiki Data migrated to version " - + currentVersionString + " sucessfuly"); + log.info("RWiki Data migrated to version {} successfully", currentVersionString); // SUCCESS!! return; } } - log - .fatal("RWiki Data has NOT been migrated to the current version, " - + "you MUST investigate before using the RWiki Tool\n currentVersion: " - + currentVersionString - + " targetVersion: " - + targetVersionString); + log.error(fatal, "RWiki Data has NOT been migrated to the current version, " + + "you MUST investigate before using the RWiki Tool\n currentVersion: " + + "{} targetVersion: {}", currentVersionString, targetVersionString); throw new RuntimeException( "RWiki Data has NOT been migrated to the current version, " + "you MUST investigate before using the RWiki Tool\n currentVersion: " diff --git a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/model/impl/RWikiEntityImpl.java b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/model/impl/RWikiEntityImpl.java index 96c36f664755..5fbe72f63d99 100644 --- a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/model/impl/RWikiEntityImpl.java +++ b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/model/impl/RWikiEntityImpl.java @@ -26,8 +26,8 @@ import java.util.Date; import java.util.Stack; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.xerces.impl.dv.util.Base64; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.entity.api.Reference; @@ -49,7 +49,7 @@ public class RWikiEntityImpl implements RWikiEntity { - private static Log log = LogFactory.getLog(RWikiEntityImpl.class); + private static Logger log = LoggerFactory.getLogger(RWikiEntityImpl.class); public static final String RW_ID = "id"; diff --git a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/model/impl/SHAHashMigration.java b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/model/impl/SHAHashMigration.java index 3a05f8ad8c7c..1a2926ba8a07 100644 --- a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/model/impl/SHAHashMigration.java +++ b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/model/impl/SHAHashMigration.java @@ -23,8 +23,8 @@ import java.util.Iterator; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import uk.ac.cam.caret.sakai.rwiki.model.RWikiObjectImpl; import uk.ac.cam.caret.sakai.rwiki.service.api.dao.RWikiObjectDao; @@ -39,7 +39,7 @@ // FIXME: Component public class SHAHashMigration implements DataMigrationAgent { - private static Log log = LogFactory.getLog(SHAHashMigration.class); + private static Logger log = LoggerFactory.getLogger(SHAHashMigration.class); private String from; diff --git a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/model/impl/SQLScriptMigration.java b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/model/impl/SQLScriptMigration.java index ee1332a26189..2e2ba56aa50f 100644 --- a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/model/impl/SQLScriptMigration.java +++ b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/model/impl/SQLScriptMigration.java @@ -36,8 +36,8 @@ import org.hibernate.SessionFactory; import org.apache.commons.io.IOUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.db.cover.SqlService; import org.springframework.jdbc.support.JdbcUtils; import org.springframework.orm.hibernate3.HibernateCallback; @@ -49,7 +49,7 @@ public class SQLScriptMigration implements DataMigrationAgent { - private static Log log = LogFactory.getLog(SQLScriptMigration.class); + private static Logger log = LoggerFactory.getLogger(SQLScriptMigration.class); private String from; diff --git a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/radeox/service/impl/RWikiBaseRenderEngine.java b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/radeox/service/impl/RWikiBaseRenderEngine.java index 73ad03273119..27e1f8050e44 100644 --- a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/radeox/service/impl/RWikiBaseRenderEngine.java +++ b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/radeox/service/impl/RWikiBaseRenderEngine.java @@ -27,8 +27,8 @@ import java.io.Writer; import java.util.Iterator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.radeox.EngineManager; import org.radeox.api.engine.RenderEngine; import org.radeox.api.engine.context.InitialRenderContext; @@ -51,7 +51,7 @@ // FIXME: Component public class RWikiBaseRenderEngine implements RenderEngine { - private static Log log = LogFactory.getLog(RWikiBaseRenderEngine.class); + private static Logger log = LoggerFactory.getLogger(RWikiBaseRenderEngine.class); protected InitialRenderContext initialContext; diff --git a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/radeox/service/impl/RenderContextFactoryImpl.java b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/radeox/service/impl/RenderContextFactoryImpl.java index 61630011bc62..23261879c343 100644 --- a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/radeox/service/impl/RenderContextFactoryImpl.java +++ b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/radeox/service/impl/RenderContextFactoryImpl.java @@ -21,8 +21,8 @@ package uk.ac.cam.caret.sakai.rwiki.component.radeox.service.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.radeox.api.engine.RenderEngine; import org.radeox.api.engine.context.RenderContext; import org.sakaiproject.component.api.ComponentManager; @@ -40,7 +40,7 @@ // FIXME: Component public class RenderContextFactoryImpl implements RenderContextFactory { - private static Log log = LogFactory.getLog(RenderContextFactoryImpl.class); + private static Logger log = LoggerFactory.getLogger(RenderContextFactoryImpl.class); private RWikiObjectService objectService; diff --git a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/radeox/service/impl/RenderEngineFactoryImpl.java b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/radeox/service/impl/RenderEngineFactoryImpl.java index cfe7474c31a0..20ff3f69ce2c 100644 --- a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/radeox/service/impl/RenderEngineFactoryImpl.java +++ b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/radeox/service/impl/RenderEngineFactoryImpl.java @@ -21,8 +21,8 @@ package uk.ac.cam.caret.sakai.rwiki.component.radeox.service.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.radeox.api.engine.RenderEngine; import org.sakaiproject.component.api.ComponentManager; @@ -36,7 +36,7 @@ // FIXME: Component public class RenderEngineFactoryImpl implements RenderEngineFactory { - private static Log log = LogFactory.getLog(RenderEngineFactoryImpl.class); + private static Logger log = LoggerFactory.getLogger(RenderEngineFactoryImpl.class); private RWikiObjectService objectService; diff --git a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/service/impl/BaseFOPSerializer.java b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/service/impl/BaseFOPSerializer.java index c6b5dcd279ca..0f86aee0e606 100644 --- a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/service/impl/BaseFOPSerializer.java +++ b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/service/impl/BaseFOPSerializer.java @@ -36,8 +36,8 @@ import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.Fop; @@ -61,8 +61,7 @@ public class BaseFOPSerializer extends ToSAXHandler implements ContentHandler { - private static final Log logger = LogFactory - .getLog(BaseFOPSerializer.class); + private static final Logger logger = LoggerFactory.getLogger(BaseFOPSerializer.class); private static final String configfile = "/uk/ac/cam/caret/sakai/rwiki/component/service/impl/fop.cfg.xml"; @@ -351,7 +350,7 @@ public void setDocumentLocator(Locator locator) } catch (SAXException e) { - logger.error(e); + logger.error(e.getMessage(), e); } contentHandler.setDocumentLocator(locator); @@ -458,7 +457,7 @@ public void serialize(Node arg0) throws IOException { try { initContentHandler(); } catch (SAXException e) { - logger.error(e); + logger.error(e.getMessage(), e); } sax.serialize(arg0); } diff --git a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/service/impl/RWikiEntityContentProducer.java b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/service/impl/RWikiEntityContentProducer.java index e1eeab6c6802..cd48fa575a27 100644 --- a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/service/impl/RWikiEntityContentProducer.java +++ b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/service/impl/RWikiEntityContentProducer.java @@ -26,8 +26,8 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ComponentManager; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.entity.api.Entity; @@ -51,7 +51,7 @@ public class RWikiEntityContentProducer implements EntityContentProducer { - private static Log log = LogFactory.getLog(RWikiEntityContentProducer.class); + private static Logger log = LoggerFactory.getLogger(RWikiEntityContentProducer.class); private RenderService renderService = null; diff --git a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/service/impl/RWikiObjectServiceImpl.java b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/service/impl/RWikiObjectServiceImpl.java index fdd4e3dacc1e..0fbec155d17e 100644 --- a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/service/impl/RWikiObjectServiceImpl.java +++ b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/service/impl/RWikiObjectServiceImpl.java @@ -34,8 +34,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.alias.api.AliasService; import org.sakaiproject.authz.api.SecurityService; import org.sakaiproject.component.api.ComponentManager; @@ -103,7 +103,7 @@ public class RWikiObjectServiceImpl implements RWikiObjectService { - private static Log log = LogFactory.getLog(RWikiObjectServiceImpl.class); + private static Logger log = LoggerFactory.getLogger(RWikiObjectServiceImpl.class); private RWikiCurrentObjectDao cdao; diff --git a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/service/impl/RWikiSecurityServiceImpl.java b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/service/impl/RWikiSecurityServiceImpl.java index 436d8ee4fea9..d99665af852e 100644 --- a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/service/impl/RWikiSecurityServiceImpl.java +++ b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/service/impl/RWikiSecurityServiceImpl.java @@ -23,8 +23,8 @@ import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.FunctionManager; import org.sakaiproject.authz.api.SecurityService; import org.sakaiproject.component.api.ComponentManager; @@ -51,7 +51,7 @@ // FIXME: Component public class RWikiSecurityServiceImpl implements RWikiSecurityService { - private static Log log = LogFactory.getLog(RWikiSecurityServiceImpl.class); + private static Logger log = LoggerFactory.getLogger(RWikiSecurityServiceImpl.class); private FunctionManager functionManager; diff --git a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/service/impl/RenderServiceImpl.java b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/service/impl/RenderServiceImpl.java index 326778a38176..326986befd91 100644 --- a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/service/impl/RenderServiceImpl.java +++ b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/service/impl/RenderServiceImpl.java @@ -21,8 +21,8 @@ package uk.ac.cam.caret.sakai.rwiki.component.service.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.radeox.api.engine.RenderEngine; import org.radeox.api.engine.context.RenderContext; import org.sakaiproject.component.api.ComponentManager; @@ -41,7 +41,7 @@ // FIXME: Component WITH FIXES, remove deps on page link render impl public class RenderServiceImpl implements RenderService { - private static Log log = LogFactory.getLog(RenderServiceImpl.class); + private static Logger log = LoggerFactory.getLogger(RenderServiceImpl.class); private RenderEngineFactory renderEngineFactory; diff --git a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/service/impl/SiteEmailNotificationRWiki.java b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/service/impl/SiteEmailNotificationRWiki.java index 7f96f010065a..88e3e679c5a4 100644 --- a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/service/impl/SiteEmailNotificationRWiki.java +++ b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/service/impl/SiteEmailNotificationRWiki.java @@ -29,8 +29,8 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.SecurityService; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.component.cover.ServerConfigurationService; @@ -87,8 +87,7 @@ public class MessageContent { } - private static Log log = LogFactory - .getLog(SiteEmailNotificationRWiki.class); + private static Logger log = LoggerFactory.getLogger(SiteEmailNotificationRWiki.class); private RenderService renderService = null; @@ -217,7 +216,7 @@ protected String getPlainMessage(Event event) { .append(rl.getString("SiteEmailNotificationRWiki.4")) .append(mc.content) .append("\n"); - log.debug("Message is " + message); + log.debug("Message is {}", message.toString()); return message.toString(); } @@ -253,7 +252,7 @@ protected String getHtmlMessage(Event event) { .append(mc.content) .append("\n"); String message = formattedText.escapeHtml(sb.toString(), true); - log.debug("Message is " + message); + log.debug("Message is {}", message.toString()); return message; } @@ -304,7 +303,7 @@ private MessageContent getMessageContent(Event event) { messageContent.content = DigestHtml.digest(messageContent.contentHTML); } catch (Exception ex) { - + log.error(ex.getMessage(), ex); } return messageContent; } diff --git a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/service/impl/XSLTEntityHandler.java b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/service/impl/XSLTEntityHandler.java index bc7811063fa5..fccb949fdc61 100644 --- a/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/service/impl/XSLTEntityHandler.java +++ b/rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/service/impl/XSLTEntityHandler.java @@ -44,8 +44,8 @@ import javax.xml.transform.sax.TransformerHandler; import org.apache.commons.lang.StringEscapeUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.xml.serializer.OutputPropertiesFactory; import org.apache.xml.serializer.Serializer; import org.apache.xml.serializer.SerializerFactory; @@ -84,7 +84,7 @@ */ public class XSLTEntityHandler extends BaseEntityHandlerImpl { - private static Log log = LogFactory.getLog(XSLTEntityHandler.class); + private static Logger log = LoggerFactory.getLogger(XSLTEntityHandler.class); private static ThreadLocal currentRequest = new ThreadLocal(); diff --git a/rwiki/rwiki-impl/impl/src/test/uk/ac/cam/caret/sakai/rwiki/component/service/impl/test/XSLTEntityHandlerTest.java b/rwiki/rwiki-impl/impl/src/test/uk/ac/cam/caret/sakai/rwiki/component/service/impl/test/XSLTEntityHandlerTest.java index 1ec39de7b37a..634584cf6326 100644 --- a/rwiki/rwiki-impl/impl/src/test/uk/ac/cam/caret/sakai/rwiki/component/service/impl/test/XSLTEntityHandlerTest.java +++ b/rwiki/rwiki-impl/impl/src/test/uk/ac/cam/caret/sakai/rwiki/component/service/impl/test/XSLTEntityHandlerTest.java @@ -39,8 +39,8 @@ import junit.framework.TestCase; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.fop.apps.Fop; import org.apache.fop.apps.FopFactory; import org.apache.fop.apps.MimeConstants; @@ -58,7 +58,7 @@ */ public class XSLTEntityHandlerTest extends TestCase { - private static Log logger = LogFactory.getLog(XSLTEntityHandlerTest.class); + private static Logger logger = LoggerFactory.getLogger(XSLTEntityHandlerTest.class); private XSLTEntityHandler eh = null; diff --git a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/ExcludeEscapeHtmlReference.java b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/ExcludeEscapeHtmlReference.java index 7f4d07acca7a..3868c340894c 100644 --- a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/ExcludeEscapeHtmlReference.java +++ b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/ExcludeEscapeHtmlReference.java @@ -24,8 +24,8 @@ import java.util.HashMap; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.velocity.app.event.ReferenceInsertionEventHandler; import org.sakaiproject.util.Web; @@ -36,7 +36,7 @@ public class ExcludeEscapeHtmlReference implements ReferenceInsertionEventHandler { - private static final Log log = LogFactory.getLog(ExcludeEscapeHtmlReference.class); + private static final Logger log = LoggerFactory.getLogger(ExcludeEscapeHtmlReference.class); private static Map ignore = new HashMap(); static{ diff --git a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/RWikiServlet.java b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/RWikiServlet.java index ef1da0aa64cd..24d976efc510 100644 --- a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/RWikiServlet.java +++ b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/RWikiServlet.java @@ -31,8 +31,8 @@ import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.api.Tool; import org.sakaiproject.tool.api.ToolSession; import org.sakaiproject.tool.cover.SessionManager; @@ -52,7 +52,7 @@ */ public class RWikiServlet extends HttpServlet { - private static Log log = LogFactory.getLog(RWikiServlet.class); + private static Logger log = LoggerFactory.getLogger(RWikiServlet.class); /** * Required for serialization... also to stop eclipse from giving me a diff --git a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/RequestHelper.java b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/RequestHelper.java index 6659efe3aa06..b60c9558fc35 100644 --- a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/RequestHelper.java +++ b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/RequestHelper.java @@ -23,15 +23,15 @@ import javax.servlet.http.HttpServletRequest; import org.sakaiproject.component.cover.ServerConfigurationService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import uk.ac.cam.caret.sakai.rwiki.tool.api.CommandService; import uk.ac.cam.caret.sakai.rwiki.tool.api.HttpCommand; public class RequestHelper { - private static Log log = LogFactory.getLog(RequestHelper.class); + private static Logger log = LoggerFactory.getLogger(RequestHelper.class); public static final String PANEL = "panel"; diff --git a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/RequestScopeSuperBean.java b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/RequestScopeSuperBean.java index 3b8f1380f4d6..e9a823ddd9c2 100644 --- a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/RequestScopeSuperBean.java +++ b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/RequestScopeSuperBean.java @@ -24,8 +24,8 @@ import javax.servlet.http.HttpServletRequest; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroupService; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.entity.api.Entity; @@ -91,7 +91,7 @@ */ public class RequestScopeSuperBean { - private static Log log = LogFactory.getLog(RequestScopeSuperBean.class); + private static Logger log = LoggerFactory.getLogger(RequestScopeSuperBean.class); public static final String REQUEST_ATTRIBUTE = "rsacMap"; diff --git a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/bean/FullSearchBean.java b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/bean/FullSearchBean.java index fbb0f1082e1f..9d44e01f3613 100644 --- a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/bean/FullSearchBean.java +++ b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/bean/FullSearchBean.java @@ -25,8 +25,8 @@ import java.util.ArrayList; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.search.api.InvalidSearchQueryException; import org.sakaiproject.search.api.SearchList; import org.sakaiproject.search.api.SearchService; @@ -42,7 +42,7 @@ public class FullSearchBean { - private static Log log = LogFactory.getLog(FullSearchBean.class); + private static Logger log = LoggerFactory.getLogger(FullSearchBean.class); /** Tool restriction: see RWikiEntityContentProducer.getTool() **/ private static final String SEARCH_SUFFIX = " +tool:wiki"; diff --git a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/bean/PrePopulateBean.java b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/bean/PrePopulateBean.java index 8571d31fe6c0..abf383ad9396 100644 --- a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/bean/PrePopulateBean.java +++ b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/bean/PrePopulateBean.java @@ -20,8 +20,8 @@ **********************************************************************************/ package uk.ac.cam.caret.sakai.rwiki.tool.bean; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import uk.ac.cam.caret.sakai.rwiki.tool.api.PopulateService; @@ -33,7 +33,7 @@ */ public class PrePopulateBean { - private static Log log = LogFactory.getLog(PrePopulateBean.class); + private static Logger log = LoggerFactory.getLogger(PrePopulateBean.class); private PopulateService populateService; diff --git a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/bean/ResourceLoaderBean.java b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/bean/ResourceLoaderBean.java index 1af4f77dbc4c..774ba5878f6b 100644 --- a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/bean/ResourceLoaderBean.java +++ b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/bean/ResourceLoaderBean.java @@ -27,8 +27,8 @@ import javax.servlet.http.HttpServletRequest; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.util.ResourceLoader; /** @@ -36,7 +36,7 @@ */ public class ResourceLoaderBean implements Map { - private static Log log = LogFactory.getLog(ResourceLoaderBean.class); + private static Logger log = LoggerFactory.getLogger(ResourceLoaderBean.class); private static final String RESOURCE_BUNDLE = "uk.ac.cam.caret.sakai.rwiki.tool.bundle.Messages"; diff --git a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/bean/helper/AuthZGroupCollectionBeanHelper.java b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/bean/helper/AuthZGroupCollectionBeanHelper.java index 6644e6232f56..495489a77914 100755 --- a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/bean/helper/AuthZGroupCollectionBeanHelper.java +++ b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/bean/helper/AuthZGroupCollectionBeanHelper.java @@ -26,8 +26,8 @@ import java.util.Iterator; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroup; import org.sakaiproject.authz.api.AuthzGroupService; import org.sakaiproject.authz.api.GroupNotDefinedException; @@ -42,8 +42,7 @@ public class AuthZGroupCollectionBeanHelper { - private static Log log = LogFactory - .getLog(AuthZGroupCollectionBeanHelper.class); + private static Logger log = LoggerFactory.getLogger(AuthZGroupCollectionBeanHelper.class); public static AuthZGroupCollectionBean createAuthZCollectionBean( AuthzGroupService realmService, RWikiObject currentRWikiObject, diff --git a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/bean/helper/MultiRealmEditBeanHelper.java b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/bean/helper/MultiRealmEditBeanHelper.java index d94639411190..89e837a9831e 100644 --- a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/bean/helper/MultiRealmEditBeanHelper.java +++ b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/bean/helper/MultiRealmEditBeanHelper.java @@ -23,8 +23,8 @@ import javax.servlet.http.HttpServletRequest; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import uk.ac.cam.caret.sakai.rwiki.service.api.model.RWikiObject; import uk.ac.cam.caret.sakai.rwiki.tool.RequestScopeSuperBean; @@ -33,8 +33,7 @@ public class MultiRealmEditBeanHelper { - private static Log log = LogFactory - .getLog(MultiRealmEditBeanHelper.class); + private static Logger log = LoggerFactory.getLogger(MultiRealmEditBeanHelper.class); public static MultiRealmEditBean createMultiRealmEditBean( RWikiObject currentRWikiObject, diff --git a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/bean/helper/RecentlyVisitedHelperBean.java b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/bean/helper/RecentlyVisitedHelperBean.java index 8db48bcce1b8..3da15a5523b2 100644 --- a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/bean/helper/RecentlyVisitedHelperBean.java +++ b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/bean/helper/RecentlyVisitedHelperBean.java @@ -25,8 +25,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import uk.ac.cam.caret.sakai.rwiki.tool.bean.RecentlyVisitedBean; @@ -38,7 +38,7 @@ public class RecentlyVisitedHelperBean { - private static Log log = LogFactory.getLog(RecentlyVisitedHelperBean.class); + private static Logger log = LoggerFactory.getLogger(RecentlyVisitedHelperBean.class); /** * Session attribute to save the recentlyVisitedBean diff --git a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/AddAttachmentReturnCommand.java b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/AddAttachmentReturnCommand.java index 1f9a12d45b47..947f09ccf19f 100755 --- a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/AddAttachmentReturnCommand.java +++ b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/AddAttachmentReturnCommand.java @@ -31,8 +31,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ComponentManager; import org.sakaiproject.content.api.FilePickerHelper; import org.sakaiproject.entity.api.Reference; @@ -57,7 +57,7 @@ public class AddAttachmentReturnCommand implements HttpCommand { - private static Log log = LogFactory.getLog(AddAttachmentReturnCommand.class); + private static Logger log = LoggerFactory.getLogger(AddAttachmentReturnCommand.class); private static final String MULTIPLE_ATTACHMENT_HEADER_START = ""; diff --git a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/BasicHttpCommand.java b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/BasicHttpCommand.java index e2c3e49152a0..93ea8ce6a510 100644 --- a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/BasicHttpCommand.java +++ b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/BasicHttpCommand.java @@ -27,8 +27,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import uk.ac.cam.caret.sakai.rwiki.tool.api.HttpCommand; @@ -37,7 +37,7 @@ */ public class BasicHttpCommand implements HttpCommand { - private static Log log = LogFactory.getLog(BasicHttpCommand.class); + private static Logger log = LoggerFactory.getLogger(BasicHttpCommand.class); private String servletPath; diff --git a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/EditAuthZGroupCommand.java b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/EditAuthZGroupCommand.java index e7544e3db76d..515ef2901fd7 100644 --- a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/EditAuthZGroupCommand.java +++ b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/EditAuthZGroupCommand.java @@ -29,8 +29,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroup; import org.sakaiproject.authz.api.AuthzGroupService; import org.sakaiproject.authz.api.AuthzPermissionException; @@ -54,7 +54,7 @@ */ public class EditAuthZGroupCommand implements HttpCommand { - private static Log log = LogFactory.getLog(EditAuthZGroupCommand.class); + private static Logger log = LoggerFactory.getLogger(EditAuthZGroupCommand.class); private String editRealmPath; diff --git a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/EditManyAuthZGroupCommand.java b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/EditManyAuthZGroupCommand.java index a39ed1c5a974..1d4c8e14880d 100755 --- a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/EditManyAuthZGroupCommand.java +++ b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/EditManyAuthZGroupCommand.java @@ -29,8 +29,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroup; import org.sakaiproject.authz.api.AuthzGroupService; import org.sakaiproject.authz.api.AuthzPermissionException; @@ -54,7 +54,7 @@ */ public class EditManyAuthZGroupCommand implements HttpCommand { - private static Log log = LogFactory.getLog(EditManyAuthZGroupCommand.class); + private static Logger log = LoggerFactory.getLogger(EditManyAuthZGroupCommand.class); private String editRealmPath; diff --git a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/HelperCommand.java b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/HelperCommand.java index 689352ac956e..557ef8a3c80c 100755 --- a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/HelperCommand.java +++ b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/HelperCommand.java @@ -29,8 +29,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ComponentManager; import org.sakaiproject.tool.api.ActiveTool; import org.sakaiproject.tool.api.ActiveToolManager; @@ -47,7 +47,7 @@ public class HelperCommand implements HttpCommand { - private static Log log = LogFactory.getLog(HelperCommand.class); + private static Logger log = LoggerFactory.getLogger(HelperCommand.class); private ActiveToolManager activeToolManager; diff --git a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/RevertCommand.java b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/RevertCommand.java index 2986848b4355..f36decc6f156 100644 --- a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/RevertCommand.java +++ b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/RevertCommand.java @@ -28,8 +28,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ComponentManager; import org.sakaiproject.tool.cover.SessionManager; @@ -54,7 +54,7 @@ public class RevertCommand implements HttpCommand { - private static Log log = LogFactory.getLog(RevertCommand.class); + private static Logger log = LoggerFactory.getLogger(RevertCommand.class); private String successfulPath; @@ -191,4 +191,4 @@ public void setSuccessfulPath(String successfulPath) this.successfulPath = successfulPath; } -} \ No newline at end of file +} diff --git a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/SaveCommand.java b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/SaveCommand.java index 5ebae0527a54..71b7e2a7e490 100644 --- a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/SaveCommand.java +++ b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/SaveCommand.java @@ -29,8 +29,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ComponentManager; import org.sakaiproject.content.api.FilePickerHelper; import org.sakaiproject.tool.api.SessionManager; @@ -59,7 +59,7 @@ */ public class SaveCommand implements HttpCommand { - private static Log log = LogFactory.getLog(SaveCommand.class); + private static Logger log = LoggerFactory.getLogger(SaveCommand.class); private static final String ATTACHMENT_HELPER = "sakai.filepicker"; diff --git a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/UpdatePermissionsCommand.java b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/UpdatePermissionsCommand.java index 8fe1b4834f4b..179662cfb036 100644 --- a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/UpdatePermissionsCommand.java +++ b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/UpdatePermissionsCommand.java @@ -28,8 +28,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ComponentManager; import org.sakaiproject.tool.cover.SessionManager; @@ -54,7 +54,7 @@ */ public class UpdatePermissionsCommand implements HttpCommand { - private static Log log = LogFactory.getLog(UpdatePermissionsCommand.class); + private static Logger log = LoggerFactory.getLogger(UpdatePermissionsCommand.class); private RWikiObjectService objectService; diff --git a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/UpdatePreferencesCommand.java b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/UpdatePreferencesCommand.java index 474ce388c1b0..be6f9a246324 100755 --- a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/UpdatePreferencesCommand.java +++ b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/command/UpdatePreferencesCommand.java @@ -27,8 +27,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ComponentManager; import org.sakaiproject.tool.cover.SessionManager; @@ -46,7 +46,7 @@ public class UpdatePreferencesCommand implements HttpCommand { - private static Log log = LogFactory.getLog(UpdatePreferencesCommand.class); + private static Logger log = LoggerFactory.getLogger(UpdatePreferencesCommand.class); private PreferenceService preferenceService; diff --git a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/entityproviders/DirectServletPageLinkRenderer.java b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/entityproviders/DirectServletPageLinkRenderer.java index 52a425ee8ed5..02422e97bba3 100644 --- a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/entityproviders/DirectServletPageLinkRenderer.java +++ b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/entityproviders/DirectServletPageLinkRenderer.java @@ -3,8 +3,8 @@ import java.io.UnsupportedEncodingException; import java.net.URLEncoder; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import uk.ac.cam.caret.sakai.rwiki.service.api.PageLinkRenderer; import uk.ac.cam.caret.sakai.rwiki.tool.bean.ViewBean; @@ -18,7 +18,7 @@ */ public class DirectServletPageLinkRenderer implements PageLinkRenderer { - private static Log log = LogFactory.getLog(DirectServletPageLinkRenderer.class); + private static Logger log = LoggerFactory.getLogger(DirectServletPageLinkRenderer.class); private boolean cachable = false; diff --git a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/entityproviders/RWikiEntityProvider.java b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/entityproviders/RWikiEntityProvider.java index 2f576f8cd50d..05d35a689bbe 100644 --- a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/entityproviders/RWikiEntityProvider.java +++ b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/entityproviders/RWikiEntityProvider.java @@ -26,8 +26,8 @@ import uk.ac.cam.caret.sakai.rwiki.service.api.model.RWikiObject; import uk.ac.cam.caret.sakai.rwiki.utils.NameHelper; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Provides the /direct/wiki REST endpoint. @@ -42,7 +42,7 @@ */ public class RWikiEntityProvider extends AbstractEntityProvider implements AutoRegisterEntityProvider, ActionsExecutable, Outputable,Describeable { - private static Log log = LogFactory.getLog(RWikiEntityProvider.class); + private static Logger log = LoggerFactory.getLogger(RWikiEntityProvider.class); public final static String ENTITY_PREFIX = "wiki"; diff --git a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/entityproviders/SparserPage.java b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/entityproviders/SparserPage.java index 64683e1dba4e..3c768cb2f368 100644 --- a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/entityproviders/SparserPage.java +++ b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/entityproviders/SparserPage.java @@ -5,8 +5,8 @@ import java.util.ArrayList; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import lombok.Getter; import lombok.Setter; @@ -19,7 +19,7 @@ */ public class SparserPage { - private static Log log = LogFactory.getLog(SparserPage.class); + private static Logger log = LoggerFactory.getLogger(SparserPage.class); @Getter private List childPages = new ArrayList(); diff --git a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/service/impl/CommandServiceImpl.java b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/service/impl/CommandServiceImpl.java index 07c3847267ad..a769a6111917 100644 --- a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/service/impl/CommandServiceImpl.java +++ b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/service/impl/CommandServiceImpl.java @@ -31,8 +31,8 @@ import javax.servlet.http.HttpServletResponse; import javax.servlet.jsp.PageContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import uk.ac.cam.caret.sakai.rwiki.service.exception.PermissionException; import uk.ac.cam.caret.sakai.rwiki.service.api.RWikiObjectService; @@ -53,7 +53,7 @@ */ public class CommandServiceImpl implements CommandService { - private static Log log = LogFactory.getLog(CommandServiceImpl.class); + private static Logger log = LoggerFactory.getLogger(CommandServiceImpl.class); private Map commandMap; diff --git a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/service/impl/PopulateServiceImpl.java b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/service/impl/PopulateServiceImpl.java index 22de23a57399..aea78dd81e86 100644 --- a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/service/impl/PopulateServiceImpl.java +++ b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/service/impl/PopulateServiceImpl.java @@ -28,8 +28,8 @@ import java.util.Iterator; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ComponentManager; import org.sakaiproject.event.cover.EventTrackingService; import org.sakaiproject.site.api.Site; @@ -51,7 +51,7 @@ public class PopulateServiceImpl implements PopulateService { - private static Log log = LogFactory.getLog(PopulateServiceImpl.class); + private static Logger log = LoggerFactory.getLogger(PopulateServiceImpl.class); private List seedPages; diff --git a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/service/impl/ToolRenderServiceImpl.java b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/service/impl/ToolRenderServiceImpl.java index ac9f9a8854d5..ed95230b0708 100644 --- a/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/service/impl/ToolRenderServiceImpl.java +++ b/rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/service/impl/ToolRenderServiceImpl.java @@ -21,8 +21,8 @@ package uk.ac.cam.caret.sakai.rwiki.tool.service.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ComponentManager; import uk.ac.cam.caret.sakai.rwiki.service.api.RenderService; @@ -35,7 +35,7 @@ */ public class ToolRenderServiceImpl implements ToolRenderService { - private static Log log = LogFactory.getLog(ToolRenderServiceImpl.class); + private static Logger log = LoggerFactory.getLogger(ToolRenderServiceImpl.class); private RenderService renderService = null; diff --git a/rwiki/rwiki-util/jrcs/src/completejava/org/apache/commons/jrcs/rcs/KeywordsFormat.java b/rwiki/rwiki-util/jrcs/src/completejava/org/apache/commons/jrcs/rcs/KeywordsFormat.java index 1ad2ea0cebc1..ef743a6dca76 100644 --- a/rwiki/rwiki-util/jrcs/src/completejava/org/apache/commons/jrcs/rcs/KeywordsFormat.java +++ b/rwiki/rwiki-util/jrcs/src/completejava/org/apache/commons/jrcs/rcs/KeywordsFormat.java @@ -147,7 +147,7 @@ String update(String text, Object[] revisionInfo) data = substitute(data, AUTHOR_RE, Author_FORMAT.format(revisionInfo)); data = substitute(data, STATE_RE, State_FORMAT.format(revisionInfo)); data = substitute(data, LOCKER_RE, Locker_FORMAT.format(revisionInfo)); - //@TODO: should do something about Name and Log + //@TODO: should do something about Name and Logger return data; } @@ -170,7 +170,7 @@ String reset(String text) data = substitute(data, AUTHOR_RE, '$' + "Author$"); data = substitute(data, STATE_RE, '$' + "State$"); data = substitute(data, LOCKER_RE, '$' + "Locker$"); - //@TODO: should do something about Name and Log + //@TODO: should do something about Name and Logger return data; } diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/EngineManager.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/EngineManager.java index 8755f5b987d0..0c35a1c09ae1 100755 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/EngineManager.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/EngineManager.java @@ -27,8 +27,8 @@ import java.util.Iterator; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.radeox.api.engine.RenderEngine; import org.radeox.engine.BaseRenderEngine; import org.radeox.util.Service; @@ -44,7 +44,7 @@ public class EngineManager { - private static Log log = LogFactory.getLog(EngineManager.class); + private static Logger log = LoggerFactory.getLogger(EngineManager.class); public static final String DEFAULT = "radeox"; diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/engine/BaseRenderEngine.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/engine/BaseRenderEngine.java index 80d3ac4958ca..0699f1c042bd 100755 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/engine/BaseRenderEngine.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/engine/BaseRenderEngine.java @@ -29,8 +29,8 @@ import java.io.Writer; import java.util.Iterator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.radeox.EngineManager; import org.radeox.api.engine.RenderEngine; import org.radeox.api.engine.context.InitialRenderContext; @@ -54,7 +54,7 @@ public class BaseRenderEngine implements RenderEngine { - private static Log log = LogFactory.getLog(BaseRenderEngine.class); + private static Logger log = LoggerFactory.getLogger(BaseRenderEngine.class); protected InitialRenderContext initialContext; diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/FilterPipe.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/FilterPipe.java index 4736978bdf01..2a9d26515a41 100755 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/FilterPipe.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/FilterPipe.java @@ -28,8 +28,8 @@ import java.util.Iterator; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.radeox.api.engine.context.InitialRenderContext; import org.radeox.api.engine.context.RenderContext; import org.radeox.engine.context.BaseInitialRenderContext; @@ -44,7 +44,7 @@ public class FilterPipe { - private static Log log = LogFactory.getLog(FilterPipe.class); + private static Logger log = LoggerFactory.getLogger(FilterPipe.class); public final static String FIRST_IN_PIPE = "all"; diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/LinkTestFilter.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/LinkTestFilter.java index 811f2118c375..8aa731682f98 100755 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/LinkTestFilter.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/LinkTestFilter.java @@ -28,8 +28,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.radeox.Messages; import org.radeox.api.engine.RenderEngine; import org.radeox.api.engine.WikiRenderEngine; @@ -51,7 +51,7 @@ public class LinkTestFilter extends LocaleRegexTokenFilter { - private static Log log = LogFactory.getLog(LinkTestFilter.class); + private static Logger log = LoggerFactory.getLogger(LinkTestFilter.class); /** * The regular expression for detecting WikiLinks. Overwrite in subclass to diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/ListFilter.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/ListFilter.java index 4ec2859babea..bb1f72231235 100755 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/ListFilter.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/ListFilter.java @@ -28,8 +28,8 @@ import java.util.HashMap; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.radeox.filter.context.FilterContext; import org.radeox.filter.regex.LocaleRegexTokenFilter; import org.radeox.regex.MatchResult; @@ -45,7 +45,7 @@ public class ListFilter extends LocaleRegexTokenFilter implements CacheFilter { - private static Log log = LogFactory.getLog(ListFilter.class); + private static Logger log = LoggerFactory.getLogger(ListFilter.class); private final static Map openList = new HashMap(); @@ -209,4 +209,4 @@ private void addList(StringBuffer buffer, BufferedReader reader) } buffer.append('\n'); } -} \ No newline at end of file +} diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/MacroFilter.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/MacroFilter.java index a7df38cd161b..84d083118c1e 100755 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/MacroFilter.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/MacroFilter.java @@ -25,8 +25,8 @@ import java.io.Writer; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.radeox.Messages; import org.radeox.api.engine.IncludeRenderEngine; import org.radeox.api.engine.RenderEngine; @@ -51,7 +51,7 @@ public class MacroFilter extends RegexTokenFilter { - private static Log log = LogFactory.getLog(MacroFilter.class); + private static Logger log = LoggerFactory.getLogger(MacroFilter.class); // private static MacroFilter instance; diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/ParagraphFilter.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/ParagraphFilter.java index c296dfd20df7..ef92bb4e93e7 100755 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/ParagraphFilter.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/ParagraphFilter.java @@ -27,8 +27,8 @@ import java.util.ResourceBundle; import java.util.regex.Pattern; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.radeox.api.engine.context.InitialRenderContext; import org.radeox.api.engine.context.RenderContext; import org.radeox.filter.context.FilterContext; @@ -44,7 +44,7 @@ public class ParagraphFilter implements Filter, CacheFilter { - private static Log log = LogFactory.getLog(ParagraphFilter.class); + private static Logger log = LoggerFactory.getLogger(ParagraphFilter.class); private InitialRenderContext initialContext; @@ -260,7 +260,7 @@ protected ResourceBundle getOutputBundle() } /* - * private static Log log = LogFactory.getLog(ParagraphFilter.class); private + * private static Logger log = LoggerFactory.getLogger(ParagraphFilter.class); private * String printFirst; private String printNext; private Pattern matchPattern; * protected String getLocaleKey() { return "filter.paragraph"; } protected * boolean isSingleLine() { return false; } public String filter(String input, @@ -287,4 +287,4 @@ protected ResourceBundle getOutputBundle() * RegexReplaceFilter.MULTILINE); matchPattern = compiler.compile(match); } * catch (Exception e) { log.warn("bad pattern: " + match + " -> " + * printFirst+" "+e); } } } - */ \ No newline at end of file + */ diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/XHTMLFilter.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/XHTMLFilter.java index 998d97ae64ae..1dd9b3287a8b 100644 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/XHTMLFilter.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/XHTMLFilter.java @@ -34,8 +34,8 @@ import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.xml.serializer.ToXMLStream; import org.radeox.api.engine.context.InitialRenderContext; import org.radeox.filter.context.FilterContext; @@ -59,7 +59,7 @@ public class XHTMLFilter implements Filter, CacheFilter { - private static Log log = LogFactory.getLog(XHTMLFilter.class); + private static Logger log = LoggerFactory.getLogger(XHTMLFilter.class); private static SAXParserFactory saxParserFactory = SAXParserFactory.newInstance(); private static final Map blockElements = new HashMap(); diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/balance/Balancer.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/balance/Balancer.java index 5d2040188217..a896711d09a6 100644 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/balance/Balancer.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/balance/Balancer.java @@ -8,15 +8,15 @@ import java.util.List; import java.util.regex.Matcher; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @author andrew */ public class Balancer { - private static final Log log = LogFactory.getLog(Balancer.class); + private static final Logger log = LoggerFactory.getLogger(Balancer.class); StringBuffer sb; diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/interwiki/InterWiki.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/interwiki/InterWiki.java index aac98582af53..f14257430e98 100755 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/interwiki/InterWiki.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/interwiki/InterWiki.java @@ -32,8 +32,8 @@ import java.util.Iterator; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.radeox.util.Encoder; /** @@ -45,7 +45,7 @@ public class InterWiki { - private static Log log = LogFactory.getLog(InterWiki.class); + private static Logger log = LoggerFactory.getLogger(InterWiki.class); private static InterWiki instance; diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/regex/LocaleRegexReplaceFilter.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/regex/LocaleRegexReplaceFilter.java index c350ff0531e4..f1578cd4d166 100755 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/regex/LocaleRegexReplaceFilter.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/regex/LocaleRegexReplaceFilter.java @@ -26,8 +26,8 @@ import java.util.Locale; import java.util.ResourceBundle; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.radeox.api.engine.context.InitialRenderContext; import org.radeox.api.engine.context.RenderContext; @@ -41,7 +41,7 @@ public abstract class LocaleRegexReplaceFilter extends RegexReplaceFilter { - private static Log log = LogFactory.getLog(LocaleRegexReplaceFilter.class); + private static Logger log = LoggerFactory.getLogger(LocaleRegexReplaceFilter.class); protected abstract String getLocaleKey(); @@ -83,4 +83,4 @@ public void setInitialContext(InitialRenderContext context) addRegex(match, print, isSingleLine() ? RegexReplaceFilter.SINGLELINE : RegexReplaceFilter.MULTILINE); } -} \ No newline at end of file +} diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/regex/LocaleRegexTokenFilter.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/regex/LocaleRegexTokenFilter.java index b7d3f45590a5..818f243a2c19 100755 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/regex/LocaleRegexTokenFilter.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/regex/LocaleRegexTokenFilter.java @@ -26,8 +26,8 @@ import java.util.Locale; import java.util.ResourceBundle; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.radeox.api.engine.context.InitialRenderContext; import org.radeox.api.engine.context.RenderContext; @@ -41,7 +41,7 @@ public abstract class LocaleRegexTokenFilter extends RegexTokenFilter { - private static Log log = LogFactory.getLog(LocaleRegexTokenFilter.class); + private static Logger log = LoggerFactory.getLogger(LocaleRegexTokenFilter.class); protected ResourceBundle inputMessages; diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/regex/RegexFilter.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/regex/RegexFilter.java index 6c908da96f42..90038c710298 100755 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/regex/RegexFilter.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/regex/RegexFilter.java @@ -26,8 +26,8 @@ import java.util.ArrayList; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.radeox.filter.FilterSupport; import org.radeox.filter.context.FilterContext; @@ -40,7 +40,7 @@ public abstract class RegexFilter extends FilterSupport { - private static Log log = LogFactory.getLog(RegexFilter.class); + private static Logger log = LoggerFactory.getLogger(RegexFilter.class); protected List pattern = new ArrayList(); diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/regex/RegexReplaceFilter.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/regex/RegexReplaceFilter.java index 7befb0d26ae3..93deedbb5b62 100755 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/regex/RegexReplaceFilter.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/regex/RegexReplaceFilter.java @@ -23,8 +23,8 @@ package org.radeox.filter.regex; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.radeox.filter.context.FilterContext; import org.radeox.regex.Matcher; import org.radeox.regex.Pattern; @@ -40,7 +40,7 @@ public class RegexReplaceFilter extends RegexFilter { - private static Log log = LogFactory.getLog(RegexReplaceFilter.class); + private static Logger log = LoggerFactory.getLogger(RegexReplaceFilter.class); public RegexReplaceFilter() { @@ -91,4 +91,4 @@ public String filter(String input, FilterContext context) } return result; } -} \ No newline at end of file +} diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/regex/RegexTokenFilter.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/regex/RegexTokenFilter.java index c4d7f59d118c..176051bb80b2 100755 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/regex/RegexTokenFilter.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/filter/regex/RegexTokenFilter.java @@ -23,8 +23,8 @@ package org.radeox.filter.regex; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.radeox.filter.context.FilterContext; import org.radeox.regex.MatchResult; import org.radeox.regex.Matcher; @@ -42,7 +42,7 @@ public abstract class RegexTokenFilter extends RegexFilter { - private static Log log = LogFactory.getLog(RegexTokenFilter.class); + private static Logger log = LoggerFactory.getLogger(RegexTokenFilter.class); public RegexTokenFilter() { diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/ApiDocMacro.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/ApiDocMacro.java index d86f0766ea75..37fda5307648 100755 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/ApiDocMacro.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/ApiDocMacro.java @@ -26,8 +26,8 @@ import java.io.IOException; import java.io.Writer; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.radeox.api.macro.MacroParameter; import org.radeox.macro.api.ApiDoc; @@ -40,7 +40,7 @@ public class ApiDocMacro extends BaseLocaleMacro { - private static Log log = LogFactory.getLog(ApiDocMacro.class); + private static Logger log = LoggerFactory.getLogger(ApiDocMacro.class); private String[] paramDescription = {}; diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/AsinMacro.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/AsinMacro.java index 9ee2ad487d96..4d2740e58ac5 100755 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/AsinMacro.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/AsinMacro.java @@ -26,8 +26,8 @@ import java.io.IOException; import java.io.Writer; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.radeox.Messages; import org.radeox.api.macro.MacroParameter; import org.radeox.macro.book.AsinServices; @@ -43,7 +43,7 @@ public class AsinMacro extends BaseLocaleMacro { - private static Log log = LogFactory.getLog(AsinMacro.class); + private static Logger log = LoggerFactory.getLogger(AsinMacro.class); private String[] paramDescription = { Messages.getString("AsinMacro.0") }; //$NON-NLS-1$ diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/BaseLocaleMacro.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/BaseLocaleMacro.java index 2ac3f7dbc3bc..129aa1b34072 100755 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/BaseLocaleMacro.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/BaseLocaleMacro.java @@ -26,8 +26,8 @@ import java.util.Locale; import java.util.ResourceBundle; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.radeox.api.engine.context.InitialRenderContext; import org.radeox.api.engine.context.RenderContext; @@ -41,7 +41,7 @@ public abstract class BaseLocaleMacro extends BaseMacro implements LocaleMacro { - private static Log log = LogFactory.getLog(BaseLocaleMacro.class); + private static Logger log = LoggerFactory.getLogger(BaseLocaleMacro.class); private String name; @@ -78,4 +78,4 @@ public void setInitialContext(InitialRenderContext context) + " for " + getLocaleKey()); } } -} \ No newline at end of file +} diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/CodeMacro.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/CodeMacro.java index 361803d4d0dc..9ce70475e15e 100755 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/CodeMacro.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/CodeMacro.java @@ -31,8 +31,8 @@ import java.util.Map; import java.util.ResourceBundle; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.radeox.Messages; import org.radeox.api.engine.context.InitialRenderContext; import org.radeox.api.engine.context.RenderContext; @@ -53,7 +53,7 @@ public class CodeMacro extends LocalePreserved { - private static Log log = LogFactory.getLog(CodeMacro.class); + private static Logger log = LoggerFactory.getLogger(CodeMacro.class); private Map formatters; diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/FilePathMacro.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/FilePathMacro.java index 501f9f2851f9..7131ab548793 100755 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/FilePathMacro.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/FilePathMacro.java @@ -26,8 +26,8 @@ import java.io.IOException; import java.io.Writer; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.radeox.Messages; import org.radeox.api.macro.MacroParameter; @@ -43,7 +43,7 @@ public class FilePathMacro extends LocalePreserved { - private static Log log = LogFactory.getLog(FilePathMacro.class); + private static Logger log = LoggerFactory.getLogger(FilePathMacro.class); private String[] paramDescription = { Messages.getString("FilePathMacro.0") }; //$NON-NLS-1$ diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/LocalePreserved.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/LocalePreserved.java index 09eac475c3d7..a17f38638df1 100755 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/LocalePreserved.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/LocalePreserved.java @@ -3,8 +3,8 @@ import java.util.Locale; import java.util.ResourceBundle; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.radeox.api.engine.context.InitialRenderContext; import org.radeox.api.engine.context.RenderContext; @@ -33,7 +33,7 @@ public abstract class LocalePreserved extends Preserved implements LocaleMacro { - private static Log log = LogFactory.getLog(LocalePreserved.class); + private static Logger log = LoggerFactory.getLogger(LocalePreserved.class); private String name; diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/MacroLoader.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/MacroLoader.java index 7078eacbd79d..81aa77916207 100755 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/MacroLoader.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/MacroLoader.java @@ -23,8 +23,8 @@ package org.radeox.macro; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Plugin loader for macros @@ -35,7 +35,7 @@ public class MacroLoader extends PluginLoader { - private static Log log = LogFactory.getLog(MacroLoader.class); + private static Logger log = LoggerFactory.getLogger(MacroLoader.class); public Class getLoadClass() { diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/MacroRepository.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/MacroRepository.java index c48ba3da6e58..093317c0d3b7 100755 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/MacroRepository.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/MacroRepository.java @@ -29,8 +29,8 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.radeox.api.engine.context.InitialRenderContext; import org.radeox.api.macro.Macro; @@ -44,7 +44,7 @@ public class MacroRepository extends PluginRepository { - private static Log log = LogFactory.getLog(MacroRepository.class); + private static Logger log = LoggerFactory.getLogger(MacroRepository.class); private InitialRenderContext context; diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/MailToMacro.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/MailToMacro.java index 7636aa6e478d..bb5133105009 100755 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/MailToMacro.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/MailToMacro.java @@ -26,8 +26,8 @@ import java.io.IOException; import java.io.Writer; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.radeox.Messages; import org.radeox.api.macro.MacroParameter; @@ -39,7 +39,7 @@ public class MailToMacro extends LocalePreserved { - private static Log log = LogFactory.getLog(MailToMacro.class); + private static Logger log = LoggerFactory.getLogger(MailToMacro.class); private String[] paramDescription = { Messages.getString("MailToMacro.0") }; //$NON-NLS-1$ diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/PluginLoader.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/PluginLoader.java index 7e6bdc5a6f4d..b0215f6c2b5a 100755 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/PluginLoader.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/PluginLoader.java @@ -25,8 +25,8 @@ import java.util.Iterator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.radeox.util.Service; /** @@ -38,7 +38,7 @@ public abstract class PluginLoader { - private static Log log = LogFactory.getLog(PluginLoader.class); + private static Logger log = LoggerFactory.getLogger(PluginLoader.class); protected Repository repository; diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/QuoteMacro.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/QuoteMacro.java index d7e29ffbdd8e..02540187b7ae 100755 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/QuoteMacro.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/QuoteMacro.java @@ -26,8 +26,8 @@ import java.io.IOException; import java.io.Writer; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.radeox.Messages; import org.radeox.api.macro.MacroParameter; @@ -40,7 +40,7 @@ public class QuoteMacro extends LocalePreserved { - private static Log log = LogFactory.getLog(QuoteMacro.class); + private static Logger log = LoggerFactory.getLogger(QuoteMacro.class); private String[] paramDescription = { Messages.getString("QuoteMacro.0"), //$NON-NLS-1$ Messages.getString("QuoteMacro.1") }; //$NON-NLS-1$ diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/api/ApiDoc.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/api/ApiDoc.java index b18e1846d99b..8589f1534094 100755 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/api/ApiDoc.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/api/ApiDoc.java @@ -33,8 +33,8 @@ import java.util.Map; import java.util.StringTokenizer; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.radeox.Messages; /** @@ -47,7 +47,7 @@ public class ApiDoc { - private static Log log = LogFactory.getLog(ApiDoc.class); + private static Logger log = LoggerFactory.getLogger(ApiDoc.class); private static ApiDoc instance; diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/book/TextFileUrlMapper.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/book/TextFileUrlMapper.java index 0a1a63a83d59..7d0e270ffbdb 100755 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/book/TextFileUrlMapper.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/book/TextFileUrlMapper.java @@ -32,8 +32,8 @@ import java.util.Iterator; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.radeox.Messages; import org.radeox.util.Encoder; @@ -47,7 +47,7 @@ public abstract class TextFileUrlMapper implements UrlMapper { - private static Log log = LogFactory.getLog(TextFileUrlMapper.class); + private static Logger log = LoggerFactory.getLogger(TextFileUrlMapper.class); private Map services; diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/table/AvgFunction.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/table/AvgFunction.java index f8138720836e..8609cf07fa08 100755 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/table/AvgFunction.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/table/AvgFunction.java @@ -23,8 +23,8 @@ package org.radeox.macro.table; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * A function that calculates the average table cells @@ -35,7 +35,7 @@ public class AvgFunction implements Function { - private static Log log = LogFactory.getLog(AvgFunction.class); + private static Logger log = LoggerFactory.getLogger(AvgFunction.class); public String getName() { diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/table/FunctionLoader.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/table/FunctionLoader.java index 78ae2e5b6040..1fa8e879350a 100755 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/table/FunctionLoader.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/table/FunctionLoader.java @@ -23,8 +23,8 @@ package org.radeox.macro.table; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.radeox.macro.PluginLoader; import org.radeox.macro.Repository; @@ -38,7 +38,7 @@ public class FunctionLoader extends PluginLoader { - private static Log log = LogFactory.getLog(FunctionLoader.class); + private static Logger log = LoggerFactory.getLogger(FunctionLoader.class); protected static FunctionLoader instance; diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/table/MaxFunction.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/table/MaxFunction.java index 5aecc813c3c4..26ed5f879f65 100755 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/table/MaxFunction.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/table/MaxFunction.java @@ -23,8 +23,8 @@ package org.radeox.macro.table; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * A function that finds the max of table cells @@ -35,7 +35,7 @@ public class MaxFunction implements Function { - private static Log log = LogFactory.getLog(MaxFunction.class); + private static Logger log = LoggerFactory.getLogger(MaxFunction.class); public String getName() { diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/table/MinFunction.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/table/MinFunction.java index 15ff23e33922..92f0ff12424b 100755 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/table/MinFunction.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/table/MinFunction.java @@ -23,8 +23,8 @@ package org.radeox.macro.table; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * A function that finds the max of table cells @@ -35,7 +35,7 @@ public class MinFunction implements Function { - private static Log log = LogFactory.getLog(MinFunction.class); + private static Logger log = LoggerFactory.getLogger(MinFunction.class); public String getName() { diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/table/SumFunction.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/table/SumFunction.java index a7d4a4371726..fd87a6011d12 100755 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/table/SumFunction.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/table/SumFunction.java @@ -23,8 +23,8 @@ package org.radeox.macro.table; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * A function that summerizes table cells @@ -35,7 +35,7 @@ public class SumFunction implements Function { - private static Log log = LogFactory.getLog(SumFunction.class); + private static Logger log = LoggerFactory.getLogger(SumFunction.class); public String getName() { diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/xref/XrefMapper.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/xref/XrefMapper.java index 9ea62f750fc7..ceac743c985f 100755 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/xref/XrefMapper.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/macro/xref/XrefMapper.java @@ -33,8 +33,8 @@ import java.util.Map; import java.util.StringTokenizer; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Stores information and links to xref Java source code e.g. @@ -46,7 +46,7 @@ public class XrefMapper { - private static Log log = LogFactory.getLog(XrefMapper.class); + private static Logger log = LoggerFactory.getLogger(XrefMapper.class); private final static String FILENAME = "conf/xref.txt"; diff --git a/rwiki/rwiki-util/radeox/src/java/org/radeox/test/filter/balance/BalanceTest.java b/rwiki/rwiki-util/radeox/src/java/org/radeox/test/filter/balance/BalanceTest.java index 113dba4a8948..34c8f0b3632d 100644 --- a/rwiki/rwiki-util/radeox/src/java/org/radeox/test/filter/balance/BalanceTest.java +++ b/rwiki/rwiki-util/radeox/src/java/org/radeox/test/filter/balance/BalanceTest.java @@ -28,8 +28,8 @@ import junit.framework.TestCase; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.radeox.filter.balance.Balancer; /** @@ -40,7 +40,7 @@ public class BalanceTest extends TestCase public static final String matcherString = "(<([^ />]+)(?: [^>]*?[^/])?>)|(]+)>)"; - private static final Log log = LogFactory.getLog(BalanceTest.class); + private static final Logger log = LoggerFactory.getLogger(BalanceTest.class); /** * @param arg0 diff --git a/rwiki/rwiki-util/util/src/java/uk/ac/cam/caret/sakai/rwiki/utils/NameHelper.java b/rwiki/rwiki-util/util/src/java/uk/ac/cam/caret/sakai/rwiki/utils/NameHelper.java index e93f537a250a..e93cc2a43f9f 100644 --- a/rwiki/rwiki-util/util/src/java/uk/ac/cam/caret/sakai/rwiki/utils/NameHelper.java +++ b/rwiki/rwiki-util/util/src/java/uk/ac/cam/caret/sakai/rwiki/utils/NameHelper.java @@ -24,8 +24,8 @@ import java.nio.CharBuffer; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.alias.api.AliasEdit; import org.sakaiproject.alias.api.AliasService; import org.sakaiproject.component.cover.ComponentManager; @@ -39,7 +39,7 @@ public class NameHelper public static final char SPACE_SEPARATOR = '/'; - private static final Log log = LogFactory.getLog(NameHelper.class); + private static final Logger log = LoggerFactory.getLogger(NameHelper.class); public static final String DEFAULT_PAGE = "home"; diff --git a/rwiki/rwiki-util/util/src/java/uk/ac/cam/caret/sakai/rwiki/utils/SimpleCoverage.java b/rwiki/rwiki-util/util/src/java/uk/ac/cam/caret/sakai/rwiki/utils/SimpleCoverage.java index 5e3da9015c25..2a304d30ab23 100644 --- a/rwiki/rwiki-util/util/src/java/uk/ac/cam/caret/sakai/rwiki/utils/SimpleCoverage.java +++ b/rwiki/rwiki-util/util/src/java/uk/ac/cam/caret/sakai/rwiki/utils/SimpleCoverage.java @@ -21,8 +21,8 @@ package uk.ac.cam.caret.sakai.rwiki.utils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * A really simple coverage utility, prints a record of the calling method @@ -31,7 +31,7 @@ */ public class SimpleCoverage { - private static Log logger = LogFactory.getLog(SimpleCoverage.class); + private static Logger logger = LoggerFactory.getLogger(SimpleCoverage.class); private static long last = System.currentTimeMillis(); diff --git a/rwiki/rwiki-util/util/src/java/uk/ac/cam/caret/sakai/rwiki/utils/TimeLogger.java b/rwiki/rwiki-util/util/src/java/uk/ac/cam/caret/sakai/rwiki/utils/TimeLogger.java index 30e34697972b..85b0c993b162 100644 --- a/rwiki/rwiki-util/util/src/java/uk/ac/cam/caret/sakai/rwiki/utils/TimeLogger.java +++ b/rwiki/rwiki-util/util/src/java/uk/ac/cam/caret/sakai/rwiki/utils/TimeLogger.java @@ -21,15 +21,15 @@ package uk.ac.cam.caret.sakai.rwiki.utils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @author ieb */ public class TimeLogger { - private static Log log = LogFactory.getLog(TimeLogger.class); + private static Logger log = LoggerFactory.getLogger(TimeLogger.class); private TimeLogger() { diff --git a/samigo/samigo-api/src/java/org/sakaiproject/tool/assessment/data/dao/grading/ItemGradingData.java b/samigo/samigo-api/src/java/org/sakaiproject/tool/assessment/data/dao/grading/ItemGradingData.java index 5073d1049dd0..94d2a8263af8 100644 --- a/samigo/samigo-api/src/java/org/sakaiproject/tool/assessment/data/dao/grading/ItemGradingData.java +++ b/samigo/samigo-api/src/java/org/sakaiproject/tool/assessment/data/dao/grading/ItemGradingData.java @@ -30,8 +30,8 @@ import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * A response to a specific question and its associated data @@ -40,7 +40,7 @@ */ public class ItemGradingData implements java.io.Serializable { - private static Log log = LogFactory.getLog(ItemGradingData.class); + private static Logger log = LoggerFactory.getLogger(ItemGradingData.class); private static final long serialVersionUID = 7526471155622776147L; private Long itemGradingId; private Long assessmentGradingId; diff --git a/samigo/samigo-app/src/java/com/corejsf/UploadFilter.java b/samigo/samigo-app/src/java/com/corejsf/UploadFilter.java index d126c33f9e09..98c5cb554941 100644 --- a/samigo/samigo-app/src/java/com/corejsf/UploadFilter.java +++ b/samigo/samigo-app/src/java/com/corejsf/UploadFilter.java @@ -42,12 +42,12 @@ import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileUpload; import org.apache.commons.fileupload.FileUploadException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; public class UploadFilter implements Filter { - private static Log log = LogFactory.getLog(UploadFilter.class); + private static Logger log = LoggerFactory.getLogger(UploadFilter.class); private int sizeThreshold = -1; private long sizeMax = -1; diff --git a/samigo/samigo-app/src/java/com/corejsf/UploadRenderer.java b/samigo/samigo-app/src/java/com/corejsf/UploadRenderer.java index 5ec0dadc200c..7f15f1db89f2 100644 --- a/samigo/samigo-app/src/java/com/corejsf/UploadRenderer.java +++ b/samigo/samigo-app/src/java/com/corejsf/UploadRenderer.java @@ -39,12 +39,12 @@ import javax.servlet.http.HttpServletRequest; import org.apache.commons.fileupload.FileItem; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class UploadRenderer extends Renderer { - private static Log log = LogFactory.getLog(UploadRenderer.class); + private static Logger log = LoggerFactory.getLogger(UploadRenderer.class); private static final String UPLOAD = ".upload"; public UploadRenderer() { diff --git a/samigo/samigo-app/src/java/org/sakaiproject/jsf/renderer/RichTextEditArea.java b/samigo/samigo-app/src/java/org/sakaiproject/jsf/renderer/RichTextEditArea.java index 52a254ac473e..fc6905d4c42b 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/jsf/renderer/RichTextEditArea.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/jsf/renderer/RichTextEditArea.java @@ -32,8 +32,8 @@ import javax.faces.context.ResponseWriter; import javax.faces.render.Renderer; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.tool.assessment.services.assessment.AssessmentService; @@ -57,7 +57,7 @@ */ public class RichTextEditArea extends Renderer { - private static Log log = LogFactory.getLog(RichTextEditArea.class); + private static Logger log = LoggerFactory.getLogger(RichTextEditArea.class); String editor = ServerConfigurationService.getString("wysiwyg.editor"); diff --git a/samigo/samigo-app/src/java/org/sakaiproject/jsf/util/SamigoJsfTool.java b/samigo/samigo-app/src/java/org/sakaiproject/jsf/util/SamigoJsfTool.java index 90270a2a1e82..0eea85a3dd50 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/jsf/util/SamigoJsfTool.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/jsf/util/SamigoJsfTool.java @@ -30,8 +30,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.api.ActiveTool; import org.sakaiproject.tool.api.Tool; import org.sakaiproject.tool.api.ToolException; @@ -71,7 +71,7 @@ public class SamigoJsfTool extends JsfTool { private static final String HELPER_SESSION_PREFIX = "session."; private static final String HELPER_RETURN_NOTIFICATION = "/returnToCaller"; private static final String RESET_ASSESSMENT_BEAN = "/resetAssessmentBean"; - private static Log log = LogFactory.getLog(SamigoJsfTool.class); + private static Logger log = LoggerFactory.getLogger(SamigoJsfTool.class); /** * Recognize a path that is a resource request. It must have an "extension", i.e. a dot followed by characters that do not include a slash. diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/api/SamigoApiFactory.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/api/SamigoApiFactory.java index 1614bd86f04f..63ba4a9c8fa9 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/api/SamigoApiFactory.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/api/SamigoApiFactory.java @@ -22,8 +22,8 @@ package org.sakaiproject.tool.assessment.api; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.api.spring.FactoryUtil; @@ -49,7 +49,7 @@ */ public abstract class SamigoApiFactory { - private static Log log = LogFactory.getLog(SamigoApiFactory.class); + private static Logger log = LoggerFactory.getLogger(SamigoApiFactory.class); private static SamigoApiFactory instance = null; /** diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/api/spring/FactoryUtil.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/api/spring/FactoryUtil.java index dd907ed08986..1ca57bbbb68c 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/api/spring/FactoryUtil.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/api/spring/FactoryUtil.java @@ -24,8 +24,8 @@ import java.io.File; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.xml.XmlBeanFactory; import org.springframework.core.io.ClassPathResource; @@ -37,7 +37,7 @@ public class FactoryUtil { - private static Log log = LogFactory.getLog(FactoryUtil.class); + private static Logger log = LoggerFactory.getLogger(FactoryUtil.class); private static boolean useLocator = false; // private static boolean useLocator = true; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/api/spring/SamigoApi.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/api/spring/SamigoApi.java index a69893901487..c40333833d1a 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/api/spring/SamigoApi.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/api/spring/SamigoApi.java @@ -34,8 +34,8 @@ import org.sakaiproject.tool.assessment.shared.api.grading.GradingServiceAPI; import org.sakaiproject.tool.assessment.shared.api.qti.QTIServiceAPI; import org.sakaiproject.tool.assessment.shared.api.questionpool.QuestionPoolServiceAPI; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -47,7 +47,7 @@ */ public class SamigoApi extends SamigoApiFactory { - private static Log log = LogFactory.getLog(SamigoApi.class); + private static Logger log = LoggerFactory.getLogger(SamigoApi.class); private AssessmentServiceAPI assessmentServiceAPI; private GradebookServiceAPI gradebookServiceAPI; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/business/questionpool/QuestionPoolTreeImpl.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/business/questionpool/QuestionPoolTreeImpl.java index f486a33edf31..eb487b697778 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/business/questionpool/QuestionPoolTreeImpl.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/business/questionpool/QuestionPoolTreeImpl.java @@ -30,8 +30,8 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.osid.shared.SharedException; import org.sakaiproject.tool.assessment.data.dao.questionpool.QuestionPoolData; @@ -61,7 +61,7 @@ public class QuestionPoolTreeImpl private static final long serialVersionUID = 2173986944623441011L; -private static Log log = LogFactory.getLog(QuestionPoolTreeImpl.class); +private static Logger log = LoggerFactory.getLogger(QuestionPoolTreeImpl.class); private HashMap poolMap; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/jsf/renderer/PagerRenderer.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/jsf/renderer/PagerRenderer.java index b32ccbfac5d1..b47a08e37556 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/jsf/renderer/PagerRenderer.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/jsf/renderer/PagerRenderer.java @@ -36,8 +36,8 @@ import javax.faces.el.ValueBinding; import javax.faces.render.Renderer; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** @@ -58,7 +58,7 @@ public class PagerRenderer extends Renderer { - private static Log log = LogFactory.getLog(PagerRenderer.class); + private static Logger log = LoggerFactory.getLogger(PagerRenderer.class); public void encodeBegin(FacesContext context, UIComponent component) throws IOException diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/rsf/producers/BeginAssessmentProducer.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/rsf/producers/BeginAssessmentProducer.java index f818bad9e53e..28a254a74f5d 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/rsf/producers/BeginAssessmentProducer.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/rsf/producers/BeginAssessmentProducer.java @@ -31,8 +31,8 @@ import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.dao.authz.AuthorizationData; import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentMetaDataIfc; import org.sakaiproject.tool.assessment.facade.AgentFacade; @@ -81,7 +81,7 @@ public class BeginAssessmentProducer implements ViewComponentProducer, public HttpServletResponse httpServletResponse; public MessageLocator messageLocator; - private static Log log = LogFactory.getLog(BeginAssessmentProducer.class); + private static Logger log = LoggerFactory.getLogger(BeginAssessmentProducer.class); public static final String VIEW_ID = "BeginTakingAssessment"; public String getViewID() { diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/shared/impl/qti/QTIServiceImpl.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/shared/impl/qti/QTIServiceImpl.java index 9225ac651e95..7796ca2d3b34 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/shared/impl/qti/QTIServiceImpl.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/shared/impl/qti/QTIServiceImpl.java @@ -21,8 +21,8 @@ package org.sakaiproject.tool.assessment.shared.impl.qti; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentIfc; @@ -39,7 +39,7 @@ */ public class QTIServiceImpl implements QTIServiceAPI { - private static Log log = LogFactory.getLog(QTIServiceImpl.class); + private static Logger log = LoggerFactory.getLogger(QTIServiceImpl.class); /** * Import an assessment XML document in QTI format, extract & persist the data. diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/AnswerBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/AnswerBean.java index 52f54103e856..6ea7cacbb09e 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/AnswerBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/AnswerBean.java @@ -32,8 +32,8 @@ import java.util.Set; import org.apache.commons.lang.ArrayUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.util.ResourceLoader; import org.sakaiproject.content.api.ContentResource; @@ -84,7 +84,7 @@ public class AnswerBean implements Serializable, Comparable{ //for navigation private String outcome; - private static Log log = LogFactory.getLog(AnswerBean.class); + private static Logger log = LoggerFactory.getLogger(AnswerBean.class); private String partialCredit = "0"; //to incorporate partial credit private static ResourceLoader rb = new ResourceLoader("org.sakaiproject.tool.assessment.bundle.AuthorMessages"); diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/AssessmentBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/AssessmentBean.java index 490666c07076..a389ebdbaf94 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/AssessmentBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/AssessmentBean.java @@ -30,8 +30,8 @@ import javax.faces.model.SelectItem; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentIfc; import org.sakaiproject.tool.assessment.data.ifc.assessment.SectionDataIfc; @@ -55,7 +55,7 @@ * Used to be org.navigoproject.ui.web.asi.author.assessment.AssessmentActionForm.java */ public class AssessmentBean implements Serializable { - private static Log log = LogFactory.getLog(AssessmentBean.class); + private static Logger log = LoggerFactory.getLogger(AssessmentBean.class); /** Use serialVersionUID for interoperability. */ private final static long serialVersionUID = -630950053380808339L; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/AssessmentSettingsBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/AssessmentSettingsBean.java index 13a68fbbec6c..bbc10cd61580 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/AssessmentSettingsBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/AssessmentSettingsBean.java @@ -40,8 +40,8 @@ import javax.faces.context.FacesContext; import javax.faces.model.SelectItem; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.content.api.ContentResource; import org.sakaiproject.content.api.FilePickerHelper; import org.sakaiproject.entity.api.Reference; @@ -94,7 +94,7 @@ */ public class AssessmentSettingsBean implements Serializable { - private static final Log log = LogFactory.getLog(AssessmentSettingsBean.class); + private static final Logger log = LoggerFactory.getLogger(AssessmentSettingsBean.class); private static final IntegrationContextFactory integrationContextFactory = IntegrationContextFactory.getInstance(); @@ -441,7 +441,7 @@ else if ( ! secureDeliveryService.isSecureDeliveryModuleAvailable( secureDeliver } } catch (RuntimeException ex) { - log.error( ex ); + log.error(ex.getMessage(), ex); } } diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/AuthorBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/AuthorBean.java index 4b988724e0dc..b6d0d6210431 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/AuthorBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/AuthorBean.java @@ -32,8 +32,8 @@ import javax.faces.model.SelectItem; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.facade.AssessmentFacade; import org.sakaiproject.tool.assessment.facade.AssessmentTemplateFacade; import org.sakaiproject.tool.assessment.facade.PublishedAssessmentFacade; @@ -50,7 +50,7 @@ */ public class AuthorBean implements Serializable { - private static Log log = LogFactory.getLog(AuthorBean.class); + private static Logger log = LoggerFactory.getLogger(AuthorBean.class); /** Use serialVersionUID for interoperability. */ private final static long serialVersionUID = 4216587136245498157L; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/EventLogBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/EventLogBean.java index ba7a208d669f..009a232a8bd5 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/EventLogBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/EventLogBean.java @@ -7,15 +7,15 @@ import javax.faces.model.SelectItem; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.dao.assessment.EventLogData; public class EventLogBean implements Serializable { private static final long serialVersionUID = 1L; - private static Log log = LogFactory.getLog(EventLogBean.class); + private static Logger log = LoggerFactory.getLogger(EventLogBean.class); private String siteId; private Map pageDataMap; @@ -127,4 +127,4 @@ public void setAssessments(List assessments) { this.assessments = assessments; } -} \ No newline at end of file +} diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/IndexBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/IndexBean.java index 25afaa17695a..1470e63449ba 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/IndexBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/IndexBean.java @@ -29,8 +29,8 @@ import java.util.Iterator; import javax.faces.context.FacesContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.facade.AssessmentTemplateFacade; import org.sakaiproject.tool.assessment.services.assessment.AssessmentService; @@ -59,7 +59,7 @@ public class IndexBean implements Serializable private boolean templateAscending= true; private boolean automaticSubmissionEnabled = false; - private static Log log = LogFactory.getLog(IndexBean.class); + private static Logger log = LoggerFactory.getLogger(IndexBean.class); /** * Creates a new IndexBean object. diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/ItemAuthorBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/ItemAuthorBean.java index 88f58370cfe2..464517fed226 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/ItemAuthorBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/ItemAuthorBean.java @@ -49,8 +49,8 @@ import javax.faces.model.SelectItem; import javax.servlet.ServletContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.authz.api.SecurityAdvisor; @@ -105,7 +105,7 @@ public class ItemAuthorBean implements Serializable { - private static Log log = LogFactory.getLog(ItemAuthorBean.class); + private static Logger log = LoggerFactory.getLogger(ItemAuthorBean.class); /** Use serialVersionUID for interoperability. */ private final static long serialVersionUID = 8266438770394956874L; @@ -1441,7 +1441,7 @@ public SecurityAdvice isAllowed(String userId, String function, String reference AssessmentService.getContentHostingService().addResource(collectionId+fullname, mimeType, mediaByte, resourceProperties, NotificationService.NOTI_NONE); }catch(Exception e) { - log.warn(e); + log.warn(e.getMessage(), e); } finally { SecurityService.popAdvisor(); diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/ItemBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/ItemBean.java index a5223f953016..c11988de9d48 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/ItemBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/ItemBean.java @@ -58,7 +58,7 @@ public class ItemBean implements Serializable { - //private static Log log = LogFactory.getLog(ItemBean.class); + //private static Logger log = LoggerFactory.getLogger(ItemBean.class); // internal use private static final String answerNumbers = diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/PublishRepublishNotificationBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/PublishRepublishNotificationBean.java index 1486fd10138e..f60ee0f7f12b 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/PublishRepublishNotificationBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/PublishRepublishNotificationBean.java @@ -5,12 +5,12 @@ import javax.faces.model.SelectItem; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.util.ResourceLoader; public class PublishRepublishNotificationBean implements Serializable { - private static Log log = LogFactory.getLog(PublishRepublishNotificationBean.class); + private static Logger log = LoggerFactory.getLogger(PublishRepublishNotificationBean.class); public PublishRepublishNotificationBean() { } diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/PublishedAssessmentBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/PublishedAssessmentBean.java index 2c76b843ac0e..03be3333cf03 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/PublishedAssessmentBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/PublishedAssessmentBean.java @@ -26,8 +26,8 @@ import java.io.Serializable; import java.util.ArrayList; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @author rshastri @@ -39,7 +39,7 @@ */ public class PublishedAssessmentBean implements Serializable { - private static Log log = LogFactory.getLog(PublishedAssessmentBean.class); + private static Logger log = LoggerFactory.getLogger(PublishedAssessmentBean.class); /** Use serialVersionUID for interoperability. */ private final static long serialVersionUID = 206375673822116682L; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/PublishedAssessmentBeanie.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/PublishedAssessmentBeanie.java index 004134ce029e..42f52f40a790 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/PublishedAssessmentBeanie.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/PublishedAssessmentBeanie.java @@ -34,8 +34,8 @@ import org.sakaiproject.tool.assessment.services.shared.TypeService; import org.sakaiproject.tool.assessment.ui.bean.delivery.ItemContentsBean; import org.sakaiproject.tool.assessment.ui.bean.delivery.SectionContentsBean; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** *

Description: Backing bean for Published Assessment

@@ -44,7 +44,7 @@ */ public class PublishedAssessmentBeanie implements Serializable { - private static Log log = LogFactory.getLog(PublishedAssessmentBeanie.class); + private static Logger log = LoggerFactory.getLogger(PublishedAssessmentBeanie.class); /** Use serialVersionUID for interoperability. */ private final static long serialVersionUID = -630950053380808339L; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/PublishedAssessmentSettingsBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/PublishedAssessmentSettingsBean.java index bfe15ec6cc31..5afa56a25f00 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/PublishedAssessmentSettingsBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/PublishedAssessmentSettingsBean.java @@ -39,8 +39,8 @@ import javax.faces.context.FacesContext; import javax.faces.model.SelectItem; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.exception.IdUnusedException; import org.sakaiproject.site.api.Group; import org.sakaiproject.site.api.Site; @@ -86,7 +86,7 @@ public class PublishedAssessmentSettingsBean implements Serializable { - private static final Log log = LogFactory.getLog(PublishedAssessmentSettingsBean.class); + private static final Logger log = LoggerFactory.getLogger(PublishedAssessmentSettingsBean.class); private static final IntegrationContextFactory integrationContextFactory = IntegrationContextFactory.getInstance(); diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/SectionActivityBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/SectionActivityBean.java index 4c53a3534b66..fdee95f11785 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/SectionActivityBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/SectionActivityBean.java @@ -3,15 +3,15 @@ import java.io.Serializable; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.user.cover.UserDirectoryService; public class SectionActivityBean implements Serializable { private static final long serialVersionUID = 1L; - private static Log log = LogFactory.getLog(SectionActivityBean.class); + private static Logger log = LoggerFactory.getLogger(SectionActivityBean.class); private List displayNamesList; private String selectedUser; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/SectionBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/SectionBean.java index 649311f891d4..7f5d9c5e0fb2 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/SectionBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/SectionBean.java @@ -38,8 +38,8 @@ import javax.faces.event.ValueChangeEvent; import javax.faces.model.SelectItem; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.content.api.ContentResource; import org.sakaiproject.content.api.FilePickerHelper; import org.sakaiproject.entity.api.Reference; @@ -65,7 +65,7 @@ public class SectionBean implements Serializable { - private static Log log = LogFactory.getLog(SectionBean.class); + private static Logger log = LoggerFactory.getLogger(SectionBean.class); /** Use serialVersionUID for interoperability. */ private final static long serialVersionUID = 4216587136245498157L; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/authz/AuthorizationBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/authz/AuthorizationBean.java index 5d61c07c5dcf..7c5ba2d5def6 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/authz/AuthorizationBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/authz/AuthorizationBean.java @@ -36,8 +36,8 @@ import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class AuthorizationBean implements Serializable { /** @@ -45,7 +45,7 @@ public class AuthorizationBean implements Serializable { */ private static final long serialVersionUID = -2782949557257727817L; -private static Log log = LogFactory.getLog(AuthorizationBean.class); +private static Logger log = LoggerFactory.getLogger(AuthorizationBean.class); private HashMap map = new HashMap(); private boolean adminPrivilege = false; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/delivery/DeliveryBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/delivery/DeliveryBean.java index 11d763fb432b..91cc58f26e22 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/delivery/DeliveryBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/delivery/DeliveryBean.java @@ -38,8 +38,8 @@ import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.event.cover.EventTrackingService; import org.sakaiproject.event.cover.NotificationService; @@ -105,7 +105,7 @@ public class DeliveryBean implements Serializable { - private static final Log log = LogFactory.getLog(DeliveryBean.class); + private static final Logger log = LoggerFactory.getLogger(DeliveryBean.class); //SAM-2517 private ServerConfigurationService serverConfigurationService; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/delivery/DeliveryBeanie.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/delivery/DeliveryBeanie.java index 2ac07134c68c..73936c593f5b 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/delivery/DeliveryBeanie.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/delivery/DeliveryBeanie.java @@ -27,8 +27,8 @@ import java.io.Serializable; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.ui.bean.util.Validator; import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; import org.sakaiproject.tool.assessment.ui.listener.util.TimeUtil; @@ -49,7 +49,7 @@ public class DeliveryBeanie */ private static final long serialVersionUID = 3740101653033385370L; -private static Log log = LogFactory.getLog(DeliveryBeanie.class); +private static Logger log = LoggerFactory.getLogger(DeliveryBeanie.class); private String assessmentId; private String assessmentTitle; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/delivery/ItemContentsBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/delivery/ItemContentsBean.java index 75730ec0e742..734fc7511402 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/delivery/ItemContentsBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/delivery/ItemContentsBean.java @@ -33,8 +33,8 @@ import javax.faces.model.SelectItem; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.math.util.MathUtils; import org.sakaiproject.event.cover.EventTrackingService; import org.sakaiproject.tool.assessment.data.dao.grading.ItemGradingData; @@ -68,7 +68,7 @@ public class ItemContentsBean implements Serializable { */ private static final long serialVersionUID = 6270034338280029897L; - private static Log log = LogFactory.getLog(ItemContentsBean.class); + private static Logger log = LoggerFactory.getLogger(ItemContentsBean.class); private static ResourceLoader rb = new ResourceLoader("org.sakaiproject.tool.assessment.bundle.DeliveryMessages"); diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/delivery/SectionContentsBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/delivery/SectionContentsBean.java index e7eba31097be..61f64a9db4d4 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/delivery/SectionContentsBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/delivery/SectionContentsBean.java @@ -38,8 +38,8 @@ import javax.faces.model.SelectItem; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.math.util.MathUtils; import org.joda.time.DateTime; import org.joda.time.format.DateTimeFormat; @@ -63,7 +63,7 @@ public class SectionContentsBean * */ private static final long serialVersionUID = 5959692528847396966L; - private static Log log = LogFactory.getLog(SectionContentsBean.class); + private static Logger log = LoggerFactory.getLogger(SectionContentsBean.class); private String text; private String nonDefaultText; private java.util.ArrayList itemContents; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/delivery/SelectionBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/delivery/SelectionBean.java index b963a871b364..cc4986be1185 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/delivery/SelectionBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/delivery/SelectionBean.java @@ -26,8 +26,8 @@ import org.sakaiproject.tool.assessment.data.dao.grading.ItemGradingData; import org.sakaiproject.tool.assessment.data.ifc.assessment.AnswerIfc; import org.sakaiproject.tool.assessment.data.ifc.assessment.ItemTextIfc; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * This is the JSF backing bean for delivery, used for TF and MC questions @@ -36,7 +36,7 @@ */ public class SelectionBean { - private static Log log = LogFactory.getLog(SelectionBean.class); + private static Logger log = LoggerFactory.getLogger(SelectionBean.class); private ItemContentsBean parent; @@ -115,4 +115,4 @@ public void setFeedback(String newfb) { public String getAnswerId() { return answer.getId().toString(); } -} \ No newline at end of file +} diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/AgentResults.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/AgentResults.java index 375c833a1da0..3b2870b00c3f 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/AgentResults.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/AgentResults.java @@ -31,8 +31,8 @@ import javax.faces.context.ExternalContext; import javax.faces.context.FacesContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.content.api.FilePickerHelper; import org.sakaiproject.entity.api.Reference; import org.sakaiproject.tool.api.ToolSession; @@ -58,7 +58,7 @@ public class AgentResults * */ private static final long serialVersionUID = 2820488402465439395L; - private static Log log = LogFactory.getLog(AgentResults.class); + private static Logger log = LoggerFactory.getLogger(AgentResults.class); private Long assessmentGradingId; private Long itemGradingId; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/DownloadFileSubmissionsBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/DownloadFileSubmissionsBean.java index 71b64c2d6791..44b6aa38f439 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/DownloadFileSubmissionsBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/DownloadFileSubmissionsBean.java @@ -38,8 +38,8 @@ import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletRequest; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.util.ResourceLoader; import org.sakaiproject.section.api.coursemanagement.CourseSection; @@ -65,7 +65,7 @@ public class DownloadFileSubmissionsBean implements Serializable { public static String ONE_SECTION_GROUP = "one"; public static String SITE = "site"; - private static Log log = LogFactory.getLog(ExportResponsesBean.class); + private static Logger log = LoggerFactory.getLogger(ExportResponsesBean.class); /** * Creates a new TotalScoresBean object. diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/ExportResponsesBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/ExportResponsesBean.java index fff9fd2d2c31..e4818881c375 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/ExportResponsesBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/ExportResponsesBean.java @@ -38,8 +38,8 @@ import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellStyle; @@ -86,7 +86,7 @@ public class ExportResponsesBean implements Serializable, PhaseAware { private String assessmentName; private boolean anonymous; - private static Log log = LogFactory.getLog(ExportResponsesBean.class); + private static Logger log = LoggerFactory.getLogger(ExportResponsesBean.class); /** * Creates a new TotalScoresBean object. @@ -301,12 +301,12 @@ public void writeDataToResponse(List> spreadsheetData, String fileN getAsWorkbook(spreadsheetData).write(out); out.flush(); } catch (IOException e) { - if (log.isErrorEnabled()) log.error(e); + log.error(e.getMessage(), e); } finally { try { if (out != null) out.close(); } catch (IOException e) { - if (log.isErrorEnabled()) log.error(e); + log.error(e.getMessage(), e); } } } diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/HistogramQuestionScoresBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/HistogramQuestionScoresBean.java index 9c5cc2c8820d..1a081e9ed111 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/HistogramQuestionScoresBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/HistogramQuestionScoresBean.java @@ -30,8 +30,8 @@ import java.util.Set; import java.util.TreeSet; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.ui.bean.util.Validator; @@ -103,7 +103,7 @@ public class HistogramQuestionScoresBean private boolean randomType; // this part is a random draw part - private static Log log = LogFactory.getLog(HistogramQuestionScoresBean.class); + private static Logger log = LoggerFactory.getLogger(HistogramQuestionScoresBean.class); private Long subQuestionSequence; private boolean showIndividualAnswersInDetailedStatistics; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/QuestionScoresBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/QuestionScoresBean.java index 4872ecd3358a..d4ae35e7cb36 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/QuestionScoresBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/QuestionScoresBean.java @@ -36,8 +36,8 @@ import javax.faces.event.ActionEvent; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.math.util.MathUtils; import org.sakaiproject.jsf.model.PhaseAware; import org.sakaiproject.tool.assessment.business.entity.RecordingData; @@ -91,7 +91,7 @@ public class QuestionScoresBean private String totalPeople; private String typeId; private HashMap scoresByItem; - private static Log log = LogFactory.getLog(QuestionScoresBean.class); + private static Logger log = LoggerFactory.getLogger(QuestionScoresBean.class); //private String selectedSectionFilterValue = TotalScoresBean.ALL_SECTIONS_SELECT_VALUE; private String selectedSectionFilterValue = null; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/RetakeAssessmentBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/RetakeAssessmentBean.java index b67b2bf1ce3d..cfc0957f9eae 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/RetakeAssessmentBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/RetakeAssessmentBean.java @@ -1,8 +1,8 @@ -/********************************************************************************** - * $URL$ - * $Id$ - *********************************************************************************** - * +/********************************************************************************** + * $URL$ + * $Id$ + *********************************************************************************** + * * Copyright (c) 2004, 2005, 2006, 2007, 2008 The Sakai Foundation * * Licensed under the Educational Community License, Version 2.0 (the "License"); @@ -16,82 +16,82 @@ * 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.sakaiproject.tool.assessment.ui.bean.evaluation; - -import java.io.Serializable; -import java.util.HashMap; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.sakaiproject.tool.assessment.data.dao.grading.StudentGradingSummaryData; - -/** - *

Description: class form for evaluating total scores

- * - */ -public class RetakeAssessmentBean implements Serializable { - - private Long publishedAssessmentId; - private String agentId; - private int numberRetake; - private StudentGradingSummaryData studentGradingSummaryData; - private String studentName; - private HashMap studentGradingSummaryDataMap; - - private static Log log = LogFactory.getLog(TotalScoresBean.class); - - public RetakeAssessmentBean() { - log.debug("Creating a new RetakeAssessmentBean"); - } - - public Long getPublishedAssessmentId() { - return this.publishedAssessmentId; - } - - public void setPublishedAssessmentId(Long publishedAssessmentId) { - this.publishedAssessmentId = publishedAssessmentId; - } - - public String getAgentId() { - return this.agentId; - } - - public void setAgentId(String agentId) { - this.agentId = agentId; - } - - public int getNumberRetake() { - return this.numberRetake; - } - - public void setNumberRetake(int numberRetake) { - this.numberRetake = numberRetake; - } - - public StudentGradingSummaryData getStudentGradingSummaryData() { - return this.studentGradingSummaryData; - } - - public void setStudentGradingSummaryData(StudentGradingSummaryData studentGradingSummaryData) { - this.studentGradingSummaryData = studentGradingSummaryData; - } - - public String getStudentName() { - return this.studentName; - } - - public void setStudentName(String studentName) { - this.studentName = studentName; - } - - public HashMap getStudentGradingSummaryDataMap() { - return this.studentGradingSummaryDataMap; - } - - public void setStudentGradingSummaryDataMap(HashMap studentGradingSummaryDataMap) { - this.studentGradingSummaryDataMap = studentGradingSummaryDataMap; - } -} + * + **********************************************************************************/ + +package org.sakaiproject.tool.assessment.ui.bean.evaluation; + +import java.io.Serializable; +import java.util.HashMap; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sakaiproject.tool.assessment.data.dao.grading.StudentGradingSummaryData; + +/** + *

Description: class form for evaluating total scores

+ * + */ +public class RetakeAssessmentBean implements Serializable { + + private Long publishedAssessmentId; + private String agentId; + private int numberRetake; + private StudentGradingSummaryData studentGradingSummaryData; + private String studentName; + private HashMap studentGradingSummaryDataMap; + + private static Logger log = LoggerFactory.getLogger(TotalScoresBean.class); + + public RetakeAssessmentBean() { + log.debug("Creating a new RetakeAssessmentBean"); + } + + public Long getPublishedAssessmentId() { + return this.publishedAssessmentId; + } + + public void setPublishedAssessmentId(Long publishedAssessmentId) { + this.publishedAssessmentId = publishedAssessmentId; + } + + public String getAgentId() { + return this.agentId; + } + + public void setAgentId(String agentId) { + this.agentId = agentId; + } + + public int getNumberRetake() { + return this.numberRetake; + } + + public void setNumberRetake(int numberRetake) { + this.numberRetake = numberRetake; + } + + public StudentGradingSummaryData getStudentGradingSummaryData() { + return this.studentGradingSummaryData; + } + + public void setStudentGradingSummaryData(StudentGradingSummaryData studentGradingSummaryData) { + this.studentGradingSummaryData = studentGradingSummaryData; + } + + public String getStudentName() { + return this.studentName; + } + + public void setStudentName(String studentName) { + this.studentName = studentName; + } + + public HashMap getStudentGradingSummaryDataMap() { + return this.studentGradingSummaryDataMap; + } + + public void setStudentGradingSummaryDataMap(HashMap studentGradingSummaryDataMap) { + this.studentGradingSummaryDataMap = studentGradingSummaryDataMap; + } +} diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/StudentScoresBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/StudentScoresBean.java index 88e2e3c55fdf..a875dcb69c44 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/StudentScoresBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/StudentScoresBean.java @@ -30,8 +30,8 @@ import javax.faces.context.ExternalContext; import javax.faces.context.FacesContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.content.api.FilePickerHelper; import org.sakaiproject.tool.api.ToolSession; import org.sakaiproject.tool.assessment.ui.bean.delivery.DeliveryBean; @@ -47,7 +47,7 @@ */ public class StudentScoresBean implements Serializable { - private static Log log = LogFactory.getLog(StudentScoresBean.class); + private static Logger log = LoggerFactory.getLogger(StudentScoresBean.class); /** Use serialVersionUID for interoperability. */ private final static long serialVersionUID = 5517587781720762296L; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/SubmissionStatusBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/SubmissionStatusBean.java index ef3f12cd1101..a830c84962a5 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/SubmissionStatusBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/SubmissionStatusBean.java @@ -32,8 +32,8 @@ import javax.faces.event.ActionEvent; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.jsf.model.PhaseAware; import org.sakaiproject.tool.assessment.business.entity.RecordingData; @@ -76,7 +76,7 @@ public class SubmissionStatusBean private String totalPeople; private String firstItem; private HashMap answeredItems; - private static Log log = LogFactory.getLog(SubmissionStatusBean.class); + private static Logger log = LoggerFactory.getLogger(SubmissionStatusBean.class); //private String selectedSectionFilterValue = TotalScoresBean.ALL_SECTIONS_SELECT_VALUE; private String selectedSectionFilterValue = null; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/TotalScoresBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/TotalScoresBean.java index a364007e07bd..4987c4c1262c 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/TotalScoresBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/TotalScoresBean.java @@ -37,8 +37,8 @@ import javax.faces.model.SelectItem; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.jsf.model.PhaseAware; import org.sakaiproject.section.api.coursemanagement.CourseSection; import org.sakaiproject.section.api.coursemanagement.EnrollmentRecord; @@ -144,7 +144,7 @@ public class TotalScoresBean private boolean isAutoScored = false; private boolean hasFileUpload = false; - private static Log log = LogFactory.getLog(TotalScoresBean.class); + private static Logger log = LoggerFactory.getLogger(TotalScoresBean.class); /** * Creates a new TotalScoresBean object. diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/print/PDFAssessmentBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/print/PDFAssessmentBean.java index a596f0e8b2e5..44cead29c9c2 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/print/PDFAssessmentBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/print/PDFAssessmentBean.java @@ -23,8 +23,8 @@ import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.tool.assessment.data.dao.assessment.PublishedAnswer; import org.sakaiproject.tool.assessment.data.dao.assessment.PublishedAssessmentAttachment; @@ -71,7 +71,7 @@ public class PDFAssessmentBean implements Serializable { private static final long serialVersionUID = 1L; - private static Log log = LogFactory.getLog(PDFAssessmentBean.class); + private static Logger log = LoggerFactory.getLogger(PDFAssessmentBean.class); private static org.sakaiproject.util.api.FormattedText formattedText = (org.sakaiproject.util.api.FormattedText)ComponentManager.get(org.sakaiproject.util.api.FormattedText.class); @@ -674,8 +674,7 @@ else if (item.getItemData().getTypeId().equals(TypeIfc.ESSAY_QUESTION)) { w = img_in.getWidth(null); h = img_in.getHeight(null); } catch (IOException e) { - log.error(e); - e.printStackTrace(); + log.error(e.getMessage(), e); } Color c = new Color(27, 148, 224, 80); @@ -711,8 +710,7 @@ else if (item.getItemData().getTypeId().equals(TypeIfc.ESSAY_QUESTION)) { } g.dispose(); } catch (Exception e) { - e.printStackTrace(); - log.error(e); + log.error(e.getMessage(), e); } @@ -722,8 +720,7 @@ else if (item.getItemData().getTypeId().equals(TypeIfc.ESSAY_QUESTION)) { ImageIO.write(img_out, ext, temp); destSrc+=temp.getCanonicalPath(); } catch (IOException e) { - e.printStackTrace(); - log.error(e); + log.error(e.getMessage(), e); } //print it @@ -812,17 +809,15 @@ public void getPDFAttachment() { out.flush(); } catch (IOException e) { - log.error(e); - e.printStackTrace(); - } + log.error(e.getMessage(), e); + } finally { try { if (out != null) out.close(); } catch (IOException e) { - log.error(e); - e.printStackTrace(); + log.error(e.getMessage(), e); } } faces.responseComplete(); @@ -1044,7 +1039,7 @@ public ByteArrayOutputStream getStream() { } catch(Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); System.err.println("document: " + e.getMessage()); } diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/qti/XMLController.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/qti/XMLController.java index 497b728782a3..70342d2a548c 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/qti/XMLController.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/qti/XMLController.java @@ -29,8 +29,8 @@ import org.w3c.dom.Document; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.qti.constants.QTIVersion; //import org.sakaiproject.tool.assessment.qti.helper.AuthoringHelper; @@ -53,7 +53,7 @@ public class XMLController implements Serializable */ private static final long serialVersionUID = 7064783681056628447L; -private static Log log = LogFactory.getLog(XMLController.class); +private static Logger log = LoggerFactory.getLogger(XMLController.class); private static final String XML_DECL = "" + "\n"; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/qti/XMLImportBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/qti/XMLImportBean.java index d786ef5313f9..0d8b0780bbdc 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/qti/XMLImportBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/qti/XMLImportBean.java @@ -37,8 +37,8 @@ import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.service.gradebook.shared.GradebookExternalAssessmentService; import org.sakaiproject.spring.SpringBeanLocator; @@ -74,7 +74,7 @@ public class XMLImportBean implements Serializable /** Use serialVersionUID for interoperability. */ private final static long serialVersionUID = 418920360211039758L; - private static Log log = LogFactory.getLog(XMLImportBean.class); + private static Logger log = LoggerFactory.getLogger(XMLImportBean.class); private int qtiVersion; private String uploadFileName; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/questionpool/QuestionPoolBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/questionpool/QuestionPoolBean.java index 2bfa882e2156..dc2515fc9ae9 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/questionpool/QuestionPoolBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/questionpool/QuestionPoolBean.java @@ -45,8 +45,8 @@ import javax.faces.model.SelectItem; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.struts.upload.FormFile; import org.osid.shared.SharedException; import org.sakaiproject.tool.assessment.business.questionpool.QuestionPoolTreeImpl; @@ -150,7 +150,7 @@ public class QuestionPoolBean implements Serializable private ItemFacade itemToPreview; - private static Log log = LogFactory.getLog(QuestionPoolBean.class); + private static Logger log = LoggerFactory.getLogger(QuestionPoolBean.class); // for JSF diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/questionpool/QuestionPoolDataBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/questionpool/QuestionPoolDataBean.java index 8e06d0260d36..8724bc6aabbe 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/questionpool/QuestionPoolDataBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/questionpool/QuestionPoolDataBean.java @@ -32,8 +32,8 @@ import java.util.Iterator; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.facade.QuestionPoolFacade; import org.sakaiproject.util.FormattedText; @@ -68,7 +68,7 @@ public class QuestionPoolDataBean private Date dateCreated; - private static Log log = LogFactory.getLog(QuestionPoolDataBean.class); + private static Logger log = LoggerFactory.getLogger(QuestionPoolDataBean.class); private Map parentPools = new HashMap(); private ArrayList parentPoolsArray = new ArrayList(); diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/questionpool/QuestionPoolShareBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/questionpool/QuestionPoolShareBean.java index 5fe8e2c85f56..b4b1ea5387e4 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/questionpool/QuestionPoolShareBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/questionpool/QuestionPoolShareBean.java @@ -1,8 +1,8 @@ -/********************************************************************************** - * $URL$ - * $Id$ - *********************************************************************************** - * +/********************************************************************************** + * $URL$ + * $Id$ + *********************************************************************************** + * * Copyright (c) 2006, 2008, 2009 The Sakai Foundation * * Licensed under the Educational Community License, Version 2.0 (the "License"); @@ -16,266 +16,266 @@ * 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.sakaiproject.tool.assessment.ui.bean.questionpool; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; - -import javax.faces.context.FacesContext; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.sakaiproject.tool.assessment.data.dao.questionpool.QuestionPoolData; -import org.sakaiproject.tool.assessment.data.model.Tree; -import org.sakaiproject.tool.assessment.facade.AgentFacade; -import org.sakaiproject.tool.assessment.facade.QuestionPoolFacade; -import org.sakaiproject.tool.assessment.facade.QuestionPoolIteratorFacade; -import org.sakaiproject.tool.assessment.services.QuestionPoolService; -import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; -import org.sakaiproject.tool.assessment.util.BeanSort; -import org.sakaiproject.tool.assessment.business.questionpool.QuestionPoolTreeImpl; - -// from navigo - - -/** - * This holds question pool information. - * - * Used to be org.navigoproject.ui.web.form.questionpool.QuestionPoolForm - * - * @author Rachel Gollub - * @author Lydia Li - * $Id$ - */ -public class QuestionPoolShareBean implements Serializable -{ - /** - * - */ - private static final long serialVersionUID = -1154189308380595101L; - - private static Log log = LogFactory.getLog(QuestionPoolShareBean.class); - - // QuestionPool - private Long questionPoolId; - private String questionPoolOwnerId; - private String questionPoolName; - - private String[] destPools = { }; // for multibox jsf - - // for sorting - private String sortPropertyWith = "displayName"; - private boolean sortAscendingWith = true; - private String sortPropertyWithout = "displayName"; - private boolean sortAscendingWithout = true; - - // collections of Agents - private Collection agentsWithAccess; - private Collection agentsWithoutAccess; - - - /** - * Creates a new QuestionPoolShareBean object. - */ - public QuestionPoolShareBean() - { - } - - public String startSharePool() - { - log.debug("inside startSharePool()"); - - String qpid = (String) FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("qpid"); - - QuestionPoolService delegate = new QuestionPoolService(); - - QuestionPoolFacade thepool = delegate.getPool(new Long(qpid), AgentFacade.getAgentString()); - - setAgentsWithAccess(delegate.getAgentsWithAccess(new Long(qpid))); - setAgentsWithoutAccess(delegate.getAgentsWithoutAccess(new Long(qpid), AgentFacade.getCurrentSiteId())); - setQuestionPoolId(new Long(qpid)); - setQuestionPoolOwnerId(thepool.getOwnerId()); - setQuestionPoolName(thepool.getDisplayName()); - - List poolsWithAccess = delegate.getPoolIdsByAgent(AgentFacade.getAgentString()); - if (!poolsWithAccess.contains(this.getQuestionPoolId()) ) { - throw new IllegalArgumentException("User " + AgentFacade.getAgentString() + " does not have access to question pool id " + this.getQuestionPoolId() + " for sharing"); - } - - // order by default - sortAgentsWithAccess(); - sortAgentsWithoutAccess(); - - return "sharePool"; - } - - public String sharePool() { - - QuestionPoolService delegate = new QuestionPoolService(); - Tree tree = null; - try { - tree= new QuestionPoolTreeImpl((QuestionPoolIteratorFacade) delegate.getAllPoolsWithAccess(AgentFacade.getAgentString())); - } - catch(Exception e) { - e.printStackTrace(); - throw new RuntimeException(e); - } - - ArrayList revoke = ContextUtil.paramArrayValueLike("revokeCheckbox"); - - Iterator iter = revoke.iterator(); - while(iter.hasNext()) { - String agentId = (String) iter.next(); - - try { - delegate.removeQuestionPoolAccess(tree, agentId, getQuestionPoolId(), QuestionPoolData.READ_COPY); - } - catch(Exception e) { - e.printStackTrace(); - throw new RuntimeException(e); - } - } - - ArrayList grant = ContextUtil.paramArrayValueLike("grantCheckbox"); - - iter = grant.iterator(); - while(iter.hasNext()) { - String agentId = (String) iter.next(); - - try { - delegate.addQuestionPoolAccess(tree, agentId, this.getQuestionPoolId(), QuestionPoolData.READ_COPY); - } - catch(Exception e) { - e.printStackTrace(); - throw new RuntimeException(e); - } - } - - return "poolList"; - } - - public String sortByColumnHeader() { - String sortString = ContextUtil.lookupParam("orderBy"); - String ascending = ContextUtil.lookupParam("ascending"); - String list = ContextUtil.lookupParam("list"); - - if ("agentsWithAccess".equals(list)) { - this.setSortPropertyWith(sortString); - this.setSortAscendingWith((Boolean.valueOf(ascending)).booleanValue()); - - sortAgentsWithAccess(); - } - else { - this.setSortPropertyWithout(sortString); - this.setSortAscendingWithout((Boolean.valueOf(ascending)).booleanValue()); - - sortAgentsWithoutAccess(); - } - - return "shareList"; - } - - public void sortAgentsWithAccess() { - BeanSort sort = new BeanSort(agentsWithAccess, sortPropertyWith); - sort.toStringSort(); - - agentsWithAccess = sortAscendingWith ? (ArrayList)sort.sort() : (ArrayList)sort.sortDesc(); - } - - public void sortAgentsWithoutAccess() { - BeanSort sort = new BeanSort(agentsWithoutAccess, sortPropertyWithout); - sort.toStringSort(); - - agentsWithoutAccess = sortAscendingWithout ? (ArrayList)sort.sort() : (ArrayList)sort.sortDesc(); - } - - - public Collection getAgentsWithAccess() { - return agentsWithAccess; - } - - public void setAgentsWithAccess(Collection agentsWithAccess) { - this.agentsWithAccess = agentsWithAccess; - } - - public Collection getAgentsWithoutAccess() { - return agentsWithoutAccess; - } - - public void setAgentsWithoutAccess(Collection agentsWithoutAccess) { - this.agentsWithoutAccess = agentsWithoutAccess; - } - - public String getQuestionPoolOwnerId() { - return questionPoolOwnerId; - } - - public void setQuestionPoolOwnerId(String questionPoolOwnerId) { - this.questionPoolOwnerId = questionPoolOwnerId; - } - - public Long getQuestionPoolId() { - return questionPoolId; - } - - public void setQuestionPoolId(Long questionPoolId) { - this.questionPoolId = questionPoolId; - } - - public String getQuestionPoolName() { - return questionPoolName; - } - - public void setQuestionPoolName(String questionPoolName) { - this.questionPoolName = questionPoolName; - } - - public void setDestPools(String[] destPools) { - this.destPools = destPools; - } - - public String[] getDestPools() { - return destPools; - } - - public void setSortPropertyWith(String sortPropertyWith) { - this.sortPropertyWith = sortPropertyWith; - } - - public String getSortPropertyWith() { - return sortPropertyWith; - } - - public void setSortAscendingWith(boolean sortAscendingWith) { - this.sortAscendingWith = sortAscendingWith; - } - - public boolean isSortAscendingWith() { - return sortAscendingWith; - } - - public void setSortPropertyWithout(String sortPropertyWithout) { - this.sortPropertyWithout = sortPropertyWithout; - } - - public String getSortPropertyWithout() { - return sortPropertyWithout; - } - - public void setSortAscendingWithout(boolean sortAscendingWithout) { - this.sortAscendingWithout = sortAscendingWithout; - } - - public boolean isSortAscendingWithout() { - return sortAscendingWithout; - } - -} + * + **********************************************************************************/ + + + +package org.sakaiproject.tool.assessment.ui.bean.questionpool; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; + +import javax.faces.context.FacesContext; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sakaiproject.tool.assessment.data.dao.questionpool.QuestionPoolData; +import org.sakaiproject.tool.assessment.data.model.Tree; +import org.sakaiproject.tool.assessment.facade.AgentFacade; +import org.sakaiproject.tool.assessment.facade.QuestionPoolFacade; +import org.sakaiproject.tool.assessment.facade.QuestionPoolIteratorFacade; +import org.sakaiproject.tool.assessment.services.QuestionPoolService; +import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; +import org.sakaiproject.tool.assessment.util.BeanSort; +import org.sakaiproject.tool.assessment.business.questionpool.QuestionPoolTreeImpl; + +// from navigo + + +/** + * This holds question pool information. + * + * Used to be org.navigoproject.ui.web.form.questionpool.QuestionPoolForm + * + * @author Rachel Gollub + * @author Lydia Li + * $Id$ + */ +public class QuestionPoolShareBean implements Serializable +{ + /** + * + */ + private static final long serialVersionUID = -1154189308380595101L; + + private static Logger log = LoggerFactory.getLogger(QuestionPoolShareBean.class); + + // QuestionPool + private Long questionPoolId; + private String questionPoolOwnerId; + private String questionPoolName; + + private String[] destPools = { }; // for multibox jsf + + // for sorting + private String sortPropertyWith = "displayName"; + private boolean sortAscendingWith = true; + private String sortPropertyWithout = "displayName"; + private boolean sortAscendingWithout = true; + + // collections of Agents + private Collection agentsWithAccess; + private Collection agentsWithoutAccess; + + + /** + * Creates a new QuestionPoolShareBean object. + */ + public QuestionPoolShareBean() + { + } + + public String startSharePool() + { + log.debug("inside startSharePool()"); + + String qpid = (String) FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("qpid"); + + QuestionPoolService delegate = new QuestionPoolService(); + + QuestionPoolFacade thepool = delegate.getPool(new Long(qpid), AgentFacade.getAgentString()); + + setAgentsWithAccess(delegate.getAgentsWithAccess(new Long(qpid))); + setAgentsWithoutAccess(delegate.getAgentsWithoutAccess(new Long(qpid), AgentFacade.getCurrentSiteId())); + setQuestionPoolId(new Long(qpid)); + setQuestionPoolOwnerId(thepool.getOwnerId()); + setQuestionPoolName(thepool.getDisplayName()); + + List poolsWithAccess = delegate.getPoolIdsByAgent(AgentFacade.getAgentString()); + if (!poolsWithAccess.contains(this.getQuestionPoolId()) ) { + throw new IllegalArgumentException("User " + AgentFacade.getAgentString() + " does not have access to question pool id " + this.getQuestionPoolId() + " for sharing"); + } + + // order by default + sortAgentsWithAccess(); + sortAgentsWithoutAccess(); + + return "sharePool"; + } + + public String sharePool() { + + QuestionPoolService delegate = new QuestionPoolService(); + Tree tree = null; + try { + tree= new QuestionPoolTreeImpl((QuestionPoolIteratorFacade) delegate.getAllPoolsWithAccess(AgentFacade.getAgentString())); + } + catch(Exception e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + + ArrayList revoke = ContextUtil.paramArrayValueLike("revokeCheckbox"); + + Iterator iter = revoke.iterator(); + while(iter.hasNext()) { + String agentId = (String) iter.next(); + + try { + delegate.removeQuestionPoolAccess(tree, agentId, getQuestionPoolId(), QuestionPoolData.READ_COPY); + } + catch(Exception e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + + ArrayList grant = ContextUtil.paramArrayValueLike("grantCheckbox"); + + iter = grant.iterator(); + while(iter.hasNext()) { + String agentId = (String) iter.next(); + + try { + delegate.addQuestionPoolAccess(tree, agentId, this.getQuestionPoolId(), QuestionPoolData.READ_COPY); + } + catch(Exception e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + + return "poolList"; + } + + public String sortByColumnHeader() { + String sortString = ContextUtil.lookupParam("orderBy"); + String ascending = ContextUtil.lookupParam("ascending"); + String list = ContextUtil.lookupParam("list"); + + if ("agentsWithAccess".equals(list)) { + this.setSortPropertyWith(sortString); + this.setSortAscendingWith((Boolean.valueOf(ascending)).booleanValue()); + + sortAgentsWithAccess(); + } + else { + this.setSortPropertyWithout(sortString); + this.setSortAscendingWithout((Boolean.valueOf(ascending)).booleanValue()); + + sortAgentsWithoutAccess(); + } + + return "shareList"; + } + + public void sortAgentsWithAccess() { + BeanSort sort = new BeanSort(agentsWithAccess, sortPropertyWith); + sort.toStringSort(); + + agentsWithAccess = sortAscendingWith ? (ArrayList)sort.sort() : (ArrayList)sort.sortDesc(); + } + + public void sortAgentsWithoutAccess() { + BeanSort sort = new BeanSort(agentsWithoutAccess, sortPropertyWithout); + sort.toStringSort(); + + agentsWithoutAccess = sortAscendingWithout ? (ArrayList)sort.sort() : (ArrayList)sort.sortDesc(); + } + + + public Collection getAgentsWithAccess() { + return agentsWithAccess; + } + + public void setAgentsWithAccess(Collection agentsWithAccess) { + this.agentsWithAccess = agentsWithAccess; + } + + public Collection getAgentsWithoutAccess() { + return agentsWithoutAccess; + } + + public void setAgentsWithoutAccess(Collection agentsWithoutAccess) { + this.agentsWithoutAccess = agentsWithoutAccess; + } + + public String getQuestionPoolOwnerId() { + return questionPoolOwnerId; + } + + public void setQuestionPoolOwnerId(String questionPoolOwnerId) { + this.questionPoolOwnerId = questionPoolOwnerId; + } + + public Long getQuestionPoolId() { + return questionPoolId; + } + + public void setQuestionPoolId(Long questionPoolId) { + this.questionPoolId = questionPoolId; + } + + public String getQuestionPoolName() { + return questionPoolName; + } + + public void setQuestionPoolName(String questionPoolName) { + this.questionPoolName = questionPoolName; + } + + public void setDestPools(String[] destPools) { + this.destPools = destPools; + } + + public String[] getDestPools() { + return destPools; + } + + public void setSortPropertyWith(String sortPropertyWith) { + this.sortPropertyWith = sortPropertyWith; + } + + public String getSortPropertyWith() { + return sortPropertyWith; + } + + public void setSortAscendingWith(boolean sortAscendingWith) { + this.sortAscendingWith = sortAscendingWith; + } + + public boolean isSortAscendingWith() { + return sortAscendingWith; + } + + public void setSortPropertyWithout(String sortPropertyWithout) { + this.sortPropertyWithout = sortPropertyWithout; + } + + public String getSortPropertyWithout() { + return sortPropertyWithout; + } + + public void setSortAscendingWithout(boolean sortAscendingWithout) { + this.sortAscendingWithout = sortAscendingWithout; + } + + public boolean isSortAscendingWithout() { + return sortAscendingWithout; + } + +} diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/samlite/SamLiteBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/samlite/SamLiteBean.java index f15168e14759..4c53c875122d 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/samlite/SamLiteBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/samlite/SamLiteBean.java @@ -5,8 +5,8 @@ import java.util.Iterator; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.tool.assessment.facade.AssessmentFacade; import org.sakaiproject.tool.assessment.facade.AssessmentFacadeQueries; @@ -23,7 +23,7 @@ import org.w3c.dom.Document; public class SamLiteBean implements Serializable { - private static Log log = LogFactory.getLog(SamLiteBean.class); + private static Logger log = LoggerFactory.getLogger(SamLiteBean.class); private static final long serialVersionUID = -3122436861866172596L; public static final String DEFAULT_CHARSET = "ascii-us"; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/shared/BackingBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/shared/BackingBean.java index 316c7208823b..82132abe7fc9 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/shared/BackingBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/shared/BackingBean.java @@ -29,8 +29,8 @@ import org.sakaiproject.tool.assessment.ui.listener.author.AuthorActionListener; import org.sakaiproject.tool.assessment.ui.listener.select.SelectActionListener; import org.sakaiproject.tool.assessment.ui.listener.delivery.BeginDeliveryActionListener; -import org.apache.commons.logging.LogFactory; -import org.apache.commons.logging.Log; +import org.slf4j.LoggerFactory; +import org.slf4j.Logger; /** *

@@ -48,7 +48,7 @@ public class BackingBean implements Serializable */ private static final long serialVersionUID = -1137408628089300518L; -private static Log log = LogFactory.getLog(BackingBean.class); +private static Logger log = LoggerFactory.getLogger(BackingBean.class); private String prop1; private String prop2; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/shared/PersonBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/shared/PersonBean.java index 6533db78bd58..24ed231c155d 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/shared/PersonBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/shared/PersonBean.java @@ -35,8 +35,8 @@ import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; import org.sakaiproject.tool.assessment.ui.bean.delivery.DeliveryBean; import org.sakaiproject.tool.assessment.facade.AgentFacade; -import org.apache.commons.logging.LogFactory; -import org.apache.commons.logging.Log; +import org.slf4j.LoggerFactory; +import org.slf4j.Logger; /** *

@@ -53,7 +53,7 @@ public class PersonBean implements Serializable * */ private static final long serialVersionUID = 1884634498046475698L; -private static Log log = LogFactory.getLog(PersonBean.class); +private static Logger log = LoggerFactory.getLogger(PersonBean.class); private String anonymousId; private String previewFromPage; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/util/EmailBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/util/EmailBean.java index b3425e6ef926..fd2cd3c72a07 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/util/EmailBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/util/EmailBean.java @@ -1,8 +1,8 @@ -/********************************************************************************** - * $URL$ - * $Id$ - *********************************************************************************** - * +/********************************************************************************** + * $URL$ + * $Id$ + *********************************************************************************** + * * Copyright (c) 2006, 2007, 2008, 2009 The Sakai Foundation * * Licensed under the Educational Community License, Version 2.0 (the "License"); @@ -16,318 +16,318 @@ * 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.sakaiproject.tool.assessment.ui.bean.util; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - -import javax.faces.application.FacesMessage; -import javax.faces.context.ExternalContext; -import javax.faces.context.FacesContext; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.sakaiproject.component.cover.ServerConfigurationService; -import org.sakaiproject.content.api.ContentResource; -import org.sakaiproject.content.api.FilePickerHelper; -import org.sakaiproject.entity.api.Reference; -import org.sakaiproject.entity.cover.EntityManager; -import org.sakaiproject.event.cover.EventTrackingService; -import org.sakaiproject.exception.IdUnusedException; -import org.sakaiproject.exception.PermissionException; -import org.sakaiproject.exception.TypeException; -import org.sakaiproject.tool.api.ToolSession; -import org.sakaiproject.tool.assessment.data.dao.assessment.AttachmentData; -import org.sakaiproject.tool.assessment.data.ifc.assessment.AttachmentIfc; -import org.sakaiproject.tool.assessment.facade.AgentFacade; -import org.sakaiproject.tool.assessment.services.assessment.AssessmentService; -import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; -import org.sakaiproject.tool.assessment.util.SamigoEmailService; -import org.sakaiproject.tool.cover.SessionManager; - -public class EmailBean implements Serializable { - private static Log log = LogFactory.getLog(EmailBean.class); - - private String fromName; - - private String fromEmailAddress; - - private String toName; - - private String toEmailAddress; - - private String toFirstName; - - private String assessmentName; - - private String subject; - - private String ccMe = "no"; - - private String message; - - private List attachmentList; - - private boolean hasAttachment = false; - - private String outcome; - - private HashMap resourceHash = new HashMap(); - - /** - * Creates a new TotalScoresBean object. - */ - public EmailBean() { - log.debug("Creating a new EmailBean"); - } - - public String getFromName() { - return fromName; - } - - public void setFromName(String fromName) { - this.fromName = fromName; - } - - public String getFromEmailAddress() { - return fromEmailAddress; - } - - public void setFromEmailAddress(String fromEmailAddress) { - this.fromEmailAddress = fromEmailAddress; - } - - public String getToName() { - return toName; - } - - public void setToName(String toName) { - this.toName = toName; - } - - public String getToEmailAddress() { - return toEmailAddress; - } - - public void setToEmailAddress(String toEmailAddress) { - this.toEmailAddress = toEmailAddress; - } - - public String getToFirstName() { - return toFirstName; - } - - public void setToFirstName(String toFirstName) { - this.toFirstName = toFirstName; - } - - public String getAssessmentName() { - return assessmentName; - } - - public void setAssessmentName(String assessmentName) { - this.assessmentName = assessmentName; - } - - public String getSubject() { - return subject; - } - - public void setSubject(String subject) { - this.subject = subject; - } - - public String getCcMe() { - return ccMe; - } - - public void setCcMe(String ccMe) { - this.ccMe = ccMe; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public List getAttachmentList() { - return attachmentList; - } - - public void setAttachmentList(List attachmentList) { - this.attachmentList = attachmentList; - } - - public boolean getHasAttachment() { - return this.hasAttachment; - } - - public void setHasAttachment(boolean hasAttachment) { - this.hasAttachment = hasAttachment; - } - - public String getOutcome() { - return outcome; - } - - public void setOutcome(String outcome) { - this.outcome = outcome; - } - public void prepareAttachment() { - ToolSession session = SessionManager.getCurrentToolSession(); - ArrayList newAttachmentList = new ArrayList(); - if (session.getAttribute(FilePickerHelper.FILE_PICKER_ATTACHMENTS) != null) { - List refs = (List) session.getAttribute(FilePickerHelper.FILE_PICKER_ATTACHMENTS); - Reference ref; - if (refs.size() == 0) { - hasAttachment = false; - } - else { - HashMap map = getResourceIdHash(attachmentList); - for (int i = 0; i < refs.size(); i++) { - ref = (Reference) refs.get(i); - String resourceId = ref.getId(); - if (map.get(resourceId) == null) { - AssessmentService assessmentService = new AssessmentService(); - AttachmentData attach = assessmentService.createEmailAttachment( - resourceId, - ref.getProperties().getProperty(ref.getProperties().getNamePropDisplayName()), - ServerConfigurationService.getServerUrl()); - - newAttachmentList.add(attach); - - } - else { - newAttachmentList.add((AttachmentData)map.get(resourceId)); - map.remove(resourceId); - } - - hasAttachment = true; - } - } - session.removeAttribute(FilePickerHelper.FILE_PICKER_ATTACHMENTS); - session.removeAttribute(FilePickerHelper.FILE_PICKER_CANCEL); - } - else { - hasAttachment = false; - } - attachmentList = newAttachmentList; - } - - - private HashMap getResourceIdHash(List attachmentList) { - HashMap map = new HashMap(); - if (attachmentList != null) { - Iterator iter = attachmentList.iterator(); - while (iter.hasNext()) { - AttachmentData attach = (AttachmentData) iter.next(); - map.put(attach.getResourceId(), attach); - } - } - return map; - } - - public String addAttachmentsRedirect() { - try { - List filePickerList = new ArrayList(); - if (attachmentList != null){ - filePickerList = prepareReferenceList(attachmentList); - } - log.debug("**filePicker list="+filePickerList.size()); - ToolSession currentToolSession = SessionManager.getCurrentToolSession(); - currentToolSession.setAttribute(FilePickerHelper.FILE_PICKER_ATTACHMENTS, filePickerList); - ExternalContext context = FacesContext.getCurrentInstance().getExternalContext(); - context.redirect("sakai.filepicker.helper/tool"); - } - catch(Exception e){ - log.error("fail to redirect to attachment page: " + e.getMessage()); - } - return "email"; - } - - private List prepareReferenceList(List attachmentList) { - List list = new ArrayList(); - for (int i = 0; i < attachmentList.size(); i++) { - ContentResource cr = null; - AttachmentIfc attach = (AttachmentIfc) attachmentList.get(i); - try { - cr = AssessmentService.getContentHostingService().getResource(attach.getResourceId()); - } catch (PermissionException e) { - log.warn("PermissionException from ContentHostingService:" - + e.getMessage()); - } catch (IdUnusedException e) { - log.warn("IdUnusedException from ContentHostingService:" - + e.getMessage()); - } catch (TypeException e) { - log.warn("TypeException from ContentHostingService:" - + e.getMessage()); - } - if (cr != null) { - if (this.resourceHash == null) { - this.resourceHash = new HashMap(); - } - this.resourceHash.put(attach.getResourceId(), cr); - Reference ref = EntityManager.newReference(cr.getReference()); - if (ref != null) { - list.add(ref); - } - } - } - return list; - } - - public HashMap getResourceHash() { - return resourceHash; - } - - public void setResourceHash(HashMap resourceHash) - { - this.resourceHash = resourceHash; - } - - public String send() { - log.debug("send()"); - log.debug("fromName: " + fromName); - log.debug("fromEmailAddress: " + fromEmailAddress); - log.debug("toName: " + toName); - log.debug("toEmailAddress: " + toEmailAddress); - log.debug("subject: " + subject); - log.debug("ccMe: " + ccMe); - log.debug("message: " + message); - - SamigoEmailService samigoEmailService = new SamigoEmailService( - fromName, fromEmailAddress, toName, toEmailAddress, ccMe, - subject, message); - String result = samigoEmailService.send(); - - if ("send".equals(result)) { - String msgSent = ContextUtil.getLocalizedString("org.sakaiproject.tool.assessment.bundle.EvaluationMessages","sent_email_confirmation"); - FacesContext.getCurrentInstance().addMessage(null,new FacesMessage(msgSent)); - EventTrackingService.post(EventTrackingService.newEvent("sam.email", "siteId=" + AgentFacade.getCurrentSiteId() + ", Email sent ok: toName=" + toName + ", toEmail=" + toEmailAddress, true)); - return "confirmEmailSent"; - } - else { - String msgError = ContextUtil.getLocalizedString("org.sakaiproject.tool.assessment.bundle.EvaluationMessages","sent_email_error"); - FacesContext.getCurrentInstance().addMessage(null,new FacesMessage(msgError)); - EventTrackingService.post(EventTrackingService.newEvent("sam.email", "siteId=" + AgentFacade.getCurrentSiteId() + ", Email sent error: toName=" + toName + ", toEmail=" + toEmailAddress, true)); - return "emailError"; - } - } - - public void cancel() { - log.debug("cancel"); - setMessage(null); - setAttachmentList(null); - setHasAttachment(false); - } - -} + * + **********************************************************************************/ + +package org.sakaiproject.tool.assessment.ui.bean.util; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; + +import javax.faces.application.FacesMessage; +import javax.faces.context.ExternalContext; +import javax.faces.context.FacesContext; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sakaiproject.component.cover.ServerConfigurationService; +import org.sakaiproject.content.api.ContentResource; +import org.sakaiproject.content.api.FilePickerHelper; +import org.sakaiproject.entity.api.Reference; +import org.sakaiproject.entity.cover.EntityManager; +import org.sakaiproject.event.cover.EventTrackingService; +import org.sakaiproject.exception.IdUnusedException; +import org.sakaiproject.exception.PermissionException; +import org.sakaiproject.exception.TypeException; +import org.sakaiproject.tool.api.ToolSession; +import org.sakaiproject.tool.assessment.data.dao.assessment.AttachmentData; +import org.sakaiproject.tool.assessment.data.ifc.assessment.AttachmentIfc; +import org.sakaiproject.tool.assessment.facade.AgentFacade; +import org.sakaiproject.tool.assessment.services.assessment.AssessmentService; +import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; +import org.sakaiproject.tool.assessment.util.SamigoEmailService; +import org.sakaiproject.tool.cover.SessionManager; + +public class EmailBean implements Serializable { + private static Logger log = LoggerFactory.getLogger(EmailBean.class); + + private String fromName; + + private String fromEmailAddress; + + private String toName; + + private String toEmailAddress; + + private String toFirstName; + + private String assessmentName; + + private String subject; + + private String ccMe = "no"; + + private String message; + + private List attachmentList; + + private boolean hasAttachment = false; + + private String outcome; + + private HashMap resourceHash = new HashMap(); + + /** + * Creates a new TotalScoresBean object. + */ + public EmailBean() { + log.debug("Creating a new EmailBean"); + } + + public String getFromName() { + return fromName; + } + + public void setFromName(String fromName) { + this.fromName = fromName; + } + + public String getFromEmailAddress() { + return fromEmailAddress; + } + + public void setFromEmailAddress(String fromEmailAddress) { + this.fromEmailAddress = fromEmailAddress; + } + + public String getToName() { + return toName; + } + + public void setToName(String toName) { + this.toName = toName; + } + + public String getToEmailAddress() { + return toEmailAddress; + } + + public void setToEmailAddress(String toEmailAddress) { + this.toEmailAddress = toEmailAddress; + } + + public String getToFirstName() { + return toFirstName; + } + + public void setToFirstName(String toFirstName) { + this.toFirstName = toFirstName; + } + + public String getAssessmentName() { + return assessmentName; + } + + public void setAssessmentName(String assessmentName) { + this.assessmentName = assessmentName; + } + + public String getSubject() { + return subject; + } + + public void setSubject(String subject) { + this.subject = subject; + } + + public String getCcMe() { + return ccMe; + } + + public void setCcMe(String ccMe) { + this.ccMe = ccMe; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public List getAttachmentList() { + return attachmentList; + } + + public void setAttachmentList(List attachmentList) { + this.attachmentList = attachmentList; + } + + public boolean getHasAttachment() { + return this.hasAttachment; + } + + public void setHasAttachment(boolean hasAttachment) { + this.hasAttachment = hasAttachment; + } + + public String getOutcome() { + return outcome; + } + + public void setOutcome(String outcome) { + this.outcome = outcome; + } + public void prepareAttachment() { + ToolSession session = SessionManager.getCurrentToolSession(); + ArrayList newAttachmentList = new ArrayList(); + if (session.getAttribute(FilePickerHelper.FILE_PICKER_ATTACHMENTS) != null) { + List refs = (List) session.getAttribute(FilePickerHelper.FILE_PICKER_ATTACHMENTS); + Reference ref; + if (refs.size() == 0) { + hasAttachment = false; + } + else { + HashMap map = getResourceIdHash(attachmentList); + for (int i = 0; i < refs.size(); i++) { + ref = (Reference) refs.get(i); + String resourceId = ref.getId(); + if (map.get(resourceId) == null) { + AssessmentService assessmentService = new AssessmentService(); + AttachmentData attach = assessmentService.createEmailAttachment( + resourceId, + ref.getProperties().getProperty(ref.getProperties().getNamePropDisplayName()), + ServerConfigurationService.getServerUrl()); + + newAttachmentList.add(attach); + + } + else { + newAttachmentList.add((AttachmentData)map.get(resourceId)); + map.remove(resourceId); + } + + hasAttachment = true; + } + } + session.removeAttribute(FilePickerHelper.FILE_PICKER_ATTACHMENTS); + session.removeAttribute(FilePickerHelper.FILE_PICKER_CANCEL); + } + else { + hasAttachment = false; + } + attachmentList = newAttachmentList; + } + + + private HashMap getResourceIdHash(List attachmentList) { + HashMap map = new HashMap(); + if (attachmentList != null) { + Iterator iter = attachmentList.iterator(); + while (iter.hasNext()) { + AttachmentData attach = (AttachmentData) iter.next(); + map.put(attach.getResourceId(), attach); + } + } + return map; + } + + public String addAttachmentsRedirect() { + try { + List filePickerList = new ArrayList(); + if (attachmentList != null){ + filePickerList = prepareReferenceList(attachmentList); + } + log.debug("**filePicker list="+filePickerList.size()); + ToolSession currentToolSession = SessionManager.getCurrentToolSession(); + currentToolSession.setAttribute(FilePickerHelper.FILE_PICKER_ATTACHMENTS, filePickerList); + ExternalContext context = FacesContext.getCurrentInstance().getExternalContext(); + context.redirect("sakai.filepicker.helper/tool"); + } + catch(Exception e){ + log.error("fail to redirect to attachment page: " + e.getMessage()); + } + return "email"; + } + + private List prepareReferenceList(List attachmentList) { + List list = new ArrayList(); + for (int i = 0; i < attachmentList.size(); i++) { + ContentResource cr = null; + AttachmentIfc attach = (AttachmentIfc) attachmentList.get(i); + try { + cr = AssessmentService.getContentHostingService().getResource(attach.getResourceId()); + } catch (PermissionException e) { + log.warn("PermissionException from ContentHostingService:" + + e.getMessage()); + } catch (IdUnusedException e) { + log.warn("IdUnusedException from ContentHostingService:" + + e.getMessage()); + } catch (TypeException e) { + log.warn("TypeException from ContentHostingService:" + + e.getMessage()); + } + if (cr != null) { + if (this.resourceHash == null) { + this.resourceHash = new HashMap(); + } + this.resourceHash.put(attach.getResourceId(), cr); + Reference ref = EntityManager.newReference(cr.getReference()); + if (ref != null) { + list.add(ref); + } + } + } + return list; + } + + public HashMap getResourceHash() { + return resourceHash; + } + + public void setResourceHash(HashMap resourceHash) + { + this.resourceHash = resourceHash; + } + + public String send() { + log.debug("send()"); + log.debug("fromName: " + fromName); + log.debug("fromEmailAddress: " + fromEmailAddress); + log.debug("toName: " + toName); + log.debug("toEmailAddress: " + toEmailAddress); + log.debug("subject: " + subject); + log.debug("ccMe: " + ccMe); + log.debug("message: " + message); + + SamigoEmailService samigoEmailService = new SamigoEmailService( + fromName, fromEmailAddress, toName, toEmailAddress, ccMe, + subject, message); + String result = samigoEmailService.send(); + + if ("send".equals(result)) { + String msgSent = ContextUtil.getLocalizedString("org.sakaiproject.tool.assessment.bundle.EvaluationMessages","sent_email_confirmation"); + FacesContext.getCurrentInstance().addMessage(null,new FacesMessage(msgSent)); + EventTrackingService.post(EventTrackingService.newEvent("sam.email", "siteId=" + AgentFacade.getCurrentSiteId() + ", Email sent ok: toName=" + toName + ", toEmail=" + toEmailAddress, true)); + return "confirmEmailSent"; + } + else { + String msgError = ContextUtil.getLocalizedString("org.sakaiproject.tool.assessment.bundle.EvaluationMessages","sent_email_error"); + FacesContext.getCurrentInstance().addMessage(null,new FacesMessage(msgError)); + EventTrackingService.post(EventTrackingService.newEvent("sam.email", "siteId=" + AgentFacade.getCurrentSiteId() + ", Email sent error: toName=" + toName + ", toEmail=" + toEmailAddress, true)); + return "emailError"; + } + } + + public void cancel() { + log.debug("cancel"); + setMessage(null); + setAttachmentList(null); + setHasAttachment(false); + } + +} diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ActionSelectListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ActionSelectListener.java index 8be893e1850e..2186841eb13c 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ActionSelectListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ActionSelectListener.java @@ -25,8 +25,8 @@ import javax.faces.event.ValueChangeEvent; import javax.faces.event.ValueChangeListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.ui.bean.author.AuthorBean; import org.sakaiproject.tool.assessment.ui.bean.delivery.DeliveryBean; import org.sakaiproject.tool.assessment.ui.bean.print.PDFAssessmentBean; @@ -44,7 +44,7 @@ * @version $Id$ */ public class ActionSelectListener implements ValueChangeListener { - private static Log log = LogFactory.getLog(ActionSelectListener.class); + private static Logger log = LoggerFactory.getLogger(ActionSelectListener.class); /** * Standard process action method. diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/AuthorActionListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/AuthorActionListener.java index 99d34062a994..2febc66e2519 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/AuthorActionListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/AuthorActionListener.java @@ -34,8 +34,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.exception.IdUnusedException; import org.sakaiproject.section.api.SectionAwareness; @@ -72,7 +72,7 @@ public class AuthorActionListener implements ActionListener { - private static final Log log = LogFactory.getLog(AuthorActionListener.class); + private static final Logger log = LoggerFactory.getLogger(AuthorActionListener.class); private HashMap> groupUsersIdMap = new HashMap>(); private ArrayList siteUsersIdList = new ArrayList(); private final TimeUtil tu = new TimeUtil(); @@ -126,7 +126,7 @@ public void processAction(ActionEvent ae) throws AbortProcessingException site = SiteService.getSite(ToolManager.getCurrentPlacement().getContext()); } catch (IdUnusedException ex) { - log.warn( ex ); + log.warn(ex.getMessage()); } // Does a site property 'samigo.editPubAssessment.restricted' exist? @@ -136,7 +136,7 @@ public void processAction(ActionEvent ae) throws AbortProcessingException // get the site properties siteProperties = site.getProperties(); } catch (Exception e) { - log.warn( e ); + log.warn(e.getMessage(), e); } if (siteProperties != null) { diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/AuthorAssessmentListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/AuthorAssessmentListener.java index 04cfe655a146..98dcd3c7dd8e 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/AuthorAssessmentListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/AuthorAssessmentListener.java @@ -32,8 +32,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.event.cover.EventTrackingService; import org.sakaiproject.tool.assessment.facade.AgentFacade; import org.sakaiproject.tool.assessment.facade.AssessmentFacade; @@ -60,7 +60,7 @@ public class AuthorAssessmentListener implements ActionListener { - private static Log log = LogFactory.getLog(AuthorAssessmentListener.class); + private static Logger log = LoggerFactory.getLogger(AuthorAssessmentListener.class); public AuthorAssessmentListener() { diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/AuthorPartListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/AuthorPartListener.java index 8f08295590c6..ef8f12a82ee8 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/AuthorPartListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/AuthorPartListener.java @@ -27,8 +27,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.ifc.assessment.SectionDataIfc; import org.sakaiproject.tool.assessment.ui.bean.author.AssessmentBean; import org.sakaiproject.tool.assessment.ui.bean.author.SectionBean; @@ -43,7 +43,7 @@ public class AuthorPartListener implements ActionListener { - private static Log log = LogFactory.getLog(AuthorPartListener.class); + private static Logger log = LoggerFactory.getLogger(AuthorPartListener.class); public AuthorPartListener() { diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/AuthorQuestionListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/AuthorQuestionListener.java index cd27fb271898..b3509055d261 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/AuthorQuestionListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/AuthorQuestionListener.java @@ -39,7 +39,7 @@ public class AuthorQuestionListener implements ActionListener { - //private static Log log = LogFactory.getLog(AuthorQuestionListener.class); + //private static Logger log = LoggerFactory.getLogger(AuthorQuestionListener.class); public AuthorQuestionListener() { diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/AuthorSettingsListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/AuthorSettingsListener.java index 620604426e0f..bd5158c131c8 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/AuthorSettingsListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/AuthorSettingsListener.java @@ -31,8 +31,8 @@ import org.apache.commons.lang.StringEscapeUtils; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentIfc; import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentMetaDataIfc; import org.sakaiproject.tool.assessment.facade.AgentFacade; @@ -53,7 +53,7 @@ public class AuthorSettingsListener implements ActionListener { - private static Log log = LogFactory.getLog(AuthorSettingsListener.class); + private static Logger log = LoggerFactory.getLogger(AuthorSettingsListener.class); public AuthorSettingsListener() { diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ChooseExportTypeListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ChooseExportTypeListener.java index 38e9a4fb5be2..8d150754f4ca 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ChooseExportTypeListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ChooseExportTypeListener.java @@ -1,8 +1,8 @@ -/********************************************************************************** - * $URL$ - * $Id$ - *********************************************************************************** - * +/********************************************************************************** + * $URL$ + * $Id$ + *********************************************************************************** + * * Copyright (c) 2004, 2005, 2006, 2007, 2008 The Sakai Foundation * * Licensed under the Educational Community License, Version 2.0 (the "License"); @@ -16,50 +16,50 @@ * 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.sakaiproject.tool.assessment.ui.listener.author; - -import javax.faces.event.AbortProcessingException; -import javax.faces.event.ActionEvent; -import javax.faces.event.ActionListener; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.sakaiproject.tool.assessment.facade.AssessmentFacade; -import org.sakaiproject.tool.assessment.services.assessment.AssessmentService; -import org.sakaiproject.tool.assessment.ui.bean.author.AssessmentBean; -import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; - -/** - *

Title: Samigo

- *

Description: Sakai Assessment Manager

- * @author Ed Smiley - * @version $Id$ - */ - -public class ChooseExportTypeListener implements ActionListener -{ - private static Log log = LogFactory.getLog(ExportAssessmentListener.class); - - public ChooseExportTypeListener() - { - } - - public void processAction(ActionEvent ae) throws AbortProcessingException - { - String assessmentId = (String) ContextUtil.lookupParam("assessmentId"); - log.info("ExportAssessmentListener assessmentId="+assessmentId); - - AssessmentBean assessmentBean = (AssessmentBean) ContextUtil.lookupBean( - "assessmentBean"); - AssessmentService assessmentService = new AssessmentService(); - AssessmentFacade assessment = assessmentService.getBasicInfoOfAnAssessment(assessmentId); - assessmentBean.setAssessmentId(assessment.getAssessmentBaseId().toString()); - assessmentBean.setTitle(assessment.getTitle()); - } - -} + * + **********************************************************************************/ + + + +package org.sakaiproject.tool.assessment.ui.listener.author; + +import javax.faces.event.AbortProcessingException; +import javax.faces.event.ActionEvent; +import javax.faces.event.ActionListener; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sakaiproject.tool.assessment.facade.AssessmentFacade; +import org.sakaiproject.tool.assessment.services.assessment.AssessmentService; +import org.sakaiproject.tool.assessment.ui.bean.author.AssessmentBean; +import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; + +/** + *

Title: Samigo

+ *

Description: Sakai Assessment Manager

+ * @author Ed Smiley + * @version $Id$ + */ + +public class ChooseExportTypeListener implements ActionListener +{ + private static Logger log = LoggerFactory.getLogger(ExportAssessmentListener.class); + + public ChooseExportTypeListener() + { + } + + public void processAction(ActionEvent ae) throws AbortProcessingException + { + String assessmentId = (String) ContextUtil.lookupParam("assessmentId"); + log.info("ExportAssessmentListener assessmentId="+assessmentId); + + AssessmentBean assessmentBean = (AssessmentBean) ContextUtil.lookupBean( + "assessmentBean"); + AssessmentService assessmentService = new AssessmentService(); + AssessmentFacade assessment = assessmentService.getBasicInfoOfAnAssessment(assessmentId); + assessmentBean.setAssessmentId(assessment.getAssessmentBaseId().toString()); + assessmentBean.setTitle(assessment.getTitle()); + } + +} diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ConfirmPublishAssessmentListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ConfirmPublishAssessmentListener.java index 29a103c00dfb..787eef73a11d 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ConfirmPublishAssessmentListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ConfirmPublishAssessmentListener.java @@ -34,8 +34,8 @@ import javax.faces.event.ActionListener; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.service.gradebook.shared.GradebookExternalAssessmentService; import org.sakaiproject.service.gradebook.shared.GradebookService; @@ -69,7 +69,7 @@ public class ConfirmPublishAssessmentListener implements ActionListener { - private static Log log = LogFactory.getLog(ConfirmPublishAssessmentListener.class); + private static Logger log = LoggerFactory.getLogger(ConfirmPublishAssessmentListener.class); //private static ContextUtil cu; private static final GradebookServiceHelper gbsHelper = IntegrationContextFactory.getInstance().getGradebookServiceHelper(); diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ConfirmRemoveAssessmentListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ConfirmRemoveAssessmentListener.java index c5c942805f97..8e30ff84b4be 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ConfirmRemoveAssessmentListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ConfirmRemoveAssessmentListener.java @@ -31,8 +31,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.facade.AssessmentFacade; import org.sakaiproject.tool.assessment.facade.AgentFacade; import org.sakaiproject.tool.assessment.services.assessment.AssessmentService; @@ -50,7 +50,7 @@ public class ConfirmRemoveAssessmentListener implements ActionListener { - //private static Log log = LogFactory.getLog(ConfirmRemoveAssessmentListener.class); + //private static Logger log = LoggerFactory.getLogger(ConfirmRemoveAssessmentListener.class); public ConfirmRemoveAssessmentListener() { diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ConfirmRemoveAttachmentListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ConfirmRemoveAttachmentListener.java index 9ee08a006127..122432683b6f 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ConfirmRemoveAttachmentListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ConfirmRemoveAttachmentListener.java @@ -39,7 +39,7 @@ public class ConfirmRemoveAttachmentListener implements ActionListener { - //private static Log log = LogFactory.getLog(ConfirmRemoveAttachmentListener.class); + //private static Logger log = LoggerFactory.getLogger(ConfirmRemoveAttachmentListener.class); public ConfirmRemoveAttachmentListener() { diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ConfirmRemovePublishedAssessmentListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ConfirmRemovePublishedAssessmentListener.java index 3224022cc847..3efa1acbfbb8 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ConfirmRemovePublishedAssessmentListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ConfirmRemovePublishedAssessmentListener.java @@ -1,8 +1,8 @@ -/********************************************************************************** - * $URL$ - * $Id$ - *********************************************************************************** - * +/********************************************************************************** + * $URL$ + * $Id$ + *********************************************************************************** + * * Copyright (c) 2007, 2008 The Sakai Foundation * * Licensed under the Educational Community License, Version 2.0 (the "License"); @@ -16,86 +16,86 @@ * 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.sakaiproject.tool.assessment.ui.listener.author; - -import javax.faces.application.FacesMessage; -import javax.faces.context.FacesContext; -import javax.faces.event.AbortProcessingException; -import javax.faces.event.ActionEvent; -import javax.faces.event.ActionListener; - -import org.sakaiproject.tool.assessment.data.dao.assessment.PublishedAssessmentData; -import org.sakaiproject.tool.assessment.facade.AgentFacade; -import org.sakaiproject.tool.assessment.facade.PublishedAssessmentFacade; -import org.sakaiproject.tool.assessment.services.assessment.PublishedAssessmentService; -import org.sakaiproject.tool.assessment.ui.bean.author.AuthorBean; -import org.sakaiproject.tool.assessment.ui.bean.author.PublishedAssessmentBean; -import org.sakaiproject.tool.assessment.ui.bean.authz.AuthorizationBean; -import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; -import org.sakaiproject.util.FormattedText; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - *

Title: Samigo

- *

Description: Sakai Assessment Manager

- * @author Ed Smiley - * @version $Id$ - */ - -public class ConfirmRemovePublishedAssessmentListener implements ActionListener -{ - private static Log log = LogFactory.getLog(ConfirmRemovePublishedAssessmentListener.class); - - public ConfirmRemovePublishedAssessmentListener() - { - } - - public void processAction(ActionEvent ae) throws AbortProcessingException - { - FacesContext context = FacesContext.getCurrentInstance(); - - // #1 - read the assessmentId from the form - String publishedAssessmentId = (String) FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("publishedAssessmentId"); - log.debug("publishedAssessmentId = " + publishedAssessmentId); - - // #2 - and use it to set author bean, goto removeAssessment.jsp - PublishedAssessmentBean publishedAssessmentBean = (PublishedAssessmentBean) ContextUtil.lookupBean("publishedassessment"); - - PublishedAssessmentService publishedAssessmentService = new PublishedAssessmentService(); - PublishedAssessmentFacade publishedAssessment = publishedAssessmentService.getPublishedAssessmentInfoForRemove(Long.valueOf(publishedAssessmentId)); - if (publishedAssessment != null) { - // #3 - permission checking before proceeding - daisyf - AuthorBean author = (AuthorBean) ContextUtil.lookupBean("author"); - - AuthorizationBean authzBean = (AuthorizationBean) ContextUtil.lookupBean("authorization"); - if (!authzBean.isUserAllowedToDeleteAssessment(publishedAssessmentId, publishedAssessment.getCreatedBy(), true)) { - String err=(String)ContextUtil.getLocalizedString("org.sakaiproject.tool.assessment.bundle.AuthorMessages", "denied_delete_other_members_assessment_error"); - context.addMessage(null,new FacesMessage(err)); - author.setOutcome("author"); - return; - } - - //Alert user to remove submissions associated with the assessment before delete the assessment - int submissions = publishedAssessmentService.getTotalSubmissionForEachAssessment(publishedAssessmentId); - if (submissions > 0) { - author.setOutcome("requireRemoveSubmissions"); - } else { - author.setOutcome("confirmRemovePublishedAssessment"); - } - //Should be publishedId or publishedAssessmentId; Set value publishedId value for totalscores.jsp - publishedAssessmentBean.setPublishedID(publishedAssessmentId); - publishedAssessmentBean.setAssessmentId(publishedAssessmentId); - publishedAssessmentBean.setTitle(FormattedText.convertFormattedTextToPlaintext(publishedAssessment.getTitle())); - } - else { - log.warn("publishedAssessment is null"); - } - } - -} + * + **********************************************************************************/ + + + +package org.sakaiproject.tool.assessment.ui.listener.author; + +import javax.faces.application.FacesMessage; +import javax.faces.context.FacesContext; +import javax.faces.event.AbortProcessingException; +import javax.faces.event.ActionEvent; +import javax.faces.event.ActionListener; + +import org.sakaiproject.tool.assessment.data.dao.assessment.PublishedAssessmentData; +import org.sakaiproject.tool.assessment.facade.AgentFacade; +import org.sakaiproject.tool.assessment.facade.PublishedAssessmentFacade; +import org.sakaiproject.tool.assessment.services.assessment.PublishedAssessmentService; +import org.sakaiproject.tool.assessment.ui.bean.author.AuthorBean; +import org.sakaiproject.tool.assessment.ui.bean.author.PublishedAssessmentBean; +import org.sakaiproject.tool.assessment.ui.bean.authz.AuthorizationBean; +import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; +import org.sakaiproject.util.FormattedText; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + *

Title: Samigo

+ *

Description: Sakai Assessment Manager

+ * @author Ed Smiley + * @version $Id$ + */ + +public class ConfirmRemovePublishedAssessmentListener implements ActionListener +{ + private static Logger log = LoggerFactory.getLogger(ConfirmRemovePublishedAssessmentListener.class); + + public ConfirmRemovePublishedAssessmentListener() + { + } + + public void processAction(ActionEvent ae) throws AbortProcessingException + { + FacesContext context = FacesContext.getCurrentInstance(); + + // #1 - read the assessmentId from the form + String publishedAssessmentId = (String) FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("publishedAssessmentId"); + log.debug("publishedAssessmentId = " + publishedAssessmentId); + + // #2 - and use it to set author bean, goto removeAssessment.jsp + PublishedAssessmentBean publishedAssessmentBean = (PublishedAssessmentBean) ContextUtil.lookupBean("publishedassessment"); + + PublishedAssessmentService publishedAssessmentService = new PublishedAssessmentService(); + PublishedAssessmentFacade publishedAssessment = publishedAssessmentService.getPublishedAssessmentInfoForRemove(Long.valueOf(publishedAssessmentId)); + if (publishedAssessment != null) { + // #3 - permission checking before proceeding - daisyf + AuthorBean author = (AuthorBean) ContextUtil.lookupBean("author"); + + AuthorizationBean authzBean = (AuthorizationBean) ContextUtil.lookupBean("authorization"); + if (!authzBean.isUserAllowedToDeleteAssessment(publishedAssessmentId, publishedAssessment.getCreatedBy(), true)) { + String err=(String)ContextUtil.getLocalizedString("org.sakaiproject.tool.assessment.bundle.AuthorMessages", "denied_delete_other_members_assessment_error"); + context.addMessage(null,new FacesMessage(err)); + author.setOutcome("author"); + return; + } + + //Alert user to remove submissions associated with the assessment before delete the assessment + int submissions = publishedAssessmentService.getTotalSubmissionForEachAssessment(publishedAssessmentId); + if (submissions > 0) { + author.setOutcome("requireRemoveSubmissions"); + } else { + author.setOutcome("confirmRemovePublishedAssessment"); + } + //Should be publishedId or publishedAssessmentId; Set value publishedId value for totalscores.jsp + publishedAssessmentBean.setPublishedID(publishedAssessmentId); + publishedAssessmentBean.setAssessmentId(publishedAssessmentId); + publishedAssessmentBean.setTitle(FormattedText.convertFormattedTextToPlaintext(publishedAssessment.getTitle())); + } + else { + log.warn("publishedAssessment is null"); + } + } + +} diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ConfirmRepublishAssessmentListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ConfirmRepublishAssessmentListener.java index 9b24be7b469b..7875c427d92e 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ConfirmRepublishAssessmentListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ConfirmRepublishAssessmentListener.java @@ -7,8 +7,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.event.cover.EventTrackingService; import org.sakaiproject.tool.assessment.facade.AgentFacade; import org.sakaiproject.tool.assessment.facade.PublishedAssessmentFacade; @@ -24,7 +24,7 @@ public class ConfirmRepublishAssessmentListener implements ActionListener { // To Do: I think this can be combined with SavePublishedSettingsListener. - private static Log log = LogFactory.getLog(ConfirmRepublishAssessmentListener.class); + private static Logger log = LoggerFactory.getLogger(ConfirmRepublishAssessmentListener.class); public void processAction(ActionEvent ae) throws AbortProcessingException { AuthorBean author = (AuthorBean) ContextUtil.lookupBean("author"); diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/CopyAssessmentListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/CopyAssessmentListener.java index b2c073b4babc..dfef2e1c094b 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/CopyAssessmentListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/CopyAssessmentListener.java @@ -4,14 +4,14 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.services.assessment.AssessmentService; import org.sakaiproject.tool.assessment.ui.bean.author.AssessmentBean; import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; public class CopyAssessmentListener implements ActionListener { - private static Log log = LogFactory.getLog(CopyAssessmentListener.class); + private static Logger log = LoggerFactory.getLogger(CopyAssessmentListener.class); public void processAction(ActionEvent ae) throws AbortProcessingException { log.debug("Enter processAction()"); diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/DeleteTemplateListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/DeleteTemplateListener.java index e9fa420d7f5e..e2fdfb31c520 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/DeleteTemplateListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/DeleteTemplateListener.java @@ -48,7 +48,7 @@ public class DeleteTemplateListener extends TemplateBaseListener implements ActionListener { //boolean isTemplate = true; - //private static Log log = LogFactory.getLog(DeleteTemplateListener.class); + //private static Logger log = LoggerFactory.getLogger(DeleteTemplateListener.class); public void processAction(ActionEvent ae) throws AbortProcessingException { diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/EditAssessmentListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/EditAssessmentListener.java index 8c1a9bef424c..8ee31d4f00b0 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/EditAssessmentListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/EditAssessmentListener.java @@ -29,8 +29,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentBaseIfc; import org.sakaiproject.tool.assessment.facade.AgentFacade; @@ -58,7 +58,7 @@ public class EditAssessmentListener implements ActionListener { - private static Log log = LogFactory.getLog(EditAssessmentListener.class); + private static Logger log = LoggerFactory.getLogger(EditAssessmentListener.class); public EditAssessmentListener() { diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/EditPartListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/EditPartListener.java index 08222d274ce1..7555ef697ca5 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/EditPartListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/EditPartListener.java @@ -58,7 +58,7 @@ public class EditPartListener implements ActionListener { - //private static Log log = LogFactory.getLog(EditPartListener.class); + //private static Logger log = LoggerFactory.getLogger(EditPartListener.class); private boolean isEditPendingAssessmentFlow = true; public EditPartListener() diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/EditPublishedQuestionPoolPartListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/EditPublishedQuestionPoolPartListener.java index bce440aa5195..416878e94157 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/EditPublishedQuestionPoolPartListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/EditPublishedQuestionPoolPartListener.java @@ -5,16 +5,16 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import lombok.extern.slf4j.Slf4j; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.ui.bean.author.AuthorBean; import org.sakaiproject.tool.assessment.ui.bean.delivery.SectionContentsBean; import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; +@Slf4j public class EditPublishedQuestionPoolPartListener implements ActionListener { - private static Log log = LogFactory - .getLog(EditPublishedQuestionPoolPartListener.class); public void processAction(ActionEvent ae) throws AbortProcessingException { diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/EditPublishedSettingsListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/EditPublishedSettingsListener.java index bbf5820ffba6..56bc56b6e607 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/EditPublishedSettingsListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/EditPublishedSettingsListener.java @@ -32,8 +32,8 @@ import javax.faces.event.ActionListener; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentBaseIfc; import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentMetaDataIfc; import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentIfc; @@ -58,7 +58,7 @@ public class EditPublishedSettingsListener implements ActionListener { - private static Log log = LogFactory.getLog(EditPublishedSettingsListener.class); + private static Logger log = LoggerFactory.getLogger(EditPublishedSettingsListener.class); public EditPublishedSettingsListener() { diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/EditTemplateListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/EditTemplateListener.java index 174b6a82d4d0..24b2ae77bb72 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/EditTemplateListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/EditTemplateListener.java @@ -33,8 +33,8 @@ import javax.faces.application.FacesMessage; import javax.faces.context.FacesContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.dao.assessment.AssessmentMetaData; import org.sakaiproject.tool.assessment.ui.bean.author.IndexBean; import org.sakaiproject.tool.assessment.ui.bean.author.TemplateBean; @@ -48,7 +48,7 @@ public class EditTemplateListener extends TemplateBaseListener implements ActionListener { - private static Log log = LogFactory.getLog(EditTemplateListener.class); + private static Logger log = LoggerFactory.getLogger(EditTemplateListener.class); /** * Standard processAction. * @param ae diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/EventLogListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/EventLogListener.java index fc20ae59a34a..f8c8d60b7746 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/EventLogListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/EventLogListener.java @@ -12,8 +12,8 @@ import javax.faces.event.ValueChangeListener; import javax.faces.model.SelectItem; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.exception.IdUnusedException; import org.sakaiproject.site.cover.SiteService; import org.sakaiproject.tool.assessment.data.dao.assessment.EventLogData; @@ -29,7 +29,7 @@ public class EventLogListener implements ActionListener, ValueChangeListener { - private static Log log = LogFactory.getLog(EventLogListener.class); + private static Logger log = LoggerFactory.getLogger(EventLogListener.class); private static BeanSort bs; private static String userFilterString = null; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/EventLogNextPageListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/EventLogNextPageListener.java index 4bb2ae47b29a..c82511e7f413 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/EventLogNextPageListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/EventLogNextPageListener.java @@ -11,8 +11,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.facade.AgentFacade; import org.sakaiproject.tool.assessment.facade.AssessmentFacade; import org.sakaiproject.tool.assessment.facade.AssessmentFacadeQueries; @@ -30,7 +30,7 @@ public class EventLogNextPageListener implements ActionListener { - private static Log log = LogFactory.getLog(EventLogNextPageListener.class); + private static Logger log = LoggerFactory.getLogger(EventLogNextPageListener.class); public EventLogNextPageListener() { @@ -58,4 +58,4 @@ public void processAction(ActionEvent ae) eventLog.setHasPreviousPage(Boolean.TRUE); } } -} \ No newline at end of file +} diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/EventLogPreviousPageListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/EventLogPreviousPageListener.java index 25ce05ab8ecd..69d458776ea8 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/EventLogPreviousPageListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/EventLogPreviousPageListener.java @@ -11,8 +11,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.facade.AgentFacade; import org.sakaiproject.tool.assessment.facade.AssessmentFacade; import org.sakaiproject.tool.assessment.facade.AssessmentFacadeQueries; @@ -30,7 +30,7 @@ public class EventLogPreviousPageListener implements ActionListener { - private static Log log = LogFactory.getLog(EventLogPreviousPageListener.class); + private static Logger log = LoggerFactory.getLogger(EventLogPreviousPageListener.class); public EventLogPreviousPageListener() { @@ -58,4 +58,4 @@ public void processAction(ActionEvent ae) eventLog.setHasPreviousPage(Boolean.TRUE); } } -} \ No newline at end of file +} diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ExportAssessmentListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ExportAssessmentListener.java index 8082a3aae6e0..8fffdb81bc05 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ExportAssessmentListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ExportAssessmentListener.java @@ -29,8 +29,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.facade.AgentFacade; import org.sakaiproject.tool.assessment.facade.AssessmentFacade; import org.sakaiproject.tool.assessment.services.assessment.AssessmentService; @@ -48,7 +48,7 @@ public class ExportAssessmentListener implements ActionListener { - private static Log log = LogFactory.getLog(ExportAssessmentListener.class); + private static Logger log = LoggerFactory.getLogger(ExportAssessmentListener.class); public ExportAssessmentListener() { diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ExportItemListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ExportItemListener.java index f6079d7f3ac4..d6cfd466a9f4 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ExportItemListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ExportItemListener.java @@ -27,8 +27,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.ui.bean.qti.XMLController; import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; @@ -42,7 +42,7 @@ public class ExportItemListener implements ActionListener { - private static Log log = LogFactory.getLog(ExportItemListener.class); + private static Logger log = LoggerFactory.getLogger(ExportItemListener.class); private static ContextUtil cu; public ExportItemListener() diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/FavoriteColChoiceListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/FavoriteColChoiceListener.java index b74b77462489..bc3e9da24e10 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/FavoriteColChoiceListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/FavoriteColChoiceListener.java @@ -6,14 +6,14 @@ import javax.faces.event.ActionListener; import javax.faces.event.ValueChangeListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.ui.bean.author.ItemAuthorBean; import org.sakaiproject.tool.assessment.ui.bean.author.ItemBean; import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; public class FavoriteColChoiceListener implements ValueChangeListener { - private static Log log = LogFactory.getLog(FavoriteColChoiceListener.class); + private static Logger log = LoggerFactory.getLogger(FavoriteColChoiceListener.class); public void processValueChange(ValueChangeEvent ae) throws AbortProcessingException { log.debug("FavoriteColChoiceListener: valueChangeLISTENER."); diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ImportAssessmentListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ImportAssessmentListener.java index 46da894caf41..a5954a852cf7 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ImportAssessmentListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ImportAssessmentListener.java @@ -28,8 +28,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.sakaiproject.tool.assessment.facade.AssessmentFacade; @@ -54,7 +54,7 @@ public class ImportAssessmentListener implements ActionListener // This listener doesn't seem to be used by any JSF pages, or called by any java code. - private static Log log = LogFactory.getLog(ImportAssessmentListener.class); + private static Logger log = LoggerFactory.getLogger(ImportAssessmentListener.class); private static final String f = "sample12Assessment.xml"; // private static final String f = "sample12Assessment2.xml"; // private static final String f = "respondus_IMS_QTI_sample12Assessment.xml"; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ItemAddListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ItemAddListener.java index cc1fd31d53cb..00fc0b2d14bc 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ItemAddListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ItemAddListener.java @@ -40,8 +40,8 @@ import javax.faces.event.ActionListener; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.event.cover.EventTrackingService; import org.sakaiproject.tool.assessment.data.dao.assessment.Answer; import org.sakaiproject.tool.assessment.data.dao.assessment.AnswerFeedback; @@ -100,7 +100,7 @@ public class ItemAddListener implements ActionListener { - private static final Log log = LogFactory.getLog(ItemAddListener.class); + private static final Logger log = LoggerFactory.getLogger(ItemAddListener.class); //private static ContextUtil cu; //private String scalename; // used for multiple choice Survey private boolean error = false; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ItemModifyListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ItemModifyListener.java index 2218e26d514f..9c7aa5df9c49 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ItemModifyListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ItemModifyListener.java @@ -37,8 +37,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.ifc.assessment.AnswerFeedbackIfc; import org.sakaiproject.tool.assessment.data.ifc.assessment.AnswerIfc; import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentIfc; @@ -82,7 +82,7 @@ public class ItemModifyListener implements ActionListener { - private static Log log = LogFactory.getLog(ItemModifyListener.class); + private static Logger log = LoggerFactory.getLogger(ItemModifyListener.class); //private String scalename; // used for multiple choice Survey /** diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/PreviewPublishedAssessmentListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/PreviewPublishedAssessmentListener.java index bbf936089aec..c2e5b8538a72 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/PreviewPublishedAssessmentListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/PreviewPublishedAssessmentListener.java @@ -43,7 +43,7 @@ public class PreviewPublishedAssessmentListener implements ActionListener { - //private static Log log = LogFactory.getLog(PreviewPublishedAssessmentListener.class); + //private static Logger log = LoggerFactory.getLogger(PreviewPublishedAssessmentListener.class); public PreviewPublishedAssessmentListener() { diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/PublishAssessmentListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/PublishAssessmentListener.java index 451d8490f901..ac98a1f39ead 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/PublishAssessmentListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/PublishAssessmentListener.java @@ -43,8 +43,8 @@ import javax.mail.internet.AddressException; import javax.mail.internet.InternetAddress; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.integration.helper.ifc.CalendarServiceHelper; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.event.cover.EventTrackingService; @@ -88,7 +88,7 @@ public class PublishAssessmentListener implements ActionListener { - private static Log log = LogFactory.getLog(PublishAssessmentListener.class); + private static Logger log = LoggerFactory.getLogger(PublishAssessmentListener.class); private static final GradebookServiceHelper gbsHelper = IntegrationContextFactory.getInstance().getGradebookServiceHelper(); @@ -214,16 +214,14 @@ private void publish(AssessmentFacade assessment, } catch (AssignmentHasIllegalPointsException gbe) { // Right now gradebook can only accept assessements with totalPoints > 0 // this might change later - log.warn(gbe); - gbe.printStackTrace(); + log.warn(gbe.getMessage(), gbe); // Add a global message (not bound to any component) to the faces context indicating the failure String err=(String)ContextUtil.getLocalizedString("org.sakaiproject.tool.assessment.bundle.AuthorMessages", "gradebook_exception_min_points"); FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(err)); throw new AbortProcessingException(gbe); } catch (Exception e) { - log.warn(e); - e.printStackTrace(); + log.warn(e.getMessage(), e); // Add a global message (not bound to any component) to the faces context indicating the failure String err=(String)ContextUtil.getLocalizedString("org.sakaiproject.tool.assessment.bundle.AuthorMessages", "gradebook_exception_error"); @@ -357,7 +355,7 @@ public String getNotificationMessage(PublishRepublishNotificationBean publishRep siteTitle = site.getTitle(); publishRepublishNotification.setSiteTitle(siteTitle); } catch (IdUnusedException iue) { - log.warn(iue); + log.warn(iue.getMessage()); } } String newline = "
\n"; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/PublishRepublishNotificationListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/PublishRepublishNotificationListener.java index 2d66be07a0e2..471dce7c2872 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/PublishRepublishNotificationListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/PublishRepublishNotificationListener.java @@ -27,8 +27,8 @@ import javax.faces.event.ValueChangeEvent; import javax.faces.event.ValueChangeListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.site.api.Site; import org.sakaiproject.site.cover.SiteService; import org.sakaiproject.tool.assessment.services.assessment.AssessmentService; @@ -48,7 +48,7 @@ */ public class PublishRepublishNotificationListener implements ValueChangeListener { - private static Log log = LogFactory.getLog(PublishRepublishNotificationListener.class); + private static Logger log = LoggerFactory.getLogger(PublishRepublishNotificationListener.class); /** * Standard process action method. diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/RemoveAssessmentListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/RemoveAssessmentListener.java index a7fc9bf4b0c9..4c8e0129393c 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/RemoveAssessmentListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/RemoveAssessmentListener.java @@ -47,7 +47,7 @@ public class RemoveAssessmentListener implements ActionListener { - //private static Log log = LogFactory.getLog(RemoveAssessmentListener.class); + //private static Logger log = LoggerFactory.getLogger(RemoveAssessmentListener.class); public RemoveAssessmentListener() { diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/RemoveAttachmentListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/RemoveAttachmentListener.java index 665d6dca9abc..548a89e18000 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/RemoveAttachmentListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/RemoveAttachmentListener.java @@ -39,7 +39,7 @@ public class RemoveAttachmentListener implements ActionListener { - //private static Log log = LogFactory.getLog(RemoveAttachmentListener.class); + //private static Logger log = LoggerFactory.getLogger(RemoveAttachmentListener.class); public RemoveAttachmentListener() { diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/RemovePartListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/RemovePartListener.java index e39822da371d..c1ce790d4112 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/RemovePartListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/RemovePartListener.java @@ -44,7 +44,7 @@ public class RemovePartListener implements ActionListener { - //private static Log log = LogFactory.getLog(RemovePartListener.class); + //private static Logger log = LoggerFactory.getLogger(RemovePartListener.class); public RemovePartListener() { diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/RemovePublishedAssessmentListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/RemovePublishedAssessmentListener.java index f1205d5e73cd..968e68d41073 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/RemovePublishedAssessmentListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/RemovePublishedAssessmentListener.java @@ -30,8 +30,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.event.cover.EventTrackingService; import org.sakaiproject.service.gradebook.shared.GradebookExternalAssessmentService; import org.sakaiproject.service.gradebook.shared.GradebookService; @@ -58,7 +58,7 @@ public class RemovePublishedAssessmentListener implements ActionListener { - private static Log log = LogFactory.getLog(RemovePublishedAssessmentListener.class); + private static Logger log = LoggerFactory.getLogger(RemovePublishedAssessmentListener.class); private static final GradebookServiceHelper gbsHelper = IntegrationContextFactory.getInstance().getGradebookServiceHelper(); private static final boolean integrated = IntegrationContextFactory.getInstance().isIntegrated(); private CalendarServiceHelper calendarService = IntegrationContextFactory.getInstance().getCalendarServiceHelper(); diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/RemovePublishedAssessmentThread.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/RemovePublishedAssessmentThread.java index b01fd06b8566..15a11790ae9b 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/RemovePublishedAssessmentThread.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/RemovePublishedAssessmentThread.java @@ -22,8 +22,8 @@ package org.sakaiproject.tool.assessment.ui.listener.author; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.services.assessment.PublishedAssessmentService; /** @@ -36,7 +36,7 @@ public class RemovePublishedAssessmentThread extends Thread { - private static Log log = LogFactory.getLog(RemovePublishedAssessmentThread.class); + private static Logger log = LoggerFactory.getLogger(RemovePublishedAssessmentThread.class); private String assessmentId; private String action; public RemovePublishedAssessmentThread(String assessmentId){ diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/RemoveQuestionListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/RemoveQuestionListener.java index 0d6ce5042b69..178161b40cad 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/RemoveQuestionListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/RemoveQuestionListener.java @@ -36,7 +36,7 @@ public class RemoveQuestionListener implements ActionListener { - //private static Log log = LogFactory.getLog(RemoveQuestionListener.class); + //private static Logger log = LoggerFactory.getLogger(RemoveQuestionListener.class); public RemoveQuestionListener() { } diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ReorderPartsListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ReorderPartsListener.java index e34e6b246e62..b4b0e89e99e5 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ReorderPartsListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ReorderPartsListener.java @@ -25,8 +25,8 @@ import javax.faces.event.ValueChangeEvent; import javax.faces.event.ValueChangeListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.dao.assessment.PublishedSectionData; import org.sakaiproject.tool.assessment.facade.AssessmentFacade; import org.sakaiproject.tool.assessment.facade.PublishedAssessmentFacade; @@ -45,7 +45,7 @@ */ public class ReorderPartsListener implements ValueChangeListener { - private static Log log = LogFactory.getLog(ReorderPartsListener.class); + private static Logger log = LoggerFactory.getLogger(ReorderPartsListener.class); /** * Standard process action method. diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ReorderQuestionsListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ReorderQuestionsListener.java index d283f1e4ae93..8fe8742de6e6 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ReorderQuestionsListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ReorderQuestionsListener.java @@ -32,8 +32,8 @@ import javax.faces.event.ValueChangeEvent; import javax.faces.event.ValueChangeListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.facade.AgentFacade; import org.sakaiproject.tool.assessment.facade.AssessmentFacade; import org.sakaiproject.tool.assessment.facade.ItemFacade; @@ -54,7 +54,7 @@ public class ReorderQuestionsListener implements ValueChangeListener { - private static Log log = LogFactory.getLog(ReorderQuestionsListener.class); + private static Logger log = LoggerFactory.getLogger(ReorderQuestionsListener.class); /** * Standard process action method. diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/RepublishAssessmentListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/RepublishAssessmentListener.java index c459da1a55ca..d858c69e969c 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/RepublishAssessmentListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/RepublishAssessmentListener.java @@ -10,8 +10,9 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import lombok.extern.slf4j.Slf4j; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.event.cover.EventTrackingService; import org.sakaiproject.service.gradebook.shared.GradebookExternalAssessmentService; import org.sakaiproject.service.gradebook.shared.GradebookService; @@ -38,10 +39,9 @@ import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; import org.sakaiproject.util.ResourceLoader; +@Slf4j public class RepublishAssessmentListener implements ActionListener { - private static Log log = LogFactory - .getLog(RepublishAssessmentListener.class); private static final GradebookServiceHelper gbsHelper = IntegrationContextFactory.getInstance().getGradebookServiceHelper(); private static final boolean integrated = diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ResetAssessmentAttachmentListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ResetAssessmentAttachmentListener.java index a6db320dea4c..b0544761d1c4 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ResetAssessmentAttachmentListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ResetAssessmentAttachmentListener.java @@ -29,8 +29,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.content.api.ContentResource; import org.sakaiproject.exception.IdUnusedException; import org.sakaiproject.exception.PermissionException; @@ -53,7 +53,7 @@ public class ResetAssessmentAttachmentListener implements ActionListener { - private static Log log = LogFactory.getLog(ResetAssessmentAttachmentListener.class); + private static Logger log = LoggerFactory.getLogger(ResetAssessmentAttachmentListener.class); public ResetAssessmentAttachmentListener() { diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ResetItemAttachmentListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ResetItemAttachmentListener.java index 5dbd89a0a80a..9b4c83524940 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ResetItemAttachmentListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ResetItemAttachmentListener.java @@ -31,8 +31,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.content.api.ContentResource; import org.sakaiproject.exception.IdUnusedException; import org.sakaiproject.exception.PermissionException; @@ -61,7 +61,7 @@ public class ResetItemAttachmentListener implements ActionListener { - private static Log log = LogFactory.getLog(ResetItemAttachmentListener.class); + private static Logger log = LoggerFactory.getLogger(ResetItemAttachmentListener.class); public ResetItemAttachmentListener() { diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ResetPartAttachmentListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ResetPartAttachmentListener.java index c9774399a767..4e20e803be6a 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ResetPartAttachmentListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ResetPartAttachmentListener.java @@ -30,8 +30,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.content.api.ContentResource; import org.sakaiproject.exception.IdUnusedException; import org.sakaiproject.exception.PermissionException; @@ -53,7 +53,7 @@ public class ResetPartAttachmentListener implements ActionListener { - private static Log log = LogFactory.getLog(ResetPartAttachmentListener.class); + private static Logger log = LoggerFactory.getLogger(ResetPartAttachmentListener.class); public ResetPartAttachmentListener() { diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ResetPublishedAssessmentAttachmentListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ResetPublishedAssessmentAttachmentListener.java index a74378cc7b92..9803316c8249 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ResetPublishedAssessmentAttachmentListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/ResetPublishedAssessmentAttachmentListener.java @@ -6,8 +6,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentIfc; import org.sakaiproject.tool.assessment.services.assessment.AssessmentService; import org.sakaiproject.tool.assessment.services.assessment.PublishedAssessmentService; @@ -15,7 +15,7 @@ import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; public class ResetPublishedAssessmentAttachmentListener implements ActionListener { - private static Log log = LogFactory.getLog(ResetPublishedAssessmentAttachmentListener.class); + private static Logger log = LoggerFactory.getLogger(ResetPublishedAssessmentAttachmentListener.class); public ResetPublishedAssessmentAttachmentListener() { } diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SaveAssessmentAttachmentListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SaveAssessmentAttachmentListener.java index 63e08ac773d2..99945cbc82c3 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SaveAssessmentAttachmentListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SaveAssessmentAttachmentListener.java @@ -33,8 +33,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.content.api.FilePickerHelper; import org.sakaiproject.entity.api.Reference; import org.sakaiproject.tool.api.ToolSession; @@ -57,7 +57,7 @@ public class SaveAssessmentAttachmentListener implements ActionListener { - private static Log log = LogFactory.getLog(SaveAssessmentAttachmentListener.class); + private static Logger log = LoggerFactory.getLogger(SaveAssessmentAttachmentListener.class); // this is to indicate which flow // if it is true, that means we save the assessment attachment in setting page of a pending assessment (authorSettings.jsp) diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SaveAssessmentSettings.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SaveAssessmentSettings.java index 6fd5107c4fea..d555bc0be817 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SaveAssessmentSettings.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SaveAssessmentSettings.java @@ -36,8 +36,8 @@ import java.util.TreeMap; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.event.cover.EventTrackingService; import org.sakaiproject.exception.IdUnusedException; import org.sakaiproject.samigo.util.SamigoConstants; @@ -75,7 +75,7 @@ public class SaveAssessmentSettings { - private static final Log LOG = LogFactory.getLog(SaveAssessmentSettings.class); + private static final Logger LOG = LoggerFactory.getLogger(SaveAssessmentSettings.class); private static final String EXTENDED_TIME_KEY = "extendedTime"; @@ -197,7 +197,7 @@ public AssessmentFacade save(AssessmentSettingsBean assessmentSettings, boolean } catch( NumberFormatException ex ) { - LOG.warn( ex ); + LOG.warn(ex.getMessage()); control.setInstructorNotification( SamigoConstants.NOTI_PREF_INSTRUCTOR_EMAIL_DEFAULT ); } } @@ -369,7 +369,7 @@ public AssessmentFacade save(AssessmentSettingsBean assessmentSettings, boolean } catch( NullPointerException | NumberFormatException ex ) { - LOG.warn( ex ); + LOG.warn(ex.getMessage(), ex); control.setInstructorNotification( SamigoConstants.NOTI_PREF_INSTRUCTOR_EMAIL_DEFAULT ); } diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SaveAssessmentSettingsListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SaveAssessmentSettingsListener.java index b7cec87af4bd..10000ef921ff 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SaveAssessmentSettingsListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SaveAssessmentSettingsListener.java @@ -33,8 +33,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.api.SamigoApiFactory; import org.sakaiproject.tool.assessment.data.dao.assessment.AssessmentAccessControl; import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentAccessControlIfc; @@ -58,7 +58,7 @@ public class SaveAssessmentSettingsListener implements ActionListener { - private static Log log = LogFactory.getLog(SaveAssessmentSettingsListener.class); + private static Logger log = LoggerFactory.getLogger(SaveAssessmentSettingsListener.class); //private static final GradebookServiceHelper gbsHelper = IntegrationContextFactory.getInstance().getGradebookServiceHelper(); //private static final boolean integrated = IntegrationContextFactory.getInstance().isIntegrated(); diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SavePartAttachmentListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SavePartAttachmentListener.java index 79dbad7014f4..d18d415d79a6 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SavePartAttachmentListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SavePartAttachmentListener.java @@ -34,8 +34,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentIfc; import org.sakaiproject.tool.assessment.data.ifc.assessment.SectionAttachmentIfc; import org.sakaiproject.tool.assessment.data.ifc.assessment.SectionDataIfc; @@ -60,7 +60,7 @@ public class SavePartAttachmentListener implements ActionListener { - private static Log log = LogFactory.getLog(SavePartAttachmentListener.class); + private static Logger log = LoggerFactory.getLogger(SavePartAttachmentListener.class); //this is to indicate which flow // if it is true, that means we save the section attachment in setting page of a pending assessment (authorSettings.jsp) // if it is false, that means we save the section attachment in setting page of a published assessment (publishedSettings.jsp) diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SavePartListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SavePartListener.java index 59fa00ddab97..c242cc2532bc 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SavePartListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SavePartListener.java @@ -35,8 +35,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.event.cover.EventTrackingService; import org.sakaiproject.tool.assessment.data.ifc.assessment.AnswerIfc; import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentIfc; @@ -74,7 +74,7 @@ public class SavePartListener implements ActionListener { - private static Log log = LogFactory.getLog(SavePartListener.class); + private static Logger log = LoggerFactory.getLogger(SavePartListener.class); private boolean isEditPendingAssessmentFlow; public SavePartListener() diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SavePublishedSettingsListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SavePublishedSettingsListener.java index 4f412d2b5644..7c5e40263b6b 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SavePublishedSettingsListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SavePublishedSettingsListener.java @@ -36,8 +36,8 @@ import javax.faces.event.ActionListener; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.event.cover.EventTrackingService; import org.sakaiproject.samigo.util.SamigoConstants; @@ -87,7 +87,7 @@ public class SavePublishedSettingsListener implements ActionListener { - private static final Log LOG = LogFactory.getLog(SavePublishedSettingsListener.class); + private static final Logger LOG = LoggerFactory.getLogger(SavePublishedSettingsListener.class); private static final GradebookServiceHelper gbsHelper = IntegrationContextFactory.getInstance().getGradebookServiceHelper(); private static final boolean integrated = @@ -195,7 +195,7 @@ public void processAction(ActionEvent ae) throws AbortProcessingException } catch( NullPointerException | NumberFormatException ex ) { - LOG.warn( ex ); + LOG.warn(ex.getMessage(), ex); assessment.setInstructorNotification( SamigoConstants.NOTI_PREF_INSTRUCTOR_EMAIL_DEFAULT ); } @@ -524,7 +524,7 @@ else if (assessmentSettings.getRetractDate() == null } catch( NumberFormatException ex ) { - LOG.warn( ex ); + LOG.warn(ex.getMessage(), ex); assessment.setInstructorNotification( SamigoConstants.NOTI_PREF_INSTRUCTOR_EMAIL_DEFAULT ); } } diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SectionActivityListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SectionActivityListener.java index 825aaf67e1e8..6ecb001a2e02 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SectionActivityListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SectionActivityListener.java @@ -20,8 +20,8 @@ import javax.faces.event.ValueChangeListener; import javax.faces.model.SelectItem; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.dao.assessment.PublishedAssessmentData; import org.sakaiproject.tool.assessment.data.dao.grading.AssessmentGradingData; @@ -44,7 +44,7 @@ public class SectionActivityListener implements ActionListener, ValueChangeListener { - private static Log log = LogFactory.getLog(SectionActivityListener.class); + private static Logger log = LoggerFactory.getLogger(SectionActivityListener.class); private static BeanSort bs; public SectionActivityListener() @@ -319,4 +319,4 @@ public String getRoundedMaxScore() { return "0"; } } -} \ No newline at end of file +} diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SortCoreAssessmentListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SortCoreAssessmentListener.java index d2d22f423407..ce36c6722624 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SortCoreAssessmentListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SortCoreAssessmentListener.java @@ -30,8 +30,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.facade.AssessmentFacade; import org.sakaiproject.tool.assessment.facade.AssessmentFacadeQueries; import org.sakaiproject.tool.assessment.services.assessment.AssessmentService; @@ -46,7 +46,7 @@ public class SortCoreAssessmentListener implements ActionListener { - private static Log log = LogFactory.getLog(SortCoreAssessmentListener.class); + private static Logger log = LoggerFactory.getLogger(SortCoreAssessmentListener.class); public SortCoreAssessmentListener() { diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SortInactivePublishedAssessmentListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SortInactivePublishedAssessmentListener.java index 9146ac3f2379..e1548ce16b74 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SortInactivePublishedAssessmentListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SortInactivePublishedAssessmentListener.java @@ -30,8 +30,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.facade.AgentFacade; import org.sakaiproject.tool.assessment.facade.PublishedAssessmentFacade; import org.sakaiproject.tool.assessment.facade.PublishedAssessmentFacadeQueries; @@ -47,7 +47,7 @@ public class SortInactivePublishedAssessmentListener implements ActionListener { - private static Log log = LogFactory.getLog(SortInactivePublishedAssessmentListener.class); + private static Logger log = LoggerFactory.getLogger(SortInactivePublishedAssessmentListener.class); public SortInactivePublishedAssessmentListener() { diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SortPublishedAssessmentListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SortPublishedAssessmentListener.java index 69d68a0d319f..7f085c42be6f 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SortPublishedAssessmentListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/SortPublishedAssessmentListener.java @@ -30,8 +30,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.facade.AgentFacade; import org.sakaiproject.tool.assessment.facade.PublishedAssessmentFacade; import org.sakaiproject.tool.assessment.facade.PublishedAssessmentFacadeQueries; @@ -47,7 +47,7 @@ public class SortPublishedAssessmentListener implements ActionListener { - private static Log log = LogFactory.getLog(SortPublishedAssessmentListener.class); + private static Logger log = LoggerFactory.getLogger(SortPublishedAssessmentListener.class); public SortPublishedAssessmentListener() { diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/StartCreateItemListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/StartCreateItemListener.java index 1702135b5da7..e42a3060f1fd 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/StartCreateItemListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/StartCreateItemListener.java @@ -32,8 +32,8 @@ import javax.faces.event.ValueChangeEvent; import javax.faces.event.ValueChangeListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.api.ToolSession; import org.sakaiproject.tool.assessment.facade.AssessmentFacade; import org.sakaiproject.tool.assessment.services.assessment.AssessmentService; @@ -57,7 +57,7 @@ public class StartCreateItemListener implements ValueChangeListener, ActionListener { - private static Log log = LogFactory.getLog(StartCreateItemListener.class); + private static Logger log = LoggerFactory.getLogger(StartCreateItemListener.class); //private static ContextUtil cu; //private String scalename; // used for multiple choice Survey diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/StartInsertItemListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/StartInsertItemListener.java index 07517d023e83..e6b841e2820d 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/StartInsertItemListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/StartInsertItemListener.java @@ -27,8 +27,8 @@ import javax.faces.event.ValueChangeEvent; import javax.faces.event.ValueChangeListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.ui.bean.author.ItemAuthorBean; import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; import javax.faces.component.UIComponent; @@ -45,7 +45,7 @@ public class StartInsertItemListener implements ValueChangeListener { - private static Log log = LogFactory.getLog(StartInsertItemListener.class); + private static Logger log = LoggerFactory.getLogger(StartInsertItemListener.class); /** diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/TemplateBaseListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/TemplateBaseListener.java index b5d2687920bc..d225b6682850 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/TemplateBaseListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/TemplateBaseListener.java @@ -48,7 +48,7 @@ public abstract class TemplateBaseListener implements ActionListener { // forces you to implement your own processAction abstract public void processAction(ActionEvent parm1) throws javax.faces.event.AbortProcessingException; - //private static Log log = LogFactory.getLog(TemplateBaseListener.class); + //private static Logger log = LoggerFactory.getLogger(TemplateBaseListener.class); /** * Get a template from the template id diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/TemplateListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/TemplateListener.java index 1377277b0b04..da2b2a6657a0 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/TemplateListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/TemplateListener.java @@ -32,8 +32,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.facade.AssessmentTemplateFacade; import org.sakaiproject.tool.assessment.services.assessment.AssessmentService; import org.sakaiproject.tool.assessment.ui.bean.author.IndexBean; @@ -49,7 +49,7 @@ public class TemplateListener extends TemplateBaseListener implements ActionListener { - private static Log log = LogFactory.getLog(TemplateListener.class); + private static Logger log = LoggerFactory.getLogger(TemplateListener.class); private static BeanSort bs; public TemplateListener() diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/TemplateLoadListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/TemplateLoadListener.java index 48873e3052df..0ba93e40a4b4 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/TemplateLoadListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/TemplateLoadListener.java @@ -30,8 +30,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.dao.assessment.AssessmentAccessControl; import org.sakaiproject.tool.assessment.data.dao.assessment.AssessmentFeedback; import org.sakaiproject.tool.assessment.data.dao.assessment.EvaluationModel; @@ -56,7 +56,7 @@ public class TemplateLoadListener extends TemplateBaseListener implements ActionListener { - private static Log log = LogFactory.getLog(TemplateLoadListener.class); + private static Logger log = LoggerFactory.getLogger(TemplateLoadListener.class); static private ContextUtil cu; /** * Normal listener method. diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/TemplateUpdateListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/TemplateUpdateListener.java index 8f99a366e830..585b73211a46 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/TemplateUpdateListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/TemplateUpdateListener.java @@ -35,8 +35,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.samigo.util.SamigoConstants; import org.sakaiproject.tool.assessment.data.dao.assessment.AssessmentAccessControl; import org.sakaiproject.tool.assessment.data.dao.assessment.AssessmentFeedback; @@ -69,7 +69,7 @@ public class TemplateUpdateListener extends TemplateBaseListener implements ActionListener { - private static final Log LOG = LogFactory.getLog(TemplateUpdateListener.class); + private static final Logger LOG = LoggerFactory.getLogger(TemplateUpdateListener.class); /** * Normal listener method. @@ -243,7 +243,7 @@ public boolean updateAssessment(TemplateBean templateBean) } catch( NullPointerException | NumberFormatException ex ) { - LOG.warn( ex ); + LOG.warn(ex.getMessage()); aac.setInstructorNotification( SamigoConstants.NOTI_PREF_INSTRUCTOR_EMAIL_DEFAULT ); } diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/AudioUploadActionListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/AudioUploadActionListener.java index dd4e74117026..77c3a420fb08 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/AudioUploadActionListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/AudioUploadActionListener.java @@ -29,8 +29,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.ui.bean.delivery.DeliveryBean; import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; @@ -54,7 +54,7 @@ public class AudioUploadActionListener implements ActionListener { - private static Log log = LogFactory.getLog(AudioUploadActionListener.class); + private static Logger log = LoggerFactory.getLogger(AudioUploadActionListener.class); private static ContextUtil cu; /** diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/BeginDeliveryActionListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/BeginDeliveryActionListener.java index 8d641c723e14..054989785446 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/BeginDeliveryActionListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/BeginDeliveryActionListener.java @@ -39,8 +39,8 @@ import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.tool.assessment.data.dao.assessment.AssessmentAccessControl; @@ -84,7 +84,7 @@ public class BeginDeliveryActionListener implements ActionListener { - private static Log log = LogFactory.getLog(BeginDeliveryActionListener.class); + private static Logger log = LoggerFactory.getLogger(BeginDeliveryActionListener.class); /** * ACTION. @@ -509,7 +509,7 @@ private PublishedAssessmentFacade getPublishedAssessmentBasedOnAction(int action thread.start(); } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); } }else{ FacesContext context = FacesContext.getCurrentInstance(); diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/DeliveryActionListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/DeliveryActionListener.java index 7ead9d955cfb..a9e236df534e 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/DeliveryActionListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/DeliveryActionListener.java @@ -44,8 +44,8 @@ import javax.faces.model.SelectItem; import javax.servlet.http.HttpServletRequest; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.math.util.MathUtils; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.component.cover.ServerConfigurationService; @@ -120,7 +120,7 @@ public class DeliveryActionListener { static String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - private static Log log = LogFactory.getLog(DeliveryActionListener.class); + private static Logger log = LoggerFactory.getLogger(DeliveryActionListener.class); //private static ContextUtil cu; private boolean resetPageContents = true; private long previewGradingId = (long)(Math.random() * 1000); diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/LinearAccessDeliveryActionListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/LinearAccessDeliveryActionListener.java index 0e4d200a4d0f..d816a0fdc191 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/LinearAccessDeliveryActionListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/LinearAccessDeliveryActionListener.java @@ -1,8 +1,8 @@ -/********************************************************************************** - * $URL$ - * $Id$ - *********************************************************************************** - * +/********************************************************************************** + * $URL$ + * $Id$ + *********************************************************************************** + * * Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009 The Sakai Foundation * * Licensed under the Educational Community License, Version 2.0 (the "License"); @@ -16,100 +16,100 @@ * 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.sakaiproject.tool.assessment.ui.listener.delivery; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.ResourceBundle; - -import javax.faces.context.FacesContext; -import javax.faces.event.AbortProcessingException; -import javax.faces.event.ActionEvent; -import javax.faces.event.ActionListener; -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.sakaiproject.component.cover.ComponentManager; -import org.sakaiproject.event.api.Event; -import org.sakaiproject.event.api.LearningResourceStoreService; -import org.sakaiproject.event.cover.EventTrackingService; -import org.sakaiproject.event.cover.NotificationService; -import org.sakaiproject.tool.assessment.api.SamigoApiFactory; -import org.sakaiproject.tool.assessment.data.dao.assessment.EventLogData; -import org.sakaiproject.tool.assessment.data.dao.grading.AssessmentGradingData; -import org.sakaiproject.tool.assessment.facade.AgentFacade; -import org.sakaiproject.tool.assessment.facade.EventLogFacade; -import org.sakaiproject.tool.assessment.facade.PublishedAssessmentFacade; -import org.sakaiproject.tool.assessment.services.GradingService; -import org.sakaiproject.tool.assessment.services.assessment.EventLogService; -import org.sakaiproject.tool.assessment.services.assessment.PublishedAssessmentService; -import org.sakaiproject.tool.assessment.shared.api.assessment.SecureDeliveryServiceAPI; -import org.sakaiproject.tool.assessment.shared.api.assessment.SecureDeliveryServiceAPI.Phase; -import org.sakaiproject.tool.assessment.shared.api.assessment.SecureDeliveryServiceAPI.PhaseStatus; -import org.sakaiproject.tool.assessment.ui.bean.delivery.DeliveryBean; -import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; -import org.sakaiproject.tool.assessment.ui.web.session.SessionUtil; - - -public class LinearAccessDeliveryActionListener extends DeliveryActionListener - implements ActionListener -{ - private static Log log = LogFactory.getLog(LinearAccessDeliveryActionListener.class); - private static ResourceBundle eventLogMessages = ResourceBundle.getBundle("org.sakaiproject.tool.assessment.bundle.EventLogMessages"); - - - /** - * ACTION. - * @param ae - * @throws AbortProcessingException - */ - public void processAction(ActionEvent ae) throws - AbortProcessingException - { - log.debug("LinearAccessDeliveryActionListener.processAction() "); - // get managed bean - DeliveryBean delivery = (DeliveryBean) ContextUtil.lookupBean("delivery"); - // set publishedId, note that id can be changed by isPreviewingMode() - String id = getPublishedAssessmentId(delivery); - String agent = getAgentString(); - - // Clear elapsed time, set not timed out - clearElapsedTime(delivery); - - // get assessment from deliveryBean if id matches. otherwise, this is the 1st time - // that DeliveryActionListener is called, so pull it from DB - PublishedAssessmentFacade publishedAssessment = getPublishedAssessment(delivery, id); - PublishedAssessmentService pubService = new PublishedAssessmentService(); - // set show student score - setShowStudentScore(delivery, publishedAssessment); - setShowStudentQuestionScore(delivery, publishedAssessment); - setDeliverySettings(delivery, publishedAssessment); - - if (ae != null && ae.getComponent().getId().startsWith("beginAssessment")) { - // #1. check password - if (!delivery.getSettings().getPassword().equals("")) - { - if ("passwordAccessError".equals(delivery.validatePassword())) { - return; - } - } - - // #2. check IP - if (delivery.getSettings().getIpAddresses() != null && !delivery.getSettings().getIpAddresses().isEmpty()) - { - if ("ipAccessError".equals(delivery.validateIP())) { - return; - } + * + **********************************************************************************/ + + + +package org.sakaiproject.tool.assessment.ui.listener.delivery; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.ResourceBundle; + +import javax.faces.context.FacesContext; +import javax.faces.event.AbortProcessingException; +import javax.faces.event.ActionEvent; +import javax.faces.event.ActionListener; +import javax.servlet.http.HttpServletRequest; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.sakaiproject.component.cover.ComponentManager; +import org.sakaiproject.event.api.Event; +import org.sakaiproject.event.api.LearningResourceStoreService; +import org.sakaiproject.event.cover.EventTrackingService; +import org.sakaiproject.event.cover.NotificationService; +import org.sakaiproject.tool.assessment.api.SamigoApiFactory; +import org.sakaiproject.tool.assessment.data.dao.assessment.EventLogData; +import org.sakaiproject.tool.assessment.data.dao.grading.AssessmentGradingData; +import org.sakaiproject.tool.assessment.facade.AgentFacade; +import org.sakaiproject.tool.assessment.facade.EventLogFacade; +import org.sakaiproject.tool.assessment.facade.PublishedAssessmentFacade; +import org.sakaiproject.tool.assessment.services.GradingService; +import org.sakaiproject.tool.assessment.services.assessment.EventLogService; +import org.sakaiproject.tool.assessment.services.assessment.PublishedAssessmentService; +import org.sakaiproject.tool.assessment.shared.api.assessment.SecureDeliveryServiceAPI; +import org.sakaiproject.tool.assessment.shared.api.assessment.SecureDeliveryServiceAPI.Phase; +import org.sakaiproject.tool.assessment.shared.api.assessment.SecureDeliveryServiceAPI.PhaseStatus; +import org.sakaiproject.tool.assessment.ui.bean.delivery.DeliveryBean; +import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; +import org.sakaiproject.tool.assessment.ui.web.session.SessionUtil; + + +public class LinearAccessDeliveryActionListener extends DeliveryActionListener + implements ActionListener +{ + private static Logger log = LoggerFactory.getLogger(LinearAccessDeliveryActionListener.class); + private static ResourceBundle eventLogMessages = ResourceBundle.getBundle("org.sakaiproject.tool.assessment.bundle.EventLogMessages"); + + + /** + * ACTION. + * @param ae + * @throws AbortProcessingException + */ + public void processAction(ActionEvent ae) throws + AbortProcessingException + { + log.debug("LinearAccessDeliveryActionListener.processAction() "); + // get managed bean + DeliveryBean delivery = (DeliveryBean) ContextUtil.lookupBean("delivery"); + // set publishedId, note that id can be changed by isPreviewingMode() + String id = getPublishedAssessmentId(delivery); + String agent = getAgentString(); + + // Clear elapsed time, set not timed out + clearElapsedTime(delivery); + + // get assessment from deliveryBean if id matches. otherwise, this is the 1st time + // that DeliveryActionListener is called, so pull it from DB + PublishedAssessmentFacade publishedAssessment = getPublishedAssessment(delivery, id); + PublishedAssessmentService pubService = new PublishedAssessmentService(); + // set show student score + setShowStudentScore(delivery, publishedAssessment); + setShowStudentQuestionScore(delivery, publishedAssessment); + setDeliverySettings(delivery, publishedAssessment); + + if (ae != null && ae.getComponent().getId().startsWith("beginAssessment")) { + // #1. check password + if (!delivery.getSettings().getPassword().equals("")) + { + if ("passwordAccessError".equals(delivery.validatePassword())) { + return; + } + } + + // #2. check IP + if (delivery.getSettings().getIpAddresses() != null && !delivery.getSettings().getIpAddresses().isEmpty()) + { + if ("ipAccessError".equals(delivery.validateIP())) { + return; + } } - + // #3. secure delivery START phase SecureDeliveryServiceAPI secureDelivery = SamigoApiFactory.getInstance().getSecureDeliveryServiceAPI(); if ( secureDelivery.isSecureDeliveryAvaliable() ) { @@ -122,187 +122,187 @@ public void processAction(ActionEvent ae) throws } } } - } - - super.populateSubmissionsRemaining(pubService, publishedAssessment, delivery); - - // itemGradingHash will end up with - // (Long publishedItemId, ArrayList itemGradingDatas) and - // (String "sequence"+itemId, Integer sequence) and - // (String "items", Long itemscount) - GradingService service = new GradingService(); - AssessmentGradingData ag = null; - - // this returns a HashMap with (publishedItemId, itemGrading) - HashMap itemGradingHash = service.getLastItemGradingData(id, agent); - - boolean isFirstTimeBegin = false; - if (itemGradingHash!=null && itemGradingHash.size()>0){ - log.debug("itemGradingHash!=null && itemGradingHash.size()>0"); - ag = setAssessmentGradingFromItemData(delivery, itemGradingHash, true); - setAttemptDateIfNull(ag); - } - else{ - ag = service.getLastSavedAssessmentGradingByAgentId(id, agent); - if (ag == null) { - ag = createAssessmentGrading(publishedAssessment); - isFirstTimeBegin = true; - } - else { - setAttemptDateIfNull(ag); - } - } - delivery.setAssessmentGrading(ag); - - log.debug("itemgrading size = " + ag.getItemGradingSet().size()); - delivery.setAssessmentGradingId(delivery.getAssessmentGrading().getAssessmentGradingId()); - - //ag can't be null beyond this point and must have persisted to DB - // version 2.1.1 requirement - setFeedbackMode(delivery); - if (ae != null && ae.getComponent().getId().startsWith("beginAssessment")) { - setTimer(delivery, publishedAssessment, true, isFirstTimeBegin); - setStatus(delivery, pubService, Long.valueOf(id)); - // If it comes from Begin Assessment button clicks, reset isNoQuestion to false - // because we want to always display the first page - // Otherwise, if isNoQuestion set to true in the last delivery and - // if the first part has no question, it will not be rendered - // See getPageContentsByQuestion() for more details - // Of course it is better to do this inside getPageContentsByQuestion() - // However, ae is not passed in getPageContentsByQuestion() - // and there are multiple places to modify if I want to get ae inside getPageContentsByQuestion() - delivery.setNoQuestions(false); - // ONC event log - EventLogService eventService = new EventLogService(); - EventLogFacade eventLogFacade = new EventLogFacade(); - String agentEid = AgentFacade.getEid(); - //set event log data - EventLogData eventLogData = new EventLogData(); - eventLogData.setAssessmentId(Long.valueOf(id)); - eventLogData.setProcessId(delivery.getAssessmentGradingId()); - eventLogData.setStartDate(new Date()); - eventLogData.setTitle(publishedAssessment.getTitle()); - eventLogData.setUserEid(agentEid); - String site_id= AgentFacade.getCurrentSiteId(); - if(site_id == null) { - //take assessment via url - PublishedAssessmentService publishedAssessmentService = new PublishedAssessmentService(); - site_id = publishedAssessmentService.getPublishedAssessmentOwner(Long.valueOf(delivery.getAssessmentId())); - } - eventLogData.setSiteId(site_id); - - eventLogData.setErrorMsg(eventLogMessages.getString("no_submission")); - eventLogData.setEndDate(null); - eventLogData.setEclipseTime(null); - - eventLogFacade.setData(eventLogData); - eventService.saveOrUpdateEventLog(eventLogFacade); - int action = delivery.getActionMode(); - if (action == DeliveryBean.TAKE_ASSESSMENT) { - StringBuffer eventRef = new StringBuffer("publishedAssessmentId"); - eventRef.append(delivery.getAssessmentId()); - eventRef.append(", agentId="); - eventRef.append(getAgentString()); - if (delivery.isTimeRunning()) { - eventRef.append(", elapsed="); - eventRef.append(delivery.getTimeElapse()); - eventRef.append(", remaining="); - int timeRemaining = Integer.parseInt(delivery.getTimeLimit()) - Integer.parseInt(delivery.getTimeElapse()); - eventRef.append(timeRemaining); - } - Event event = EventTrackingService.newEvent("sam.assessment.take", eventRef.toString(), true); - EventTrackingService.post(event); - registerIrss(delivery, event, false); - } - else if (action == DeliveryBean.TAKE_ASSESSMENT_VIA_URL) { - StringBuffer eventRef = new StringBuffer("publishedAssessmentId"); - eventRef.append(delivery.getAssessmentId()); - eventRef.append(", agentId="); - eventRef.append(getAgentString()); - if (delivery.isTimeRunning()) { - eventRef.append(", elapsed="); - eventRef.append(delivery.getTimeElapse()); - eventRef.append(", remaining="); - int timeRemaining = Integer.parseInt(delivery.getTimeLimit()) - Integer.parseInt(delivery.getTimeElapse()); - eventRef.append(timeRemaining); - } - PublishedAssessmentService publishedAssessmentService = new PublishedAssessmentService(); - String siteId = publishedAssessmentService.getPublishedAssessmentOwner(Long.valueOf(delivery.getAssessmentId())); - Event event = EventTrackingService.newEvent("sam.assessment.take", eventRef.toString(), siteId, true, NotificationService.NOTI_REQUIRED); - EventTrackingService.post(event); - registerIrss(delivery, event, true); - } - } - else { - setTimer(delivery, publishedAssessment, false, false); - } - - // extend session time out - SessionUtil.setSessionTimeout(FacesContext.getCurrentInstance(), delivery, true); - log.debug("Set begin time " + delivery.getBeginTime()); - log.debug("Set elapsed time " + delivery.getTimeElapse()); - - // overload itemGradingHash with the sequence in case renumbering is turned off. - overloadItemData(delivery, itemGradingHash, publishedAssessment); - - // get the position of last question which has ben answered/viewed by the student - log.debug("before partIndex = " + delivery.getPartIndex()); - log.debug("before questionIndex = " + delivery.getQuestionIndex()); - setPosition(delivery, publishedAssessment, ae); - log.debug("after partIndex = " + delivery.getPartIndex()); - log.debug("after questionIndex = " + delivery.getQuestionIndex()); - - HashMap publishedAnswerHash = pubService.preparePublishedAnswerHash(publishedAssessment); - - if(itemGradingHash != null) { - delivery.setTableOfContents(getContents(publishedAssessment, itemGradingHash,delivery, publishedAnswerHash)); - } - // get current page contents - delivery.setPageContents(getPageContents(publishedAssessment, delivery, itemGradingHash, publishedAnswerHash)); - } - - private void setPosition(DeliveryBean delivery, PublishedAssessmentFacade publishedAssessment, ActionEvent ae) { - GradingService gradingService = new GradingService(); - if (ae != null && ae.getComponent().getId().startsWith("beginAssessment")) { - if (delivery.getNumberRetake() == -1 || delivery.getActualNumberRetake() == -1) { - delivery.setNumberRetake(gradingService.getNumberRetake(publishedAssessment.getPublishedAssessmentId(), AgentFacade.getAgentString())); - log.debug("numberRetake = " + delivery.getNumberRetake()); - delivery.setActualNumberRetake(gradingService.getActualNumberRetake(publishedAssessment.getPublishedAssessmentId(), AgentFacade.getAgentString())); - log.debug("actualNumberRetake =" + delivery.getActualNumberRetake()); - } - - if (delivery.getActualNumberRetake() == delivery.getNumberRetake() - 1) { - delivery.setPartIndex(0); - delivery.setQuestionIndex(0); - return; - } - } - - AssessmentGradingData assessmentGradingData = delivery.getAssessmentGrading(); - log.debug("assessmentGradingData.getAssessmentGradingId() = " + assessmentGradingData.getAssessmentGradingId()); - if (assessmentGradingData.getLastVisitedPart() != null && assessmentGradingData.getLastVisitedQuestion() != null) { - delivery.setPartIndex(assessmentGradingData.getLastVisitedPart().intValue()); - delivery.setQuestionIndex(assessmentGradingData.getLastVisitedQuestion().intValue()); - } - else { - // For backward compatible - ArrayList alist = gradingService.getLastItemGradingDataPosition(assessmentGradingData.getAssessmentGradingId(), assessmentGradingData.getAgentId()); - int partIndex = ((Integer)alist.get(0)).intValue(); - if (partIndex == 0) { - delivery.setPartIndex(0); - } - else { - delivery.setPartIndex(partIndex - 1); - } - delivery.setQuestionIndex(((Integer)alist.get(1)).intValue()); - } - } - - public void saveLastVisitedPosition(DeliveryBean delivery, int partNumber, int questionNumber) { - GradingService gradingService = new GradingService(); - AssessmentGradingData assessmentGradingData = delivery.getAssessmentGrading(); - assessmentGradingData.setLastVisitedPart(partNumber); - assessmentGradingData.setLastVisitedQuestion(questionNumber); - gradingService.saveOrUpdateAssessmentGradingOnly(assessmentGradingData); - } -} + } + + super.populateSubmissionsRemaining(pubService, publishedAssessment, delivery); + + // itemGradingHash will end up with + // (Long publishedItemId, ArrayList itemGradingDatas) and + // (String "sequence"+itemId, Integer sequence) and + // (String "items", Long itemscount) + GradingService service = new GradingService(); + AssessmentGradingData ag = null; + + // this returns a HashMap with (publishedItemId, itemGrading) + HashMap itemGradingHash = service.getLastItemGradingData(id, agent); + + boolean isFirstTimeBegin = false; + if (itemGradingHash!=null && itemGradingHash.size()>0){ + log.debug("itemGradingHash!=null && itemGradingHash.size()>0"); + ag = setAssessmentGradingFromItemData(delivery, itemGradingHash, true); + setAttemptDateIfNull(ag); + } + else{ + ag = service.getLastSavedAssessmentGradingByAgentId(id, agent); + if (ag == null) { + ag = createAssessmentGrading(publishedAssessment); + isFirstTimeBegin = true; + } + else { + setAttemptDateIfNull(ag); + } + } + delivery.setAssessmentGrading(ag); + + log.debug("itemgrading size = " + ag.getItemGradingSet().size()); + delivery.setAssessmentGradingId(delivery.getAssessmentGrading().getAssessmentGradingId()); + + //ag can't be null beyond this point and must have persisted to DB + // version 2.1.1 requirement + setFeedbackMode(delivery); + if (ae != null && ae.getComponent().getId().startsWith("beginAssessment")) { + setTimer(delivery, publishedAssessment, true, isFirstTimeBegin); + setStatus(delivery, pubService, Long.valueOf(id)); + // If it comes from Begin Assessment button clicks, reset isNoQuestion to false + // because we want to always display the first page + // Otherwise, if isNoQuestion set to true in the last delivery and + // if the first part has no question, it will not be rendered + // See getPageContentsByQuestion() for more details + // Of course it is better to do this inside getPageContentsByQuestion() + // However, ae is not passed in getPageContentsByQuestion() + // and there are multiple places to modify if I want to get ae inside getPageContentsByQuestion() + delivery.setNoQuestions(false); + // ONC event log + EventLogService eventService = new EventLogService(); + EventLogFacade eventLogFacade = new EventLogFacade(); + String agentEid = AgentFacade.getEid(); + //set event log data + EventLogData eventLogData = new EventLogData(); + eventLogData.setAssessmentId(Long.valueOf(id)); + eventLogData.setProcessId(delivery.getAssessmentGradingId()); + eventLogData.setStartDate(new Date()); + eventLogData.setTitle(publishedAssessment.getTitle()); + eventLogData.setUserEid(agentEid); + String site_id= AgentFacade.getCurrentSiteId(); + if(site_id == null) { + //take assessment via url + PublishedAssessmentService publishedAssessmentService = new PublishedAssessmentService(); + site_id = publishedAssessmentService.getPublishedAssessmentOwner(Long.valueOf(delivery.getAssessmentId())); + } + eventLogData.setSiteId(site_id); + + eventLogData.setErrorMsg(eventLogMessages.getString("no_submission")); + eventLogData.setEndDate(null); + eventLogData.setEclipseTime(null); + + eventLogFacade.setData(eventLogData); + eventService.saveOrUpdateEventLog(eventLogFacade); + int action = delivery.getActionMode(); + if (action == DeliveryBean.TAKE_ASSESSMENT) { + StringBuffer eventRef = new StringBuffer("publishedAssessmentId"); + eventRef.append(delivery.getAssessmentId()); + eventRef.append(", agentId="); + eventRef.append(getAgentString()); + if (delivery.isTimeRunning()) { + eventRef.append(", elapsed="); + eventRef.append(delivery.getTimeElapse()); + eventRef.append(", remaining="); + int timeRemaining = Integer.parseInt(delivery.getTimeLimit()) - Integer.parseInt(delivery.getTimeElapse()); + eventRef.append(timeRemaining); + } + Event event = EventTrackingService.newEvent("sam.assessment.take", eventRef.toString(), true); + EventTrackingService.post(event); + registerIrss(delivery, event, false); + } + else if (action == DeliveryBean.TAKE_ASSESSMENT_VIA_URL) { + StringBuffer eventRef = new StringBuffer("publishedAssessmentId"); + eventRef.append(delivery.getAssessmentId()); + eventRef.append(", agentId="); + eventRef.append(getAgentString()); + if (delivery.isTimeRunning()) { + eventRef.append(", elapsed="); + eventRef.append(delivery.getTimeElapse()); + eventRef.append(", remaining="); + int timeRemaining = Integer.parseInt(delivery.getTimeLimit()) - Integer.parseInt(delivery.getTimeElapse()); + eventRef.append(timeRemaining); + } + PublishedAssessmentService publishedAssessmentService = new PublishedAssessmentService(); + String siteId = publishedAssessmentService.getPublishedAssessmentOwner(Long.valueOf(delivery.getAssessmentId())); + Event event = EventTrackingService.newEvent("sam.assessment.take", eventRef.toString(), siteId, true, NotificationService.NOTI_REQUIRED); + EventTrackingService.post(event); + registerIrss(delivery, event, true); + } + } + else { + setTimer(delivery, publishedAssessment, false, false); + } + + // extend session time out + SessionUtil.setSessionTimeout(FacesContext.getCurrentInstance(), delivery, true); + log.debug("Set begin time " + delivery.getBeginTime()); + log.debug("Set elapsed time " + delivery.getTimeElapse()); + + // overload itemGradingHash with the sequence in case renumbering is turned off. + overloadItemData(delivery, itemGradingHash, publishedAssessment); + + // get the position of last question which has ben answered/viewed by the student + log.debug("before partIndex = " + delivery.getPartIndex()); + log.debug("before questionIndex = " + delivery.getQuestionIndex()); + setPosition(delivery, publishedAssessment, ae); + log.debug("after partIndex = " + delivery.getPartIndex()); + log.debug("after questionIndex = " + delivery.getQuestionIndex()); + + HashMap publishedAnswerHash = pubService.preparePublishedAnswerHash(publishedAssessment); + + if(itemGradingHash != null) { + delivery.setTableOfContents(getContents(publishedAssessment, itemGradingHash,delivery, publishedAnswerHash)); + } + // get current page contents + delivery.setPageContents(getPageContents(publishedAssessment, delivery, itemGradingHash, publishedAnswerHash)); + } + + private void setPosition(DeliveryBean delivery, PublishedAssessmentFacade publishedAssessment, ActionEvent ae) { + GradingService gradingService = new GradingService(); + if (ae != null && ae.getComponent().getId().startsWith("beginAssessment")) { + if (delivery.getNumberRetake() == -1 || delivery.getActualNumberRetake() == -1) { + delivery.setNumberRetake(gradingService.getNumberRetake(publishedAssessment.getPublishedAssessmentId(), AgentFacade.getAgentString())); + log.debug("numberRetake = " + delivery.getNumberRetake()); + delivery.setActualNumberRetake(gradingService.getActualNumberRetake(publishedAssessment.getPublishedAssessmentId(), AgentFacade.getAgentString())); + log.debug("actualNumberRetake =" + delivery.getActualNumberRetake()); + } + + if (delivery.getActualNumberRetake() == delivery.getNumberRetake() - 1) { + delivery.setPartIndex(0); + delivery.setQuestionIndex(0); + return; + } + } + + AssessmentGradingData assessmentGradingData = delivery.getAssessmentGrading(); + log.debug("assessmentGradingData.getAssessmentGradingId() = " + assessmentGradingData.getAssessmentGradingId()); + if (assessmentGradingData.getLastVisitedPart() != null && assessmentGradingData.getLastVisitedQuestion() != null) { + delivery.setPartIndex(assessmentGradingData.getLastVisitedPart().intValue()); + delivery.setQuestionIndex(assessmentGradingData.getLastVisitedQuestion().intValue()); + } + else { + // For backward compatible + ArrayList alist = gradingService.getLastItemGradingDataPosition(assessmentGradingData.getAssessmentGradingId(), assessmentGradingData.getAgentId()); + int partIndex = ((Integer)alist.get(0)).intValue(); + if (partIndex == 0) { + delivery.setPartIndex(0); + } + else { + delivery.setPartIndex(partIndex - 1); + } + delivery.setQuestionIndex(((Integer)alist.get(1)).intValue()); + } + } + + public void saveLastVisitedPosition(DeliveryBean delivery, int partNumber, int questionNumber) { + GradingService gradingService = new GradingService(); + AssessmentGradingData assessmentGradingData = delivery.getAssessmentGrading(); + assessmentGradingData.setLastVisitedPart(partNumber); + assessmentGradingData.setLastVisitedQuestion(questionNumber); + gradingService.saveOrUpdateAssessmentGradingOnly(assessmentGradingData); + } +} diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/ResetDeliveryListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/ResetDeliveryListener.java index 37309db01250..ba7890efc590 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/ResetDeliveryListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/ResetDeliveryListener.java @@ -28,8 +28,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.ui.bean.delivery.DeliveryBean; import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; @@ -46,7 +46,7 @@ public class ResetDeliveryListener implements ActionListener { - private static Log log = LogFactory.getLog(ResetDeliveryListener.class); + private static Logger log = LoggerFactory.getLogger(ResetDeliveryListener.class); private static ContextUtil cu; /** diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/ResultsActionListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/ResultsActionListener.java index 08a6882eaf16..3f8318cafe01 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/ResultsActionListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/ResultsActionListener.java @@ -1,8 +1,8 @@ -/********************************************************************************** - * $URL$ - * $Id$ - *********************************************************************************** - * +/********************************************************************************** + * $URL$ + * $Id$ + *********************************************************************************** + * * Copyright (c) 2006, 2008 The Sakai Foundation * * Licensed under the Educational Community License, Version 2.0 (the "License"); @@ -16,60 +16,60 @@ * 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.sakaiproject.tool.assessment.ui.listener.delivery; - -import javax.faces.event.AbortProcessingException; -import javax.faces.event.ActionEvent; -import javax.faces.event.ActionListener; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.sakaiproject.tool.assessment.ui.bean.delivery.DeliveryBean; -import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; - -/** - *

Title: Samigo

- *

Organization: Sakai Project

- * @version $Id$ - */ - -public class ResultsActionListener implements ActionListener -{ - private static Log log = LogFactory.getLog(ResultsActionListener.class); - - /** - * ACTION. - * @param ae - * @throws AbortProcessingException - */ - public void processAction(ActionEvent ae) throws - AbortProcessingException - { - log.debug("ResultsActionListener.processAction() "); - - // get managed bean and set its action accordingly - DeliveryBean delivery = (DeliveryBean) ContextUtil.lookupBean("delivery"); - log.debug("****DeliveryBean= "+delivery); - String actionString = ContextUtil.lookupParam("actionString"); - if (actionString != null) { - // if actionString is null, likely that action & actionString has been set already, - // e.g. take assessment via url, actionString is set by LoginServlet. - // preview and take assessment is set by the parameter in the jsp pages - delivery.setActionString(actionString); - } - - delivery.setFeedback("true"); - delivery.getFeedbackComponent().setShowCorrectResponse(true); - delivery.getFeedbackComponent().setShowGraderComment(true); - delivery.getFeedbackComponent().setShowItemLevel(true); - delivery.getFeedbackComponent().setShowQuestion(true); - delivery.getFeedbackComponent().setShowResponse(true); - delivery.getFeedbackComponent().setShowSelectionLevel(true); - delivery.getFeedbackComponent().setShowStats(true); - delivery.getFeedbackComponent().setShowStudentScore(true); - delivery.getFeedbackComponent().setShowStudentQuestionScore(true); - } -} + * + **********************************************************************************/ + +package org.sakaiproject.tool.assessment.ui.listener.delivery; + +import javax.faces.event.AbortProcessingException; +import javax.faces.event.ActionEvent; +import javax.faces.event.ActionListener; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sakaiproject.tool.assessment.ui.bean.delivery.DeliveryBean; +import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; + +/** + *

Title: Samigo

+ *

Organization: Sakai Project

+ * @version $Id$ + */ + +public class ResultsActionListener implements ActionListener +{ + private static Logger log = LoggerFactory.getLogger(ResultsActionListener.class); + + /** + * ACTION. + * @param ae + * @throws AbortProcessingException + */ + public void processAction(ActionEvent ae) throws + AbortProcessingException + { + log.debug("ResultsActionListener.processAction() "); + + // get managed bean and set its action accordingly + DeliveryBean delivery = (DeliveryBean) ContextUtil.lookupBean("delivery"); + log.debug("****DeliveryBean= "+delivery); + String actionString = ContextUtil.lookupParam("actionString"); + if (actionString != null) { + // if actionString is null, likely that action & actionString has been set already, + // e.g. take assessment via url, actionString is set by LoginServlet. + // preview and take assessment is set by the parameter in the jsp pages + delivery.setActionString(actionString); + } + + delivery.setFeedback("true"); + delivery.getFeedbackComponent().setShowCorrectResponse(true); + delivery.getFeedbackComponent().setShowGraderComment(true); + delivery.getFeedbackComponent().setShowItemLevel(true); + delivery.getFeedbackComponent().setShowQuestion(true); + delivery.getFeedbackComponent().setShowResponse(true); + delivery.getFeedbackComponent().setShowSelectionLevel(true); + delivery.getFeedbackComponent().setShowStats(true); + delivery.getFeedbackComponent().setShowStudentScore(true); + delivery.getFeedbackComponent().setShowStudentQuestionScore(true); + } +} diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/SaCharCountListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/SaCharCountListener.java index e18a935db821..4d1d7fc5cf3d 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/SaCharCountListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/SaCharCountListener.java @@ -10,8 +10,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.dao.grading.ItemGradingData; import org.sakaiproject.tool.assessment.data.ifc.assessment.ItemDataIfc; import org.sakaiproject.tool.assessment.ui.bean.delivery.DeliveryBean; @@ -22,7 +22,7 @@ public class SaCharCountListener implements ActionListener { - private static Log log = LogFactory.getLog(SaCharCountListener.class); + private static Logger log = LoggerFactory.getLogger(SaCharCountListener.class); public void processAction(ActionEvent ae) throws AbortProcessingException { diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/ShowFeedbackActionListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/ShowFeedbackActionListener.java index a89d45cd0983..3f3c9875660c 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/ShowFeedbackActionListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/ShowFeedbackActionListener.java @@ -33,8 +33,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.services.FinFormatException; import org.sakaiproject.tool.assessment.services.SaLengthException; @@ -54,7 +54,7 @@ public class ShowFeedbackActionListener implements ActionListener { - private static Log log = LogFactory.getLog(ShowFeedbackActionListener.class); + private static Logger log = LoggerFactory.getLogger(ShowFeedbackActionListener.class); private static ContextUtil cu; /** diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/SubmitToGradingActionListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/SubmitToGradingActionListener.java index 61e7cb41f2a8..544230166428 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/SubmitToGradingActionListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/SubmitToGradingActionListener.java @@ -37,8 +37,8 @@ import javax.faces.event.ActionListener; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.entity.api.EntityPropertyNotDefinedException; @@ -93,8 +93,7 @@ */ public class SubmitToGradingActionListener implements ActionListener { - private static final Log log = LogFactory - .getLog(SubmitToGradingActionListener.class); + private static final Logger log = LoggerFactory.getLogger(SubmitToGradingActionListener.class); /** * The publishedAssesmentService @@ -174,7 +173,7 @@ public void processAction(ActionEvent ae) throws AbortProcessingException, FinFo delivery.setIsAnyInvalidFinInput(false); } catch (GradebookServiceException ge) { - log.warn( ge ); + log.warn(ge.getMessage(), ge); FacesContext context = FacesContext.getCurrentInstance(); String err = (String) ContextUtil.getLocalizedString( "org.sakaiproject.tool.assessment.bundle.AuthorMessages", diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/TableOfContentsActionListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/TableOfContentsActionListener.java index 34b96b29e6db..174013907d1f 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/TableOfContentsActionListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/TableOfContentsActionListener.java @@ -33,8 +33,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.services.FinFormatException; import org.sakaiproject.tool.assessment.services.SaLengthException; @@ -54,7 +54,7 @@ public class TableOfContentsActionListener implements ActionListener { - private static Log log = LogFactory.getLog(TableOfContentsActionListener.class); + private static Logger log = LoggerFactory.getLogger(TableOfContentsActionListener.class); private static ContextUtil cu; /** diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/UpdateTimerFromTOCListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/UpdateTimerFromTOCListener.java index 9fb55808ee70..513cf467a72d 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/UpdateTimerFromTOCListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/UpdateTimerFromTOCListener.java @@ -28,8 +28,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.ui.bean.delivery.DeliveryBean; import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; @@ -40,7 +40,7 @@ public class UpdateTimerFromTOCListener implements ActionListener { - //private static Log log = LogFactory.getLog(UpdateTimerListener.class); + //private static Logger log = LoggerFactory.getLogger(UpdateTimerListener.class); //private static ContextUtil cu; /** diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/UpdateTimerListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/UpdateTimerListener.java index 549bbd53516d..8b0a81103a02 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/UpdateTimerListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/UpdateTimerListener.java @@ -28,8 +28,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.dao.grading.AssessmentGradingData; import org.sakaiproject.tool.assessment.ui.bean.delivery.DeliveryBean; @@ -46,7 +46,7 @@ public class UpdateTimerListener implements ActionListener { - private static Log log = LogFactory.getLog(UpdateTimerListener.class); + private static Logger log = LoggerFactory.getLogger(UpdateTimerListener.class); private static ContextUtil cu; /** diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/ConfirmRetakeAssessmentListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/ConfirmRetakeAssessmentListener.java index 0234f38301a1..5f1b02fd3642 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/ConfirmRetakeAssessmentListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/ConfirmRetakeAssessmentListener.java @@ -1,8 +1,8 @@ -/********************************************************************************** - * $URL$ - * $Id$ - *********************************************************************************** - * +/********************************************************************************** + * $URL$ + * $Id$ + *********************************************************************************** + * * Copyright (c) 2004, 2005, 2006, 2007, 2008 The Sakai Foundation * * Licensed under the Educational Community License, Version 2.0 (the "License"); @@ -16,55 +16,55 @@ * 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.sakaiproject.tool.assessment.ui.listener.evaluation; - -import javax.faces.event.AbortProcessingException; -import javax.faces.event.ActionEvent; -import javax.faces.event.ActionListener; - -import org.sakaiproject.tool.assessment.facade.AgentFacade; -import org.sakaiproject.tool.assessment.ui.bean.evaluation.RetakeAssessmentBean; -import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; -import org.sakaiproject.tool.assessment.ui.bean.authz.AuthorizationBean; -import org.sakaiproject.tool.assessment.ui.bean.author.AssessmentBean; -import org.sakaiproject.tool.assessment.services.assessment.PublishedAssessmentService; - - -/** - *

Title: Samigo

- *

Description: Sakai Assessment Manager

- * @author Ed Smiley - * @version $Id$ - */ - -public class ConfirmRetakeAssessmentListener implements ActionListener { - //private static Log log = LogFactory.getLog(ConfirmRemovePartListener.class); - - public ConfirmRetakeAssessmentListener() { - } - - public void processAction(ActionEvent ae) throws AbortProcessingException { - RetakeAssessmentBean retakeAssessment = (RetakeAssessmentBean) ContextUtil.lookupBean("retakeAssessment"); - AuthorizationBean authzBean = (AuthorizationBean) ContextUtil.lookupBean("authorization"); - AssessmentBean assessmentBean = (AssessmentBean) ContextUtil.lookupBean("assessmentBean"); - PublishedAssessmentService pubService = new PublishedAssessmentService(); - - String publishedAssessmentId = ContextUtil.lookupParam("publishedAssessmentId"); - Long pubId = new Long(publishedAssessmentId); - String agentIdString = ContextUtil.lookupParam("agentIdString"); - AgentFacade agent = new AgentFacade(agentIdString); - String studentName = agent.getDisplayName(); - String assessmentOwner = pubService.getPublishedAssessmentOwner(pubId); - - if (!authzBean.isUserAllowedToGradeAssessment(publishedAssessmentId, assessmentOwner, true)) { - throw new IllegalArgumentException("ConfirmRetakeAssessmentListener unauthorized attempt to set retake for " + publishedAssessmentId); - } - retakeAssessment.setPublishedAssessmentId(Long.valueOf(publishedAssessmentId)); - retakeAssessment.setAgentId(agentIdString); - retakeAssessment.setStudentName(studentName); - } - -} + * + **********************************************************************************/ + +package org.sakaiproject.tool.assessment.ui.listener.evaluation; + +import javax.faces.event.AbortProcessingException; +import javax.faces.event.ActionEvent; +import javax.faces.event.ActionListener; + +import org.sakaiproject.tool.assessment.facade.AgentFacade; +import org.sakaiproject.tool.assessment.ui.bean.evaluation.RetakeAssessmentBean; +import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; +import org.sakaiproject.tool.assessment.ui.bean.authz.AuthorizationBean; +import org.sakaiproject.tool.assessment.ui.bean.author.AssessmentBean; +import org.sakaiproject.tool.assessment.services.assessment.PublishedAssessmentService; + + +/** + *

Title: Samigo

+ *

Description: Sakai Assessment Manager

+ * @author Ed Smiley + * @version $Id$ + */ + +public class ConfirmRetakeAssessmentListener implements ActionListener { + //private static Logger log = LoggerFactory.getLogger(ConfirmRemovePartListener.class); + + public ConfirmRetakeAssessmentListener() { + } + + public void processAction(ActionEvent ae) throws AbortProcessingException { + RetakeAssessmentBean retakeAssessment = (RetakeAssessmentBean) ContextUtil.lookupBean("retakeAssessment"); + AuthorizationBean authzBean = (AuthorizationBean) ContextUtil.lookupBean("authorization"); + AssessmentBean assessmentBean = (AssessmentBean) ContextUtil.lookupBean("assessmentBean"); + PublishedAssessmentService pubService = new PublishedAssessmentService(); + + String publishedAssessmentId = ContextUtil.lookupParam("publishedAssessmentId"); + Long pubId = new Long(publishedAssessmentId); + String agentIdString = ContextUtil.lookupParam("agentIdString"); + AgentFacade agent = new AgentFacade(agentIdString); + String studentName = agent.getDisplayName(); + String assessmentOwner = pubService.getPublishedAssessmentOwner(pubId); + + if (!authzBean.isUserAllowedToGradeAssessment(publishedAssessmentId, assessmentOwner, true)) { + throw new IllegalArgumentException("ConfirmRetakeAssessmentListener unauthorized attempt to set retake for " + publishedAssessmentId); + } + retakeAssessment.setPublishedAssessmentId(Long.valueOf(publishedAssessmentId)); + retakeAssessment.setAgentId(agentIdString); + retakeAssessment.setStudentName(studentName); + } + +} diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/DownloadFileSubmissionsListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/DownloadFileSubmissionsListener.java index 1ac4cc9cfcea..d21cdaeaf2e7 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/DownloadFileSubmissionsListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/DownloadFileSubmissionsListener.java @@ -31,8 +31,8 @@ import javax.faces.event.ActionListener; import javax.faces.model.SelectItem; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.ifc.assessment.ItemDataIfc; import org.sakaiproject.tool.assessment.data.ifc.assessment.PublishedAssessmentIfc; import org.sakaiproject.tool.assessment.data.ifc.assessment.SectionDataIfc; @@ -46,7 +46,7 @@ public class DownloadFileSubmissionsListener implements ActionListener { - private static Log log = LogFactory.getLog(DownloadFileSubmissionsListener.class); + private static Logger log = LoggerFactory.getLogger(DownloadFileSubmissionsListener.class); /** * Standard process action method. diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/ExportResponsesListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/ExportResponsesListener.java index c0d8503d62e0..62759707e894 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/ExportResponsesListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/ExportResponsesListener.java @@ -1,8 +1,8 @@ -/********************************************************************************** - * $URL$ - * $Id$ - *********************************************************************************** - * +/********************************************************************************** + * $URL$ + * $Id$ + *********************************************************************************** + * * Copyright (c) 2007, 2008 The Sakai Foundation * * Licensed under the Educational Community License, Version 2.0 (the "License"); @@ -16,49 +16,49 @@ * 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.sakaiproject.tool.assessment.ui.listener.evaluation; - -import javax.faces.event.AbortProcessingException; -import javax.faces.event.ActionEvent; -import javax.faces.event.ActionListener; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.sakaiproject.tool.assessment.services.GradingService; -import org.sakaiproject.tool.assessment.ui.bean.evaluation.ExportResponsesBean; -import org.sakaiproject.tool.assessment.ui.bean.evaluation.TotalScoresBean; -import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; - -/** - *

+ * + **********************************************************************************/ + +package org.sakaiproject.tool.assessment.ui.listener.evaluation; + +import javax.faces.event.AbortProcessingException; +import javax.faces.event.ActionEvent; +import javax.faces.event.ActionListener; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sakaiproject.tool.assessment.services.GradingService; +import org.sakaiproject.tool.assessment.ui.bean.evaluation.ExportResponsesBean; +import org.sakaiproject.tool.assessment.ui.bean.evaluation.TotalScoresBean; +import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; + +/** + *

* This handles the export of student responses. - *

- *

Description: Action Listener for Evaluation Total Score front door

- * @version $Id$ - */ - -public class ExportResponsesListener - implements ActionListener -{ - private static Log log = LogFactory.getLog(ExportResponsesListener.class); - - /** - * Standard process action method. - * @param ae ActionEvent - * @throws AbortProcessingException - */ - public void processAction(ActionEvent ae) throws - AbortProcessingException - { - log.debug("ExportResponsesListener Action Listener."); - TotalScoresBean totalScoreBean = (TotalScoresBean) ContextUtil.lookupBean("totalScores"); - ExportResponsesBean exportResponsesBean = (ExportResponsesBean) ContextUtil.lookupBean("exportResponses"); - exportResponsesBean.setAssessmentId(totalScoreBean.getPublishedId()); - exportResponsesBean.setAssessmentName(totalScoreBean.getAssessmentName()); - exportResponsesBean.setAnonymous(Boolean.valueOf(totalScoreBean.getAnonymous()).booleanValue()); - } -} - + *

+ *

Description: Action Listener for Evaluation Total Score front door

+ * @version $Id$ + */ + +public class ExportResponsesListener + implements ActionListener +{ + private static Logger log = LoggerFactory.getLogger(ExportResponsesListener.class); + + /** + * Standard process action method. + * @param ae ActionEvent + * @throws AbortProcessingException + */ + public void processAction(ActionEvent ae) throws + AbortProcessingException + { + log.debug("ExportResponsesListener Action Listener."); + TotalScoresBean totalScoreBean = (TotalScoresBean) ContextUtil.lookupBean("totalScores"); + ExportResponsesBean exportResponsesBean = (ExportResponsesBean) ContextUtil.lookupBean("exportResponses"); + exportResponsesBean.setAssessmentId(totalScoreBean.getPublishedId()); + exportResponsesBean.setAssessmentName(totalScoreBean.getAssessmentName()); + exportResponsesBean.setAnonymous(Boolean.valueOf(totalScoreBean.getAnonymous()).booleanValue()); + } +} + diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/GrantSubmissionListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/GrantSubmissionListener.java index 61bb0a319ac4..624e35708c47 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/GrantSubmissionListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/GrantSubmissionListener.java @@ -1,152 +1,152 @@ -/********************************************************************************** - * - * - *********************************************************************************** - * - * Copyright (c) 2004, 2005, 2006 The Sakai Foundation. - * - * Licensed under the Educational Community License, Version 1.0 (the"License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.opensource.org/licenses/ecl1.php - * - * 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.sakaiproject.tool.assessment.ui.listener.evaluation; - -import java.util.List; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; - -import javax.faces.event.AbortProcessingException; -import javax.faces.event.ActionEvent; -import javax.faces.event.ActionListener; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.sakaiproject.tool.assessment.data.dao.grading.AssessmentGradingData; -import org.sakaiproject.tool.assessment.services.GradingService; -import org.sakaiproject.tool.assessment.services.shared.MediaService; -import org.sakaiproject.tool.assessment.ui.bean.delivery.DeliveryBean; -import org.sakaiproject.tool.assessment.ui.bean.evaluation.AgentResults; -import org.sakaiproject.tool.assessment.ui.bean.evaluation.TotalScoresBean; -import org.sakaiproject.tool.assessment.ui.listener.delivery.DeliveryActionListener; -import org.sakaiproject.tool.assessment.ui.listener.evaluation.util.EvaluationListenerUtil; -import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; -import org.sakaiproject.tool.assessment.util.BeanSort; -import org.sakaiproject.tool.assessment.data.dao.grading.MediaData; - - -/** - *

- * This handles the deletion of student submission on the Score page. - *

- *

Description: Action Listener for deletion of student's submission on the Score page

- *

Organization: Sakai Project

- * @author Texas State University - */ - -public class GrantSubmissionListener - implements ActionListener -{ - private static Log log = LogFactory.getLog(StudentScoreListener.class); - private static EvaluationListenerUtil util; - private static BeanSort bs; - - /** - * Increases submissions remaining by 1. - * Gives students an additional attempt. - * - * @param ae ActionEvent - * @throws AbortProcessingException - */ - public void processAction(ActionEvent ae) throws - AbortProcessingException - { - log.debug("GrantSubmission LISTENER."); - - TotalScoresBean totalScores = (TotalScoresBean) ContextUtil.lookupBean("totalScores"); - String deletedStudentId = null; - // delivery.setSubmissionsRemaining(delivery.getSubmissionsRemaining() + 1); - - String gradingIdParam = ContextUtil.lookupParam("gradingData"); - Long gradingId = new Long(gradingIdParam); - String publishedAssessmentId = ContextUtil.lookupParam("publishedId"); - - GradingService gradingService = new GradingService(); - MediaService mediaService = new MediaService(); - - List itemGradingIds = gradingService.getItemGradingIds(gradingId); - - for(int i = 0; i < itemGradingIds.size(); i++){ - Long itemGradingId = (Long) itemGradingIds.get(i); - //for each grading item, check if question is file upload type or an audio recording type - int itemType = gradingService.getTypeId(itemGradingId).intValue(); - if(itemType == 6 || itemType == 7){ - //if is file upload or recording type, check if there is file/media uploaded - ArrayList mediaDatas = gradingService.getMediaArray(itemGradingId.toString()); - for(int j = 0; j < mediaDatas.size(); j++) { - //if there are file(s) uploaded, delete them - String mediaId = ((MediaData)mediaDatas.get(j)).getMediaId().toString(); - mediaService.remove(mediaId); - } - } - } - - AssessmentGradingData ag = (AssessmentGradingData) gradingService.load(gradingIdParam); - Collection collectionOfOne = new ArrayList(); - collectionOfOne.add(ag); - gradingService.deleteAll(collectionOfOne); - - Collection agentList = totalScores.getAgents(); - for(Iterator i = agentList.iterator(); i.hasNext();) { - AgentResults a = (AgentResults)i.next(); - if (a.getAssessmentGradingId().equals(gradingId)) { - deletedStudentId = a.getAgentId(); - i.remove(); - } - } - - ArrayList gradingList = totalScores.getAssessmentGradingList(); - //Get the list of submission for this student - ArrayList deletedStudentGradingList = new ArrayList(); - for(int i = 0; i < gradingList.size(); i++){ - if (((AssessmentGradingData)gradingList.get(i)).getAgentId().equals(deletedStudentId)) { - deletedStudentGradingList.add(gradingList.get(i)); - } - } - //Need to do a check to see if this is the only submission for that student - if(deletedStudentGradingList.size() == 1){ - //if deleted the last one submission of this student, reset the grading data to have no grade and notify gradebook - gradingList.clear(); - gradingList.add(deletedStudentGradingList.get(0)); - ((AssessmentGradingData)gradingList.get(0)).setFinalScore(null); - } - else { - for(int i = 0;i < gradingList.size();i++) { - if (((AssessmentGradingData)gradingList.get(i)).getAssessmentGradingId().equals(gradingId)) { - gradingList.remove(i); - } - } - } - - totalScores.setAssessmentGradingList(gradingList); - totalScores.setAgents(agentList); - - gradingService.notifyDeleteToGradebook(gradingList, totalScores.getPublishedAssessment(), deletedStudentId); - - } -} +/********************************************************************************** + * + * + *********************************************************************************** + * + * Copyright (c) 2004, 2005, 2006 The Sakai Foundation. + * + * Licensed under the Educational Community License, Version 1.0 (the"License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.opensource.org/licenses/ecl1.php + * + * 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.sakaiproject.tool.assessment.ui.listener.evaluation; + +import java.util.List; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; + +import javax.faces.event.AbortProcessingException; +import javax.faces.event.ActionEvent; +import javax.faces.event.ActionListener; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sakaiproject.tool.assessment.data.dao.grading.AssessmentGradingData; +import org.sakaiproject.tool.assessment.services.GradingService; +import org.sakaiproject.tool.assessment.services.shared.MediaService; +import org.sakaiproject.tool.assessment.ui.bean.delivery.DeliveryBean; +import org.sakaiproject.tool.assessment.ui.bean.evaluation.AgentResults; +import org.sakaiproject.tool.assessment.ui.bean.evaluation.TotalScoresBean; +import org.sakaiproject.tool.assessment.ui.listener.delivery.DeliveryActionListener; +import org.sakaiproject.tool.assessment.ui.listener.evaluation.util.EvaluationListenerUtil; +import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; +import org.sakaiproject.tool.assessment.util.BeanSort; +import org.sakaiproject.tool.assessment.data.dao.grading.MediaData; + + +/** + *

+ * This handles the deletion of student submission on the Score page. + *

+ *

Description: Action Listener for deletion of student's submission on the Score page

+ *

Organization: Sakai Project

+ * @author Texas State University + */ + +public class GrantSubmissionListener + implements ActionListener +{ + private static Logger log = LoggerFactory.getLogger(StudentScoreListener.class); + private static EvaluationListenerUtil util; + private static BeanSort bs; + + /** + * Increases submissions remaining by 1. + * Gives students an additional attempt. + * + * @param ae ActionEvent + * @throws AbortProcessingException + */ + public void processAction(ActionEvent ae) throws + AbortProcessingException + { + log.debug("GrantSubmission LISTENER."); + + TotalScoresBean totalScores = (TotalScoresBean) ContextUtil.lookupBean("totalScores"); + String deletedStudentId = null; + // delivery.setSubmissionsRemaining(delivery.getSubmissionsRemaining() + 1); + + String gradingIdParam = ContextUtil.lookupParam("gradingData"); + Long gradingId = new Long(gradingIdParam); + String publishedAssessmentId = ContextUtil.lookupParam("publishedId"); + + GradingService gradingService = new GradingService(); + MediaService mediaService = new MediaService(); + + List itemGradingIds = gradingService.getItemGradingIds(gradingId); + + for(int i = 0; i < itemGradingIds.size(); i++){ + Long itemGradingId = (Long) itemGradingIds.get(i); + //for each grading item, check if question is file upload type or an audio recording type + int itemType = gradingService.getTypeId(itemGradingId).intValue(); + if(itemType == 6 || itemType == 7){ + //if is file upload or recording type, check if there is file/media uploaded + ArrayList mediaDatas = gradingService.getMediaArray(itemGradingId.toString()); + for(int j = 0; j < mediaDatas.size(); j++) { + //if there are file(s) uploaded, delete them + String mediaId = ((MediaData)mediaDatas.get(j)).getMediaId().toString(); + mediaService.remove(mediaId); + } + } + } + + AssessmentGradingData ag = (AssessmentGradingData) gradingService.load(gradingIdParam); + Collection collectionOfOne = new ArrayList(); + collectionOfOne.add(ag); + gradingService.deleteAll(collectionOfOne); + + Collection agentList = totalScores.getAgents(); + for(Iterator i = agentList.iterator(); i.hasNext();) { + AgentResults a = (AgentResults)i.next(); + if (a.getAssessmentGradingId().equals(gradingId)) { + deletedStudentId = a.getAgentId(); + i.remove(); + } + } + + ArrayList gradingList = totalScores.getAssessmentGradingList(); + //Get the list of submission for this student + ArrayList deletedStudentGradingList = new ArrayList(); + for(int i = 0; i < gradingList.size(); i++){ + if (((AssessmentGradingData)gradingList.get(i)).getAgentId().equals(deletedStudentId)) { + deletedStudentGradingList.add(gradingList.get(i)); + } + } + //Need to do a check to see if this is the only submission for that student + if(deletedStudentGradingList.size() == 1){ + //if deleted the last one submission of this student, reset the grading data to have no grade and notify gradebook + gradingList.clear(); + gradingList.add(deletedStudentGradingList.get(0)); + ((AssessmentGradingData)gradingList.get(0)).setFinalScore(null); + } + else { + for(int i = 0;i < gradingList.size();i++) { + if (((AssessmentGradingData)gradingList.get(i)).getAssessmentGradingId().equals(gradingId)) { + gradingList.remove(i); + } + } + } + + totalScores.setAssessmentGradingList(gradingList); + totalScores.setAgents(agentList); + + gradingService.notifyDeleteToGradebook(gradingList, totalScores.getPublishedAssessment(), deletedStudentId); + + } +} diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/HistogramListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/HistogramListener.java index 7b1da5a87cfc..36e51d34a32b 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/HistogramListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/HistogramListener.java @@ -28,8 +28,8 @@ import javax.servlet.http.HttpServletRequest; import org.apache.commons.beanutils.BeanUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; //import org.hibernate.Hibernate; import org.sakaiproject.tool.assessment.api.SamigoApiFactory; import org.sakaiproject.tool.assessment.data.dao.assessment.PublishedSectionData; @@ -88,7 +88,7 @@ public class HistogramListener implements ActionListener, ValueChangeListener { - private static Log log = LogFactory.getLog(HistogramListener.class); + private static Logger log = LoggerFactory.getLogger(HistogramListener.class); //private static BeanSort bs; //private static ContextUtil cu; //private static EvaluationListenerUtil util; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/QuestionScoreListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/QuestionScoreListener.java index 8451cbd70bb8..d826a590916e 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/QuestionScoreListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/QuestionScoreListener.java @@ -1,8 +1,8 @@ -/********************************************************************************** - * $URL$ - * $Id$ - *********************************************************************************** - * +/********************************************************************************** + * $URL$ + * $Id$ + *********************************************************************************** + * * Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009 The Sakai Foundation * * Licensed under the Educational Community License, Version 2.0 (the "License"); @@ -15,980 +15,980 @@ * 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.sakaiproject.tool.assessment.ui.listener.evaluation; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; - -import javax.faces.event.AbortProcessingException; -import javax.faces.event.ActionEvent; -import javax.faces.event.ActionListener; -import javax.faces.event.ValueChangeEvent; -import javax.faces.event.ValueChangeListener; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.sakaiproject.tool.assessment.data.dao.assessment.AssessmentAccessControl; -import org.sakaiproject.tool.assessment.data.dao.assessment.EvaluationModel; -import org.sakaiproject.tool.assessment.data.dao.assessment.PublishedAnswer; -import org.sakaiproject.tool.assessment.data.dao.grading.ItemGradingAttachment; -import org.sakaiproject.tool.assessment.data.dao.grading.ItemGradingData; -import org.sakaiproject.tool.assessment.data.dao.grading.MediaData; -import org.sakaiproject.tool.assessment.data.ifc.assessment.AnswerIfc; -import org.sakaiproject.tool.assessment.data.ifc.assessment.ItemDataIfc; -import org.sakaiproject.tool.assessment.data.ifc.assessment.ItemTextIfc; -import org.sakaiproject.tool.assessment.data.ifc.assessment.PublishedAssessmentIfc; -import org.sakaiproject.tool.assessment.data.ifc.assessment.SectionDataIfc; -import org.sakaiproject.tool.assessment.facade.AgentFacade; -import org.sakaiproject.tool.assessment.services.GradingService; -import org.sakaiproject.tool.assessment.services.PublishedItemService; -import org.sakaiproject.tool.assessment.services.assessment.PublishedAssessmentService; -import org.sakaiproject.tool.assessment.ui.bean.evaluation.AgentResults; -import org.sakaiproject.tool.assessment.ui.bean.evaluation.HistogramScoresBean; -import org.sakaiproject.tool.assessment.ui.bean.evaluation.PartData; -import org.sakaiproject.tool.assessment.ui.bean.evaluation.QuestionScoresBean; -import org.sakaiproject.tool.assessment.ui.bean.evaluation.SubmissionStatusBean; -import org.sakaiproject.tool.assessment.ui.bean.evaluation.TotalScoresBean; -import org.sakaiproject.tool.assessment.ui.bean.authz.AuthorizationBean; -import org.sakaiproject.tool.assessment.ui.bean.author.AssessmentBean; -import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; -import org.sakaiproject.tool.assessment.util.BeanSort; -import org.sakaiproject.util.FormattedText; -import org.sakaiproject.util.ResourceLoader; -import org.sakaiproject.component.cover.ServerConfigurationService; - -// end testing - -/** - *

- * This handles the selection of the Question Score entry page. - *

- *

- * Description: Action Listener for Evaluation Question Score front door - *

- *

- * Copyright: Copyright (c) 2004 - *

- *

- * Organization: Sakai Project - *

- * - * @author Ed Smiley - * @version $Id: QuestionScoreListener.java 11438 2006-06-30 20:06:03Z - * daisyf@stanford.edu $ - */ - -public class QuestionScoreListener implements ActionListener, - ValueChangeListener { - private static Log log = LogFactory.getLog(QuestionScoreListener.class); - - // private static EvaluationListenerUtil util; - private static BeanSort bs; - - private static final String noAnswer = (String) ContextUtil - .getLocalizedString( - "org.sakaiproject.tool.assessment.bundle.EvaluationMessages", - "no_answer"); - - /** - * Standard process action method. - * - * @param event - * ActionEvent - * @throws AbortProcessingException - */ - public void processAction(ActionEvent event) - throws AbortProcessingException { - log.debug("QuestionScore LISTENER."); - QuestionScoresBean bean = (QuestionScoresBean) ContextUtil - .lookupBean("questionScores"); - - // Reset the search field - String defaultSearchString = ContextUtil.getLocalizedString( - "org.sakaiproject.tool.assessment.bundle.EvaluationMessages", - "search_default_student_search_string"); - bean.setSearchString(defaultSearchString); - - // we probably want to change the poster to be consistent - String publishedId = ContextUtil.lookupParam("publishedId"); - - AuthorizationBean authzBean = (AuthorizationBean) ContextUtil.lookupBean("authorization"); - AssessmentBean assessmentBean = (AssessmentBean) ContextUtil.lookupBean("assessmentBean"); - PublishedAssessmentService pubService = new PublishedAssessmentService(); - Long pubId = new Long(publishedId); - String assessmentOwner = pubService.getPublishedAssessmentOwner(pubId); - if (!authzBean.isUserAllowedToGradeAssessment(publishedId, assessmentOwner, true)) { - throw new IllegalArgumentException("QuestionScoreListener unauthorized attempt to get scores for " + publishedId); - } - - if (!questionScores(publishedId, bean, false)) { - throw new RuntimeException("failed to call questionScores."); - } - - } - - /** - * Process a value change. - */ - public void processValueChange(ValueChangeEvent event) { - log.debug("QuestionScore CHANGE LISTENER."); - QuestionScoresBean bean = (QuestionScoresBean) ContextUtil.lookupBean("questionScores"); - TotalScoresBean totalBean = (TotalScoresBean) ContextUtil.lookupBean("totalScores"); - HistogramScoresBean histogramBean = (HistogramScoresBean) ContextUtil.lookupBean("histogramScores"); - SubmissionStatusBean submissionbean = (SubmissionStatusBean) ContextUtil.lookupBean("submissionStatus"); - - - // we probably want to change the poster to be consistent - String publishedId = ContextUtil.lookupParam("publishedId"); - boolean toggleSubmissionSelection = false; - - String selectedvalue = (String) event.getNewValue(); - if ((selectedvalue != null) && (!selectedvalue.equals(""))) { - if (event.getComponent().getId().indexOf("sectionpicker") > -1) { - bean.setSelectedSectionFilterValue(selectedvalue); // changed - totalBean.setSelectedSectionFilterValue(selectedvalue); - submissionbean.setSelectedSectionFilterValue(selectedvalue); - } else if (event.getComponent().getId().indexOf("allSubmissions") > -1) { - bean.setAllSubmissions(selectedvalue); // changed submission - // pulldown - totalBean.setAllSubmissions(selectedvalue); // changed for total - // score bean - histogramBean.setAllSubmissions(selectedvalue); // changed for - // histogram - // score bean - toggleSubmissionSelection = true; - } else // inline or popup - { - bean.setSelectedSARationaleView(selectedvalue); // changed - // submission - // pulldown - } - } - - if (!questionScores(publishedId, bean, toggleSubmissionSelection)) { - throw new RuntimeException("failed to call questionScores."); - } - } - - /** - * This will populate the QuestionScoresBean with the data associated with - * the particular versioned assessment based on the publishedId. - * - * @todo Some of this code will change when we move this to Hibernate - * persistence. - * @param publishedId - * String - * @param bean - * QuestionScoresBean - * @return boolean - */ - public boolean questionScores(String publishedId, QuestionScoresBean bean, - boolean isValueChange) { - log.debug("questionScores()"); - try { - PublishedAssessmentService pubService = new PublishedAssessmentService(); - PublishedItemService pubItemService = new PublishedItemService(); - // get the PublishedAssessment based on publishedId - QuestionScoresBean questionBean = (QuestionScoresBean) ContextUtil - .lookupBean("questionScores"); - PublishedAssessmentIfc publishedAssessment = questionBean - .getPublishedAssessment(); - if (publishedAssessment == null) { - publishedAssessment = pubService - .getPublishedAssessment(publishedId); - questionBean.setPublishedAssessment(publishedAssessment); - } - // build a hashMap (publishedItemId, publishedItem) - HashMap publishedItemHash = pubService - .preparePublishedItemHash(publishedAssessment); - log.debug("questionScores(): publishedItemHash.size = " - + publishedItemHash.size()); - // build a hashMap (publishedItemTextId, publishedItemText) - HashMap publishedItemTextHash = pubService - .preparePublishedItemTextHash(publishedAssessment); - log.debug("questionScores(): publishedItemTextHash.size = " - + publishedItemTextHash.size()); - HashMap publishedAnswerHash = pubService - .preparePublishedAnswerHash(publishedAssessment); - // re-attach session and load all lazy loaded parent/child stuff - -// Set publishedAnswerHashKeySet = publishedAnswerHash.keySet(); -// -// for (Long key : publishedAnswerHashKeySet) { -// AnswerIfc answer = (AnswerIfc) publishedAnswerHash.get(key); -// -// if (!Hibernate.isInitialized(answer.getChildAnswerSet())) { -// pubItemService.eagerFetchAnswer(answer); -// } -// } - log.debug("questionScores(): publishedAnswerHash.size = " - + publishedAnswerHash.size()); - HashMap agentResultsByItemGradingIdMap = new HashMap(); - - GradingService delegate = new GradingService(); - - TotalScoresBean totalBean = (TotalScoresBean) ContextUtil - .lookupBean("totalScores"); - - if (ContextUtil.lookupParam("sortBy") != null - && !ContextUtil.lookupParam("sortBy").trim().equals("")) - bean.setSortType(ContextUtil.lookupParam("sortBy")); - - String itemId = ContextUtil.lookupParam("itemId"); - if (ContextUtil.lookupParam("newItemId") != null - && !ContextUtil.lookupParam("newItemId").trim().equals("") - && !ContextUtil.lookupParam("newItemId").trim().equals("null")) - itemId = ContextUtil.lookupParam("newItemId"); - - if (ContextUtil.lookupParam("sortAscending") != null - && !ContextUtil.lookupParam("sortAscending").trim().equals( - "")) { - bean.setSortAscending(Boolean.valueOf( - ContextUtil.lookupParam("sortAscending")) - .booleanValue()); - } - - String which = bean.getAllSubmissions(); - if (which == null && totalBean.getAllSubmissions() != null) { - // use totalscore's selection - which = totalBean.getAllSubmissions(); - bean.setAllSubmissions(which); - } - - totalBean.setSelectedSectionFilterValue(bean - .getSelectedSectionFilterValue()); // set section pulldown - - if (bean.getSelectedSARationaleView() == null) { - // if bean.showSARationaleInLine is null, then set inline to be - // the default - bean.setSelectedSARationaleView(QuestionScoresBean.SHOW_SA_RATIONALE_RESPONSES_INLINE); - } - - if ("true".equalsIgnoreCase(totalBean.getAnonymous())) { - boolean groupRelease = publishedAssessment.getAssessmentAccessControl().getReleaseTo().equals(AssessmentAccessControl.RELEASE_TO_SELECTED_GROUPS); - if (groupRelease) { - totalBean.setSelectedSectionFilterValue(TotalScoresBean.RELEASED_SECTIONS_GROUPS_SELECT_VALUE); - } - else { - totalBean.setSelectedSectionFilterValue(TotalScoresBean.ALL_SECTIONS_SELECT_VALUE); - } - } - - bean.setPublishedId(publishedId); - Date dueDate = null; - - HashMap map = getItemScores(Long.valueOf(publishedId), Long - .valueOf(itemId), which, isValueChange); - log.debug("questionScores(): map .size = " + map.size()); - ResourceLoader rb = null; - ArrayList allscores = new ArrayList(); - Iterator keyiter = map.keySet().iterator(); - while (keyiter.hasNext()) { - allscores.addAll((ArrayList) map.get(keyiter.next())); - } - - log.debug("questionScores(): allscores.size = " + allscores.size()); - - // / - - // now we need filter by sections selected - ArrayList scores = new ArrayList(); // filtered list - Map useridMap = totalBean.getUserIdMap(TotalScoresBean.CALLED_FROM_QUESTION_SCORE_LISTENER); - bean.setUserIdMap(useridMap); - log.debug("questionScores(): useridMap.size = " + useridMap.size()); - - /* - * if ("true".equalsIgnoreCase(totalBean.getAnonymous())){ // skip - * section filter if it is anonymous grading, SAK-4395, - * scores.addAll(allscores); } - */ - if (totalBean.getReleaseToAnonymous()) { - // skip section filter if it's published to anonymous users - scores.addAll(allscores); - } else { - Iterator allscores_iter = allscores.iterator(); - // get the Map of all users(keyed on userid) belong to the - // selected sections - while (allscores_iter.hasNext()) { - // AssessmentGradingData data = (AssessmentGradingData) - // allscores_iter.next(); - ItemGradingData idata = (ItemGradingData) allscores_iter - .next(); - // String agentid = - // idata.getAssessmentGrading().getAgentId(); - String agentid = idata.getAgentId(); - // now we only include scores of users belong to the - // selected sections - if (useridMap.containsKey(agentid)) { - scores.add(idata); - } - } - } - - log.debug("questionScores(): scores.size = " + scores.size()); - - Iterator iter = scores.iterator(); - ArrayList agents = new ArrayList(); - - log.debug("questionScores(): calling populateSections "); - - populateSections(publishedAssessment, bean, totalBean, scores, - pubService); // set up the Q1, Q2... links - if (!iter.hasNext()) { - // this section has no students - log.debug("questionScores(): this section has no students"); - bean.setAgents(agents); - bean.setAllAgents(agents); - bean.setTotalPeople(Integer.toString(bean.getAgents().size())); - bean.setAnonymous(totalBean.getAnonymous()); - //return true; - } - - // List them by item and assessmentgradingid, so we can - // group answers by item and save them for update use. - - HashMap scoresByItem = new HashMap(); - while (iter.hasNext()) { - ItemGradingData idata = (ItemGradingData) iter.next(); - ItemTextIfc pubItemText = (ItemTextIfc) publishedItemTextHash - .get(idata.getPublishedItemTextId()); - AnswerIfc pubAnswer = (AnswerIfc) publishedAnswerHash.get(idata - .getPublishedAnswerId()); - - ArrayList temp = (ArrayList) scoresByItem.get(idata - .getAssessmentGradingId() - + ":" + idata.getPublishedItemId()); - if (temp == null) - temp = new ArrayList(); - - // Very small numbers, so bubblesort is fast - Iterator iter2 = temp.iterator(); - ArrayList newList = new ArrayList(); - boolean added = false; - while (iter2.hasNext()) { - ItemGradingData tmpData = (ItemGradingData) iter2.next(); - ItemTextIfc tmpPublishedText = (ItemTextIfc) publishedItemTextHash - .get(tmpData.getPublishedItemTextId()); - AnswerIfc tmpAnswer = (AnswerIfc) publishedAnswerHash - .get(tmpData.getPublishedAnswerId()); - - if (pubAnswer != null - && tmpAnswer != null - && !added - && (pubItemText.getSequence().intValue() < tmpPublishedText - .getSequence().intValue() || (pubItemText - .getSequence().intValue() == tmpPublishedText - .getSequence().intValue() && pubAnswer - .getSequence().intValue() < tmpAnswer - .getSequence().intValue()))) { - newList.add(idata); - added = true; - } - newList.add(tmpData); - } - if (!added) - newList.add(idata); - scoresByItem.put(idata.getAssessmentGradingId() + ":" - + idata.getPublishedItemId(), newList); - } - log.debug("questionScores(): scoresByItem.size = " - + scoresByItem.size()); - bean.setScoresByItem(scoresByItem); - - try { - bean.setAnonymous(publishedAssessment.getEvaluationModel() - .getAnonymousGrading().equals( - EvaluationModel.ANONYMOUS_GRADING) ? "true" - : "false"); - } catch (RuntimeException e) { - // log.info("No evaluation model."); - bean.setAnonymous("false"); - } - - // below properties don't seem to be used in jsf pages, - try { - bean.setLateHandling(publishedAssessment - .getAssessmentAccessControl().getLateHandling() - .toString()); - } catch (Exception e) { - // log.info("No access control model."); - bean - .setLateHandling(AssessmentAccessControl.NOT_ACCEPT_LATE_SUBMISSION - .toString()); - } - try { - bean.setDueDate(publishedAssessment - .getAssessmentAccessControl().getDueDate().toString()); - dueDate = publishedAssessment.getAssessmentAccessControl() - .getDueDate(); - } catch (RuntimeException e) { - // log.info("No due date."); - bean.setDueDate(new Date().toString()); - } - try { - bean.setMaxScore(publishedAssessment.getEvaluationModel() - .getFixedTotalScore()); - } catch (RuntimeException e) { - double score = (double) 0.0; - Iterator iter2 = publishedAssessment.getSectionArraySorted() - .iterator(); - while (iter2.hasNext()) { - SectionDataIfc sdata = (SectionDataIfc) iter2.next(); - Iterator iter3 = sdata.getItemArraySortedForGrading() - .iterator(); - while (iter3.hasNext()) { - ItemDataIfc idata = (ItemDataIfc) iter3.next(); - if (idata.getItemId().equals(Long.valueOf(itemId))) - score = idata.getScore().doubleValue(); - } - } - bean.setMaxScore(score); - } - - // need to get id from somewhere else, not from data. data only - // contains answered items , we want to return all items. - // ItemDataIfc item = (ItemDataIfc) publishedItemHash.get(data.getPublishedItemId()); - ItemDataIfc item = (ItemDataIfc) publishedItemHash.get(Long.valueOf(itemId)); - - if (item != null) { - log.debug("item!=null steting type id = " - + item.getTypeId().toString()); - bean.setTypeId(item.getTypeId().toString()); - bean.setItemId(item.getItemId().toString()); - bean.setPartName(item.getSection().getSequence().toString()); - bean.setItemName(item.getSequence().toString()); - item.setHint("***"); // Keyword to not show student answer - // for short answer/ essey question, if there is a model short - // answer for this question - // set haveModelShortAnswer to true - if (item.getTypeId().equals(Long.valueOf(5))) { - Iterator iterator = publishedAnswerHash.values().iterator(); - while (iterator.hasNext()) { - PublishedAnswer publishedAnswer = (PublishedAnswer) iterator - .next(); - if (publishedAnswer.getItem().getItemId().equals( - item.getItemId())) { - if (publishedAnswer.getText() == null - || publishedAnswer.getText().equals("")) { - bean.setHaveModelShortAnswer(false); - } else { - bean.setHaveModelShortAnswer(true); - } - break; - } - } - } - } else { - log.debug("item==null "); - } - - ArrayList deliveryItems = new ArrayList(); // so we can use the var - if (item != null) - deliveryItems.add(item); - bean.setDeliveryItem(deliveryItems); - - if (ContextUtil.lookupParam("roleSelection") != null) { - bean.setRoleSelection(ContextUtil.lookupParam("roleSelection")); - } - - if (bean.getSortType() == null) { - if (bean.getAnonymous().equals("true")) { - bean.setSortType("totalAutoScore"); - } else { - bean.setSortType("lastName"); - } - } - - // recordingData encapsulates the inbeanation needed for recording. - // set recording agent, agent assessmentId, - // set course_assignment_context value - // set max tries (0=unlimited), and 30 seconds max length - - // String courseContext = bean.getAssessmentName() + " total "; - - // Note this is HTTP-centric right now, we can't use in Faces - // AuthoringHelper authoringHelper = new AuthoringHelper(); - // authoringHelper.getRemoteUserID() needs servlet stuff - // authoringHelper.getRemoteUserName() needs servlet stuff - - /* Dump the grading and agent information into AgentResults */ - iter = scoresByItem.values().iterator(); - while (iter.hasNext()) { - AgentResults results = new AgentResults(); - // Get all the answers for this question to put in one grading - // row - ArrayList answerList = (ArrayList) iter.next(); - results.setItemGradingArrayList(answerList); - // The list is sorted by answer id so that it will come back from the student in a - // predictable order. This is also required by the getCalcQResult method. - Collections.sort(answerList, new Comparator() { - public int compare(ItemGradingData i1, ItemGradingData i2) { - return i1.getPublishedAnswerId().compareTo( - i2.getPublishedAnswerId()); - } - }); - Iterator iter2 = answerList.iterator(); - ArrayList itemGradingAttachmentList = new ArrayList(); - HashMap> fibmap = new HashMap>(); - int i = 1; - HashMap answersMap = new HashMap(); - while (iter2.hasNext()) { - ItemGradingData gdata = (ItemGradingData) iter2.next(); - results.setItemGrading(gdata); - delegate.extractCalcQAnswersArray(answersMap, item, - gdata.getAssessmentGradingId(), gdata.getAgentId()); - itemGradingAttachmentList.addAll(gdata.getItemGradingAttachmentList()); - agentResultsByItemGradingIdMap.put(gdata.getItemGradingId(), results); - - ItemTextIfc gdataPubItemText = (ItemTextIfc) publishedItemTextHash - .get(gdata.getPublishedItemTextId()); - AnswerIfc gdataAnswer = (AnswerIfc) publishedAnswerHash - .get(gdata.getPublishedAnswerId()); - - // This all just gets the text of the answer to display - String answerText = noAnswer; - String rationale = ""; - String fullAnswerText = noAnswer; - - // Answer Key and Decimal Places for Calculated Questions - String answerKey = noAnswer; - int decimalPlaces; - - // if question type = MC, MR, Survey, TF, Matching, if user - // has not submit an answer - // answerText = noAnswer. These question type do not use the - // itemGrading.answerText field for - // storing answers, thye use temGrading.publishedAnswerId to - // make their selection - if (bean.getTypeId().equals("1") - || bean.getTypeId().equals("2") - || bean.getTypeId().equals("12") - || bean.getTypeId().equals("3") - || bean.getTypeId().equals("4") - || bean.getTypeId().equals("9") - || bean.getTypeId().equals("13")) { - if (gdataAnswer != null) - answerText = gdataAnswer.getText(); - } else { - // this handles the other question types: SAQ, File - // upload, Audio, FIB, Fill in Numeric - // These question type use itemGrading.answetText to - // store information about their answer - if ((bean.getTypeId().equals("8") || bean.getTypeId().equals("11") || bean.getTypeId().equals("14")) && gdataAnswer == null) { - answerText = ""; - } - else if (bean.getTypeId().equals("14")) {//gopalrc - EMI - answerText = gdataPubItemText.getSequence() + ": " + gdataAnswer.getLabel(); - } - else { - answerText = gdata.getAnswerText(); - } - } - - if ("4".equals(bean.getTypeId())) { - if (rb == null) { - rb = new ResourceLoader("org.sakaiproject.tool.assessment.bundle.EvaluationMessages"); - } - if ("true".equals(answerText)) { - answerText = rb.getString("true_msg"); - } - else if ("false".equals(answerText)) { - answerText = rb.getString("false_msg"); - } - } - - if (bean.getTypeId().equals("9")) { - if (gdataPubItemText == null) { - // the matching pair is deleted - answerText = ""; - } - else { - answerText = gdataPubItemText.getSequence() + ":" - + answerText; - } - } - - if (bean.getTypeId().equals("8")) { - if (gdataAnswer != null && gdataAnswer.getSequence() != null) { - answerText = gdataAnswer.getSequence() + ":" - + answerText; - } - } - - if (bean.getTypeId().equals("11")) { - if (gdataAnswer != null && gdataAnswer.getSequence() != null) { - answerText = gdataAnswer.getSequence() + ":" - + answerText; - } - } - if (bean.getTypeId().equals("13")) { - if (gdataPubItemText == null) { - answerText = ""; - } - else { - int answerNo = gdataPubItemText.getSequence().intValue(); - answerText = answerNo + ":" + answerText; - } - } - // file upload - if (bean.getTypeId().equals("6")) { - gdata.setMediaArray(delegate.getMediaArray2(gdata - .getItemGradingId().toString())); - } - - // audio recording - if (bean.getTypeId().equals("7")) { - ArrayList mediaList = delegate.getMediaArray2(gdata - .getItemGradingId().toString()); - setDurationIsOver(item, mediaList); - gdata.setMediaArray(mediaList); - } - if (bean.getTypeId().equals("16")) { - if (gdataPubItemText == null) { - // the matching pair is deleted - answerText = ""; - } - else { - answerText = gdataPubItemText.getSequence() + ":"+ answerText; - } - } - if (answerText == null) - answerText = noAnswer; - else { - if (gdata.getRationale() != null - && !gdata.getRationale().trim().equals("")) - rationale = "\nRationale: " + gdata.getRationale(); - } - // Huong's temp commandout - // answerText = answerText.replaceAll("<.*?>", ""); - answerText = answerText.replaceAll("(\r\n|\r)", "
"); - rationale = rationale.replaceAll("<.*?>", ""); - rationale = rationale.replaceAll("(\r\n|\r)", "
"); - fullAnswerText = answerText; // this is the - // non-abbreviated answers - // for essay questions + * limitations under the License. + * + **********************************************************************************/ + +package org.sakaiproject.tool.assessment.ui.listener.evaluation; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + +import javax.faces.event.AbortProcessingException; +import javax.faces.event.ActionEvent; +import javax.faces.event.ActionListener; +import javax.faces.event.ValueChangeEvent; +import javax.faces.event.ValueChangeListener; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sakaiproject.tool.assessment.data.dao.assessment.AssessmentAccessControl; +import org.sakaiproject.tool.assessment.data.dao.assessment.EvaluationModel; +import org.sakaiproject.tool.assessment.data.dao.assessment.PublishedAnswer; +import org.sakaiproject.tool.assessment.data.dao.grading.ItemGradingAttachment; +import org.sakaiproject.tool.assessment.data.dao.grading.ItemGradingData; +import org.sakaiproject.tool.assessment.data.dao.grading.MediaData; +import org.sakaiproject.tool.assessment.data.ifc.assessment.AnswerIfc; +import org.sakaiproject.tool.assessment.data.ifc.assessment.ItemDataIfc; +import org.sakaiproject.tool.assessment.data.ifc.assessment.ItemTextIfc; +import org.sakaiproject.tool.assessment.data.ifc.assessment.PublishedAssessmentIfc; +import org.sakaiproject.tool.assessment.data.ifc.assessment.SectionDataIfc; +import org.sakaiproject.tool.assessment.facade.AgentFacade; +import org.sakaiproject.tool.assessment.services.GradingService; +import org.sakaiproject.tool.assessment.services.PublishedItemService; +import org.sakaiproject.tool.assessment.services.assessment.PublishedAssessmentService; +import org.sakaiproject.tool.assessment.ui.bean.evaluation.AgentResults; +import org.sakaiproject.tool.assessment.ui.bean.evaluation.HistogramScoresBean; +import org.sakaiproject.tool.assessment.ui.bean.evaluation.PartData; +import org.sakaiproject.tool.assessment.ui.bean.evaluation.QuestionScoresBean; +import org.sakaiproject.tool.assessment.ui.bean.evaluation.SubmissionStatusBean; +import org.sakaiproject.tool.assessment.ui.bean.evaluation.TotalScoresBean; +import org.sakaiproject.tool.assessment.ui.bean.authz.AuthorizationBean; +import org.sakaiproject.tool.assessment.ui.bean.author.AssessmentBean; +import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; +import org.sakaiproject.tool.assessment.util.BeanSort; +import org.sakaiproject.util.FormattedText; +import org.sakaiproject.util.ResourceLoader; +import org.sakaiproject.component.cover.ServerConfigurationService; + +// end testing + +/** + *

+ * This handles the selection of the Question Score entry page. + *

+ *

+ * Description: Action Listener for Evaluation Question Score front door + *

+ *

+ * Copyright: Copyright (c) 2004 + *

+ *

+ * Organization: Sakai Project + *

+ * + * @author Ed Smiley + * @version $Id: QuestionScoreListener.java 11438 2006-06-30 20:06:03Z + * daisyf@stanford.edu $ + */ + +public class QuestionScoreListener implements ActionListener, + ValueChangeListener { + private static Logger log = LoggerFactory.getLogger(QuestionScoreListener.class); + + // private static EvaluationListenerUtil util; + private static BeanSort bs; + + private static final String noAnswer = (String) ContextUtil + .getLocalizedString( + "org.sakaiproject.tool.assessment.bundle.EvaluationMessages", + "no_answer"); + + /** + * Standard process action method. + * + * @param event + * ActionEvent + * @throws AbortProcessingException + */ + public void processAction(ActionEvent event) + throws AbortProcessingException { + log.debug("QuestionScore LISTENER."); + QuestionScoresBean bean = (QuestionScoresBean) ContextUtil + .lookupBean("questionScores"); + + // Reset the search field + String defaultSearchString = ContextUtil.getLocalizedString( + "org.sakaiproject.tool.assessment.bundle.EvaluationMessages", + "search_default_student_search_string"); + bean.setSearchString(defaultSearchString); + + // we probably want to change the poster to be consistent + String publishedId = ContextUtil.lookupParam("publishedId"); + + AuthorizationBean authzBean = (AuthorizationBean) ContextUtil.lookupBean("authorization"); + AssessmentBean assessmentBean = (AssessmentBean) ContextUtil.lookupBean("assessmentBean"); + PublishedAssessmentService pubService = new PublishedAssessmentService(); + Long pubId = new Long(publishedId); + String assessmentOwner = pubService.getPublishedAssessmentOwner(pubId); + if (!authzBean.isUserAllowedToGradeAssessment(publishedId, assessmentOwner, true)) { + throw new IllegalArgumentException("QuestionScoreListener unauthorized attempt to get scores for " + publishedId); + } + + if (!questionScores(publishedId, bean, false)) { + throw new RuntimeException("failed to call questionScores."); + } + + } + + /** + * Process a value change. + */ + public void processValueChange(ValueChangeEvent event) { + log.debug("QuestionScore CHANGE LISTENER."); + QuestionScoresBean bean = (QuestionScoresBean) ContextUtil.lookupBean("questionScores"); + TotalScoresBean totalBean = (TotalScoresBean) ContextUtil.lookupBean("totalScores"); + HistogramScoresBean histogramBean = (HistogramScoresBean) ContextUtil.lookupBean("histogramScores"); + SubmissionStatusBean submissionbean = (SubmissionStatusBean) ContextUtil.lookupBean("submissionStatus"); + + + // we probably want to change the poster to be consistent + String publishedId = ContextUtil.lookupParam("publishedId"); + boolean toggleSubmissionSelection = false; + + String selectedvalue = (String) event.getNewValue(); + if ((selectedvalue != null) && (!selectedvalue.equals(""))) { + if (event.getComponent().getId().indexOf("sectionpicker") > -1) { + bean.setSelectedSectionFilterValue(selectedvalue); // changed + totalBean.setSelectedSectionFilterValue(selectedvalue); + submissionbean.setSelectedSectionFilterValue(selectedvalue); + } else if (event.getComponent().getId().indexOf("allSubmissions") > -1) { + bean.setAllSubmissions(selectedvalue); // changed submission + // pulldown + totalBean.setAllSubmissions(selectedvalue); // changed for total + // score bean + histogramBean.setAllSubmissions(selectedvalue); // changed for + // histogram + // score bean + toggleSubmissionSelection = true; + } else // inline or popup + { + bean.setSelectedSARationaleView(selectedvalue); // changed + // submission + // pulldown + } + } + + if (!questionScores(publishedId, bean, toggleSubmissionSelection)) { + throw new RuntimeException("failed to call questionScores."); + } + } + + /** + * This will populate the QuestionScoresBean with the data associated with + * the particular versioned assessment based on the publishedId. + * + * @todo Some of this code will change when we move this to Hibernate + * persistence. + * @param publishedId + * String + * @param bean + * QuestionScoresBean + * @return boolean + */ + public boolean questionScores(String publishedId, QuestionScoresBean bean, + boolean isValueChange) { + log.debug("questionScores()"); + try { + PublishedAssessmentService pubService = new PublishedAssessmentService(); + PublishedItemService pubItemService = new PublishedItemService(); + // get the PublishedAssessment based on publishedId + QuestionScoresBean questionBean = (QuestionScoresBean) ContextUtil + .lookupBean("questionScores"); + PublishedAssessmentIfc publishedAssessment = questionBean + .getPublishedAssessment(); + if (publishedAssessment == null) { + publishedAssessment = pubService + .getPublishedAssessment(publishedId); + questionBean.setPublishedAssessment(publishedAssessment); + } + // build a hashMap (publishedItemId, publishedItem) + HashMap publishedItemHash = pubService + .preparePublishedItemHash(publishedAssessment); + log.debug("questionScores(): publishedItemHash.size = " + + publishedItemHash.size()); + // build a hashMap (publishedItemTextId, publishedItemText) + HashMap publishedItemTextHash = pubService + .preparePublishedItemTextHash(publishedAssessment); + log.debug("questionScores(): publishedItemTextHash.size = " + + publishedItemTextHash.size()); + HashMap publishedAnswerHash = pubService + .preparePublishedAnswerHash(publishedAssessment); + // re-attach session and load all lazy loaded parent/child stuff + +// Set publishedAnswerHashKeySet = publishedAnswerHash.keySet(); +// +// for (Long key : publishedAnswerHashKeySet) { +// AnswerIfc answer = (AnswerIfc) publishedAnswerHash.get(key); +// +// if (!Hibernate.isInitialized(answer.getChildAnswerSet())) { +// pubItemService.eagerFetchAnswer(answer); +// } +// } + log.debug("questionScores(): publishedAnswerHash.size = " + + publishedAnswerHash.size()); + HashMap agentResultsByItemGradingIdMap = new HashMap(); + + GradingService delegate = new GradingService(); + + TotalScoresBean totalBean = (TotalScoresBean) ContextUtil + .lookupBean("totalScores"); + + if (ContextUtil.lookupParam("sortBy") != null + && !ContextUtil.lookupParam("sortBy").trim().equals("")) + bean.setSortType(ContextUtil.lookupParam("sortBy")); + + String itemId = ContextUtil.lookupParam("itemId"); + if (ContextUtil.lookupParam("newItemId") != null + && !ContextUtil.lookupParam("newItemId").trim().equals("") + && !ContextUtil.lookupParam("newItemId").trim().equals("null")) + itemId = ContextUtil.lookupParam("newItemId"); + + if (ContextUtil.lookupParam("sortAscending") != null + && !ContextUtil.lookupParam("sortAscending").trim().equals( + "")) { + bean.setSortAscending(Boolean.valueOf( + ContextUtil.lookupParam("sortAscending")) + .booleanValue()); + } + + String which = bean.getAllSubmissions(); + if (which == null && totalBean.getAllSubmissions() != null) { + // use totalscore's selection + which = totalBean.getAllSubmissions(); + bean.setAllSubmissions(which); + } + + totalBean.setSelectedSectionFilterValue(bean + .getSelectedSectionFilterValue()); // set section pulldown + + if (bean.getSelectedSARationaleView() == null) { + // if bean.showSARationaleInLine is null, then set inline to be + // the default + bean.setSelectedSARationaleView(QuestionScoresBean.SHOW_SA_RATIONALE_RESPONSES_INLINE); + } + + if ("true".equalsIgnoreCase(totalBean.getAnonymous())) { + boolean groupRelease = publishedAssessment.getAssessmentAccessControl().getReleaseTo().equals(AssessmentAccessControl.RELEASE_TO_SELECTED_GROUPS); + if (groupRelease) { + totalBean.setSelectedSectionFilterValue(TotalScoresBean.RELEASED_SECTIONS_GROUPS_SELECT_VALUE); + } + else { + totalBean.setSelectedSectionFilterValue(TotalScoresBean.ALL_SECTIONS_SELECT_VALUE); + } + } + + bean.setPublishedId(publishedId); + Date dueDate = null; + + HashMap map = getItemScores(Long.valueOf(publishedId), Long + .valueOf(itemId), which, isValueChange); + log.debug("questionScores(): map .size = " + map.size()); + ResourceLoader rb = null; + ArrayList allscores = new ArrayList(); + Iterator keyiter = map.keySet().iterator(); + while (keyiter.hasNext()) { + allscores.addAll((ArrayList) map.get(keyiter.next())); + } + + log.debug("questionScores(): allscores.size = " + allscores.size()); + + // / + + // now we need filter by sections selected + ArrayList scores = new ArrayList(); // filtered list + Map useridMap = totalBean.getUserIdMap(TotalScoresBean.CALLED_FROM_QUESTION_SCORE_LISTENER); + bean.setUserIdMap(useridMap); + log.debug("questionScores(): useridMap.size = " + useridMap.size()); + + /* + * if ("true".equalsIgnoreCase(totalBean.getAnonymous())){ // skip + * section filter if it is anonymous grading, SAK-4395, + * scores.addAll(allscores); } + */ + if (totalBean.getReleaseToAnonymous()) { + // skip section filter if it's published to anonymous users + scores.addAll(allscores); + } else { + Iterator allscores_iter = allscores.iterator(); + // get the Map of all users(keyed on userid) belong to the + // selected sections + while (allscores_iter.hasNext()) { + // AssessmentGradingData data = (AssessmentGradingData) + // allscores_iter.next(); + ItemGradingData idata = (ItemGradingData) allscores_iter + .next(); + // String agentid = + // idata.getAssessmentGrading().getAgentId(); + String agentid = idata.getAgentId(); + // now we only include scores of users belong to the + // selected sections + if (useridMap.containsKey(agentid)) { + scores.add(idata); + } + } + } + + log.debug("questionScores(): scores.size = " + scores.size()); + + Iterator iter = scores.iterator(); + ArrayList agents = new ArrayList(); + + log.debug("questionScores(): calling populateSections "); + + populateSections(publishedAssessment, bean, totalBean, scores, + pubService); // set up the Q1, Q2... links + if (!iter.hasNext()) { + // this section has no students + log.debug("questionScores(): this section has no students"); + bean.setAgents(agents); + bean.setAllAgents(agents); + bean.setTotalPeople(Integer.toString(bean.getAgents().size())); + bean.setAnonymous(totalBean.getAnonymous()); + //return true; + } + + // List them by item and assessmentgradingid, so we can + // group answers by item and save them for update use. + + HashMap scoresByItem = new HashMap(); + while (iter.hasNext()) { + ItemGradingData idata = (ItemGradingData) iter.next(); + ItemTextIfc pubItemText = (ItemTextIfc) publishedItemTextHash + .get(idata.getPublishedItemTextId()); + AnswerIfc pubAnswer = (AnswerIfc) publishedAnswerHash.get(idata + .getPublishedAnswerId()); + + ArrayList temp = (ArrayList) scoresByItem.get(idata + .getAssessmentGradingId() + + ":" + idata.getPublishedItemId()); + if (temp == null) + temp = new ArrayList(); + + // Very small numbers, so bubblesort is fast + Iterator iter2 = temp.iterator(); + ArrayList newList = new ArrayList(); + boolean added = false; + while (iter2.hasNext()) { + ItemGradingData tmpData = (ItemGradingData) iter2.next(); + ItemTextIfc tmpPublishedText = (ItemTextIfc) publishedItemTextHash + .get(tmpData.getPublishedItemTextId()); + AnswerIfc tmpAnswer = (AnswerIfc) publishedAnswerHash + .get(tmpData.getPublishedAnswerId()); + + if (pubAnswer != null + && tmpAnswer != null + && !added + && (pubItemText.getSequence().intValue() < tmpPublishedText + .getSequence().intValue() || (pubItemText + .getSequence().intValue() == tmpPublishedText + .getSequence().intValue() && pubAnswer + .getSequence().intValue() < tmpAnswer + .getSequence().intValue()))) { + newList.add(idata); + added = true; + } + newList.add(tmpData); + } + if (!added) + newList.add(idata); + scoresByItem.put(idata.getAssessmentGradingId() + ":" + + idata.getPublishedItemId(), newList); + } + log.debug("questionScores(): scoresByItem.size = " + + scoresByItem.size()); + bean.setScoresByItem(scoresByItem); + + try { + bean.setAnonymous(publishedAssessment.getEvaluationModel() + .getAnonymousGrading().equals( + EvaluationModel.ANONYMOUS_GRADING) ? "true" + : "false"); + } catch (RuntimeException e) { + // log.info("No evaluation model."); + bean.setAnonymous("false"); + } + + // below properties don't seem to be used in jsf pages, + try { + bean.setLateHandling(publishedAssessment + .getAssessmentAccessControl().getLateHandling() + .toString()); + } catch (Exception e) { + // log.info("No access control model."); + bean + .setLateHandling(AssessmentAccessControl.NOT_ACCEPT_LATE_SUBMISSION + .toString()); + } + try { + bean.setDueDate(publishedAssessment + .getAssessmentAccessControl().getDueDate().toString()); + dueDate = publishedAssessment.getAssessmentAccessControl() + .getDueDate(); + } catch (RuntimeException e) { + // log.info("No due date."); + bean.setDueDate(new Date().toString()); + } + try { + bean.setMaxScore(publishedAssessment.getEvaluationModel() + .getFixedTotalScore()); + } catch (RuntimeException e) { + double score = (double) 0.0; + Iterator iter2 = publishedAssessment.getSectionArraySorted() + .iterator(); + while (iter2.hasNext()) { + SectionDataIfc sdata = (SectionDataIfc) iter2.next(); + Iterator iter3 = sdata.getItemArraySortedForGrading() + .iterator(); + while (iter3.hasNext()) { + ItemDataIfc idata = (ItemDataIfc) iter3.next(); + if (idata.getItemId().equals(Long.valueOf(itemId))) + score = idata.getScore().doubleValue(); + } + } + bean.setMaxScore(score); + } + + // need to get id from somewhere else, not from data. data only + // contains answered items , we want to return all items. + // ItemDataIfc item = (ItemDataIfc) publishedItemHash.get(data.getPublishedItemId()); + ItemDataIfc item = (ItemDataIfc) publishedItemHash.get(Long.valueOf(itemId)); + + if (item != null) { + log.debug("item!=null steting type id = " + + item.getTypeId().toString()); + bean.setTypeId(item.getTypeId().toString()); + bean.setItemId(item.getItemId().toString()); + bean.setPartName(item.getSection().getSequence().toString()); + bean.setItemName(item.getSequence().toString()); + item.setHint("***"); // Keyword to not show student answer + // for short answer/ essey question, if there is a model short + // answer for this question + // set haveModelShortAnswer to true + if (item.getTypeId().equals(Long.valueOf(5))) { + Iterator iterator = publishedAnswerHash.values().iterator(); + while (iterator.hasNext()) { + PublishedAnswer publishedAnswer = (PublishedAnswer) iterator + .next(); + if (publishedAnswer.getItem().getItemId().equals( + item.getItemId())) { + if (publishedAnswer.getText() == null + || publishedAnswer.getText().equals("")) { + bean.setHaveModelShortAnswer(false); + } else { + bean.setHaveModelShortAnswer(true); + } + break; + } + } + } + } else { + log.debug("item==null "); + } + + ArrayList deliveryItems = new ArrayList(); // so we can use the var + if (item != null) + deliveryItems.add(item); + bean.setDeliveryItem(deliveryItems); + + if (ContextUtil.lookupParam("roleSelection") != null) { + bean.setRoleSelection(ContextUtil.lookupParam("roleSelection")); + } + + if (bean.getSortType() == null) { + if (bean.getAnonymous().equals("true")) { + bean.setSortType("totalAutoScore"); + } else { + bean.setSortType("lastName"); + } + } + + // recordingData encapsulates the inbeanation needed for recording. + // set recording agent, agent assessmentId, + // set course_assignment_context value + // set max tries (0=unlimited), and 30 seconds max length + + // String courseContext = bean.getAssessmentName() + " total "; + + // Note this is HTTP-centric right now, we can't use in Faces + // AuthoringHelper authoringHelper = new AuthoringHelper(); + // authoringHelper.getRemoteUserID() needs servlet stuff + // authoringHelper.getRemoteUserName() needs servlet stuff + + /* Dump the grading and agent information into AgentResults */ + iter = scoresByItem.values().iterator(); + while (iter.hasNext()) { + AgentResults results = new AgentResults(); + // Get all the answers for this question to put in one grading + // row + ArrayList answerList = (ArrayList) iter.next(); + results.setItemGradingArrayList(answerList); + // The list is sorted by answer id so that it will come back from the student in a + // predictable order. This is also required by the getCalcQResult method. + Collections.sort(answerList, new Comparator() { + public int compare(ItemGradingData i1, ItemGradingData i2) { + return i1.getPublishedAnswerId().compareTo( + i2.getPublishedAnswerId()); + } + }); + Iterator iter2 = answerList.iterator(); + ArrayList itemGradingAttachmentList = new ArrayList(); + HashMap> fibmap = new HashMap>(); + int i = 1; + HashMap answersMap = new HashMap(); + while (iter2.hasNext()) { + ItemGradingData gdata = (ItemGradingData) iter2.next(); + results.setItemGrading(gdata); + delegate.extractCalcQAnswersArray(answersMap, item, + gdata.getAssessmentGradingId(), gdata.getAgentId()); + itemGradingAttachmentList.addAll(gdata.getItemGradingAttachmentList()); + agentResultsByItemGradingIdMap.put(gdata.getItemGradingId(), results); + + ItemTextIfc gdataPubItemText = (ItemTextIfc) publishedItemTextHash + .get(gdata.getPublishedItemTextId()); + AnswerIfc gdataAnswer = (AnswerIfc) publishedAnswerHash + .get(gdata.getPublishedAnswerId()); + + // This all just gets the text of the answer to display + String answerText = noAnswer; + String rationale = ""; + String fullAnswerText = noAnswer; + + // Answer Key and Decimal Places for Calculated Questions + String answerKey = noAnswer; + int decimalPlaces; + + // if question type = MC, MR, Survey, TF, Matching, if user + // has not submit an answer + // answerText = noAnswer. These question type do not use the + // itemGrading.answerText field for + // storing answers, thye use temGrading.publishedAnswerId to + // make their selection + if (bean.getTypeId().equals("1") + || bean.getTypeId().equals("2") + || bean.getTypeId().equals("12") + || bean.getTypeId().equals("3") + || bean.getTypeId().equals("4") + || bean.getTypeId().equals("9") + || bean.getTypeId().equals("13")) { + if (gdataAnswer != null) + answerText = gdataAnswer.getText(); + } else { + // this handles the other question types: SAQ, File + // upload, Audio, FIB, Fill in Numeric + // These question type use itemGrading.answetText to + // store information about their answer + if ((bean.getTypeId().equals("8") || bean.getTypeId().equals("11") || bean.getTypeId().equals("14")) && gdataAnswer == null) { + answerText = ""; + } + else if (bean.getTypeId().equals("14")) {//gopalrc - EMI + answerText = gdataPubItemText.getSequence() + ": " + gdataAnswer.getLabel(); + } + else { + answerText = gdata.getAnswerText(); + } + } + + if ("4".equals(bean.getTypeId())) { + if (rb == null) { + rb = new ResourceLoader("org.sakaiproject.tool.assessment.bundle.EvaluationMessages"); + } + if ("true".equals(answerText)) { + answerText = rb.getString("true_msg"); + } + else if ("false".equals(answerText)) { + answerText = rb.getString("false_msg"); + } + } + + if (bean.getTypeId().equals("9")) { + if (gdataPubItemText == null) { + // the matching pair is deleted + answerText = ""; + } + else { + answerText = gdataPubItemText.getSequence() + ":" + + answerText; + } + } + + if (bean.getTypeId().equals("8")) { + if (gdataAnswer != null && gdataAnswer.getSequence() != null) { + answerText = gdataAnswer.getSequence() + ":" + + answerText; + } + } + + if (bean.getTypeId().equals("11")) { + if (gdataAnswer != null && gdataAnswer.getSequence() != null) { + answerText = gdataAnswer.getSequence() + ":" + + answerText; + } + } + if (bean.getTypeId().equals("13")) { + if (gdataPubItemText == null) { + answerText = ""; + } + else { + int answerNo = gdataPubItemText.getSequence().intValue(); + answerText = answerNo + ":" + answerText; + } + } + // file upload + if (bean.getTypeId().equals("6")) { + gdata.setMediaArray(delegate.getMediaArray2(gdata + .getItemGradingId().toString())); + } + + // audio recording + if (bean.getTypeId().equals("7")) { + ArrayList mediaList = delegate.getMediaArray2(gdata + .getItemGradingId().toString()); + setDurationIsOver(item, mediaList); + gdata.setMediaArray(mediaList); + } + if (bean.getTypeId().equals("16")) { + if (gdataPubItemText == null) { + // the matching pair is deleted + answerText = ""; + } + else { + answerText = gdataPubItemText.getSequence() + ":"+ answerText; + } + } + if (answerText == null) + answerText = noAnswer; + else { + if (gdata.getRationale() != null + && !gdata.getRationale().trim().equals("")) + rationale = "\nRationale: " + gdata.getRationale(); + } + // Huong's temp commandout + // answerText = answerText.replaceAll("<.*?>", ""); + answerText = answerText.replaceAll("(\r\n|\r)", "
"); + rationale = rationale.replaceAll("<.*?>", ""); + rationale = rationale.replaceAll("(\r\n|\r)", "
"); + fullAnswerText = answerText; // this is the + // non-abbreviated answers + // for essay questions int answerTextLength = ServerConfigurationService.getInt("samigo.questionScore.answerText.length", 1000); if (bean.getTypeId().equals("5")) { answerTextLength = 35; } - // Fix for SAK-6932: Strip out all HTML tags except image tags - if (answerText.length() > answerTextLength) { - String noHTMLAnswerText; - noHTMLAnswerText = answerText.replaceAll( - "<((..?)|([^iI][^mM][^gG].*?))>", ""); - - int index = noHTMLAnswerText.toLowerCase().indexOf( - " answerTextLength) { - answerText = noHTMLAnswerText.substring(0, answerTextLength) - + "..."; - } else { - answerText = noHTMLAnswerText; - } - } - } - /* - * // no need to shorten it if (rationale.length() > 35) - * rationale = rationale.substring(0, 35) + "..."; - */ - - //SAM-755-"checkmark" indicates right, add "X" to indicate wrong - if (gdataAnswer != null) { - String checkmarkGif = ""; - String crossmarkGif = ""; - answerText = FormattedText.escapeHtml(answerText, true); - if (bean.getTypeId().equals("8") || bean.getTypeId().equals("11")) { - if (gdata.getIsCorrect() == null) { - boolean result = false; - if (bean.getTypeId().equals("8")) { - result = delegate.getFIBResult(gdata, fibmap, item, publishedAnswerHash); - } - else { - result = delegate.getFINResult(gdata, item, publishedAnswerHash); - } - - if (result) { - answerText = checkmarkGif + answerText; - } else { - answerText = crossmarkGif + answerText; - } - } - else { - if (gdata.getIsCorrect().booleanValue()) { - answerText = checkmarkGif + answerText; - } - else { - answerText = crossmarkGif + answerText; - } - } - } - else if (bean.getTypeId().equals("15")) { // CALCULATED_QUESTION - // Answers Keys - answerKey = (String)answersMap.get(i); - decimalPlaces = Integer.valueOf(answerKey.substring(answerKey.indexOf(',')+1, answerKey.length())); - answerKey = answerKey.substring(0, answerKey.indexOf("|")); // cut off extra data e.g. "|2,3" - // We need the key formatted in scientificNotation - answerKey = delegate.toScientificNotation(answerKey, decimalPlaces); - - // Answers - if (delegate.getCalcQResult(gdata, item, answersMap, i++)) { - answerText = checkmarkGif + answerText; - } else { - answerText = crossmarkGif + answerText; - } - } - else if(!bean.getTypeId().equals("3")){ - if((gdataAnswer.getIsCorrect() != null && gdataAnswer.getIsCorrect()) || - (gdataAnswer.getPartialCredit() != null && gdataAnswer.getPartialCredit() > 0)){ - answerText = checkmarkGif + answerText; - }else if(gdataAnswer.getIsCorrect() != null && !gdataAnswer.getIsCorrect()){ - answerText = crossmarkGif + answerText; - } - } - } - - // -- Got the answer text -- - if (!answerList.get(0).equals(gdata)) { // We already have - // an agentResults - // for this one - results.setAnswer(results.getAnswer() + "
" - + answerText); - if (gdata.getAutoScore() != null) { - results.setTotalAutoScore(Double.toString((Double.valueOf( - results.getExactTotalAutoScore())).doubleValue() - + gdata.getAutoScore().doubleValue())); - } - else { - results.setTotalAutoScore(Double.toString((Double.valueOf( - results.getExactTotalAutoScore())).doubleValue())); - } - results.setItemGradingAttachmentList(itemGradingAttachmentList); - if (bean.getTypeId().equals("15")){ // CALCULATED_QUESTION Answer Key - results.setAnswerKey(results.getAnswerKey()+ "
" + answerKey); - } - } else { - results.setItemGradingId(gdata.getItemGradingId()); - results.setAssessmentGradingId(gdata - .getAssessmentGradingId()); - if (gdata.getAutoScore() != null) { - // for example, if an assessment has one fileupload - // question, the autoscore = null - results.setTotalAutoScore(gdata.getAutoScore() - .toString()); - } else { - results.setTotalAutoScore(Double.toString(0)); - } - results.setComments(FormattedText.convertFormattedTextToPlaintext(gdata.getComments())); - results.setAnswer(answerText); - if (bean.getTypeId().equals("15")){ // CALCULATED_QUESTION Answer Key - results.setAnswerKey(answerKey); - } - results.setFullAnswer(fullAnswerText); - results.setRationale(rationale); - results.setSubmittedDate(gdata.getSubmittedDate()); - - AgentFacade agent = new AgentFacade(gdata.getAgentId()); - // log.info("Rachel: agentid = " + gdata.getAgentId()); - results.setLastName(agent.getLastName()); - results.setFirstName(agent.getFirstName()); - results.setEmail(agent.getEmail()); - if (results.getLastName() != null - && results.getLastName().length() > 0) - results.setLastInitial(results.getLastName() - .substring(0, 1)); - else if (results.getFirstName() != null - && results.getFirstName().length() > 0) - results.setLastInitial(results.getFirstName() - .substring(0, 1)); - else - results.setLastInitial("Anonymous"); - results.setIdString(agent.getIdString()); - results.setAgentEid(agent.getEidString()); - results.setAgentDisplayId(agent.getDisplayIdString()); - log.debug("testing agent getEid agent.getFirstname= " - + agent.getFirstName()); - log.debug("testing agent getEid agent.getid= " - + agent.getIdString()); - log.debug("testing agent getEid agent.geteid = " - + agent.getEidString()); - log.debug("testing agent getDisplayId agent.getdisplayid = " - + agent.getDisplayIdString()); - - results.setRole(agent.getRole()); - results.setItemGradingAttachmentList(itemGradingAttachmentList); - agents.add(results); - } - } - } - - // log.info("Sort type is " + bean.getSortType() + "."); - bs = new BeanSort(agents, bean.getSortType()); - if ((bean.getSortType()).equals("assessmentGradingId") - || (bean.getSortType()).equals("totalAutoScore") - || (bean.getSortType()).equals("totalOverrideScore") - || (bean.getSortType()).equals("finalScore")) { - bs.toNumericSort(); - } else { - bs.toStringSort(); - } - - if (bean.isSortAscending()) { - log.debug("sortAscending"); - agents = (ArrayList) bs.sort(); - } else { - log.debug("!sortAscending"); - agents = (ArrayList) bs.sortDesc(); - } - - // log.info("Listing agents."); - bean.setAgents(agents); - bean.setAllAgents(agents); - bean - .setTotalPeople(Integer.valueOf(bean.getAgents().size()) - .toString()); - bean.setAgentResultsByItemGradingId(agentResultsByItemGradingIdMap); - } - - catch (RuntimeException e) { - e.printStackTrace(); - return false; - } - - return true; - } - - /** - * getting a list of itemGrading for a publishedItemId is a lot of work, - * read the code in GradingService.getItemScores() after we get the list, we - * are saving it in QuestionScoreBean.itemScoresMap itemScoresMap = - * (publishedItemId, HashMap) = (Long publishedItemId, (Long - * publishedItemId, Array itemGradings)) itemScoresMap will be refreshed - * when the next QuestionScore link is click - */ - private HashMap getItemScores(Long publishedId, Long itemId, String which, - boolean isValueChange) { - log.debug("getItemScores"); - GradingService delegate = new GradingService(); - QuestionScoresBean questionScoresBean = (QuestionScoresBean) ContextUtil - .lookupBean("questionScores"); - HashMap itemScoresMap = questionScoresBean.getItemScoresMap(); - log.debug("getItemScores: itemScoresMap ==null ?" + itemScoresMap); - log.debug("getItemScores: isValueChange ?" + isValueChange); - - if (itemScoresMap == null || isValueChange || questionScoresBean.getIsAnyItemGradingAttachmentListModified()) { - log - .debug("getItemScores: itemScoresMap == null or isValueChange == true "); - log.debug("getItemScores: isValueChange = " + isValueChange); - itemScoresMap = new HashMap(); - questionScoresBean.setItemScoresMap(itemScoresMap); - // reset this anyway (because the itemScoresMap will be refreshed as well as the - // attachment list) - questionScoresBean.setIsAnyItemGradingAttachmentListModified(false); - } - log - .debug("getItemScores: itemScoresMap.size() " - + itemScoresMap.size()); - HashMap map = (HashMap) itemScoresMap.get(itemId); - if (map == null) { - log.debug("getItemScores: map == null "); - map = delegate.getItemScores(publishedId, itemId, which, true); - log.debug("getItemScores: map size " + map.size()); - itemScoresMap.put(itemId, map); - } - return map; - } - - private void setDurationIsOver(ItemDataIfc item, ArrayList mediaList) { - try { - int maxDurationAllowed = item.getDuration().intValue(); - for (int i = 0; i < mediaList.size(); i++) { - MediaData m = (MediaData) mediaList.get(i); - double duration = (Double.valueOf(m.getDuration())).doubleValue(); - if (duration > maxDurationAllowed) { - m.setDurationIsOver(true); - m.setTimeAllowed(String.valueOf(maxDurationAllowed)); - } else - m.setDurationIsOver(false); - } - } catch (Exception e) { - log.warn("**duration recorded is not an integer value=" - + e.getMessage()); - } - } - - private void populateSections(PublishedAssessmentIfc publishedAssessment, - QuestionScoresBean bean, TotalScoresBean totalBean, - ArrayList scores, PublishedAssessmentService pubService) { - ArrayList sections = new ArrayList(); - log - .debug("questionScores(): populate sctions publishedAssessment.getSectionArraySorted size = " - + publishedAssessment.getSectionArraySorted().size()); - Iterator iter = publishedAssessment.getSectionArraySorted().iterator(); - int i = 1; - while (iter.hasNext()) { - SectionDataIfc section = (SectionDataIfc) iter.next(); - ArrayList items = new ArrayList(); - PartData part = new PartData(); - boolean isRandomDrawPart = pubService.isRandomDrawPart( - publishedAssessment.getPublishedAssessmentId(), section - .getSectionId()); - part.setIsRandomDrawPart(isRandomDrawPart); - part.setPartNumber("" + i); - part.setId(section.getSectionId().toString()); - - if (isRandomDrawPart) { - if (section.getSectionMetaDataByLabel(SectionDataIfc.NUM_QUESTIONS_DRAWN) !=null ) { - int numberToBeDrawn = Integer.parseInt(section.getSectionMetaDataByLabel(SectionDataIfc.NUM_QUESTIONS_DRAWN)); - part.setNumberQuestionsDraw(numberToBeDrawn); - } - PublishedAssessmentService publishedAssessmentService = new PublishedAssessmentService(); - HashSet itemSet = publishedAssessmentService.getPublishedItemSet(publishedAssessment - .getPublishedAssessmentId(), section.getSectionId()); - section.setItemSet(itemSet); - } - else { - GradingService gradingService = new GradingService(); - HashSet itemSet = gradingService.getItemSet(publishedAssessment - .getPublishedAssessmentId(), section.getSectionId()); - section.setItemSet(itemSet); - } - Iterator iter2 = section.getItemArraySortedForGrading().iterator(); - int j = 1; - while (iter2.hasNext()) { - ItemDataIfc item = (ItemDataIfc) iter2.next(); - PartData partitem = new PartData(); - - partitem.setPartNumber("" + j); - partitem.setId(item.getItemId().toString()); - log.debug("* item.getId = " + item.getItemId()); - partitem.setLinked(true); - - // Iterator iter3 = scores.iterator(); - items.add(partitem); - j++; - } - log.debug("questionScores(): items size = " + items.size()); - part.setQuestionNumberList(items); - sections.add(part); - i++; - } - log.debug("questionScores(): sections size = " + sections.size()); - bean.setSections(sections); - } -} + // Fix for SAK-6932: Strip out all HTML tags except image tags + if (answerText.length() > answerTextLength) { + String noHTMLAnswerText; + noHTMLAnswerText = answerText.replaceAll( + "<((..?)|([^iI][^mM][^gG].*?))>", ""); + + int index = noHTMLAnswerText.toLowerCase().indexOf( + " answerTextLength) { + answerText = noHTMLAnswerText.substring(0, answerTextLength) + + "..."; + } else { + answerText = noHTMLAnswerText; + } + } + } + /* + * // no need to shorten it if (rationale.length() > 35) + * rationale = rationale.substring(0, 35) + "..."; + */ + + //SAM-755-"checkmark" indicates right, add "X" to indicate wrong + if (gdataAnswer != null) { + String checkmarkGif = ""; + String crossmarkGif = ""; + answerText = FormattedText.escapeHtml(answerText, true); + if (bean.getTypeId().equals("8") || bean.getTypeId().equals("11")) { + if (gdata.getIsCorrect() == null) { + boolean result = false; + if (bean.getTypeId().equals("8")) { + result = delegate.getFIBResult(gdata, fibmap, item, publishedAnswerHash); + } + else { + result = delegate.getFINResult(gdata, item, publishedAnswerHash); + } + + if (result) { + answerText = checkmarkGif + answerText; + } else { + answerText = crossmarkGif + answerText; + } + } + else { + if (gdata.getIsCorrect().booleanValue()) { + answerText = checkmarkGif + answerText; + } + else { + answerText = crossmarkGif + answerText; + } + } + } + else if (bean.getTypeId().equals("15")) { // CALCULATED_QUESTION + // Answers Keys + answerKey = (String)answersMap.get(i); + decimalPlaces = Integer.valueOf(answerKey.substring(answerKey.indexOf(',')+1, answerKey.length())); + answerKey = answerKey.substring(0, answerKey.indexOf("|")); // cut off extra data e.g. "|2,3" + // We need the key formatted in scientificNotation + answerKey = delegate.toScientificNotation(answerKey, decimalPlaces); + + // Answers + if (delegate.getCalcQResult(gdata, item, answersMap, i++)) { + answerText = checkmarkGif + answerText; + } else { + answerText = crossmarkGif + answerText; + } + } + else if(!bean.getTypeId().equals("3")){ + if((gdataAnswer.getIsCorrect() != null && gdataAnswer.getIsCorrect()) || + (gdataAnswer.getPartialCredit() != null && gdataAnswer.getPartialCredit() > 0)){ + answerText = checkmarkGif + answerText; + }else if(gdataAnswer.getIsCorrect() != null && !gdataAnswer.getIsCorrect()){ + answerText = crossmarkGif + answerText; + } + } + } + + // -- Got the answer text -- + if (!answerList.get(0).equals(gdata)) { // We already have + // an agentResults + // for this one + results.setAnswer(results.getAnswer() + "
" + + answerText); + if (gdata.getAutoScore() != null) { + results.setTotalAutoScore(Double.toString((Double.valueOf( + results.getExactTotalAutoScore())).doubleValue() + + gdata.getAutoScore().doubleValue())); + } + else { + results.setTotalAutoScore(Double.toString((Double.valueOf( + results.getExactTotalAutoScore())).doubleValue())); + } + results.setItemGradingAttachmentList(itemGradingAttachmentList); + if (bean.getTypeId().equals("15")){ // CALCULATED_QUESTION Answer Key + results.setAnswerKey(results.getAnswerKey()+ "
" + answerKey); + } + } else { + results.setItemGradingId(gdata.getItemGradingId()); + results.setAssessmentGradingId(gdata + .getAssessmentGradingId()); + if (gdata.getAutoScore() != null) { + // for example, if an assessment has one fileupload + // question, the autoscore = null + results.setTotalAutoScore(gdata.getAutoScore() + .toString()); + } else { + results.setTotalAutoScore(Double.toString(0)); + } + results.setComments(FormattedText.convertFormattedTextToPlaintext(gdata.getComments())); + results.setAnswer(answerText); + if (bean.getTypeId().equals("15")){ // CALCULATED_QUESTION Answer Key + results.setAnswerKey(answerKey); + } + results.setFullAnswer(fullAnswerText); + results.setRationale(rationale); + results.setSubmittedDate(gdata.getSubmittedDate()); + + AgentFacade agent = new AgentFacade(gdata.getAgentId()); + // log.info("Rachel: agentid = " + gdata.getAgentId()); + results.setLastName(agent.getLastName()); + results.setFirstName(agent.getFirstName()); + results.setEmail(agent.getEmail()); + if (results.getLastName() != null + && results.getLastName().length() > 0) + results.setLastInitial(results.getLastName() + .substring(0, 1)); + else if (results.getFirstName() != null + && results.getFirstName().length() > 0) + results.setLastInitial(results.getFirstName() + .substring(0, 1)); + else + results.setLastInitial("Anonymous"); + results.setIdString(agent.getIdString()); + results.setAgentEid(agent.getEidString()); + results.setAgentDisplayId(agent.getDisplayIdString()); + log.debug("testing agent getEid agent.getFirstname= " + + agent.getFirstName()); + log.debug("testing agent getEid agent.getid= " + + agent.getIdString()); + log.debug("testing agent getEid agent.geteid = " + + agent.getEidString()); + log.debug("testing agent getDisplayId agent.getdisplayid = " + + agent.getDisplayIdString()); + + results.setRole(agent.getRole()); + results.setItemGradingAttachmentList(itemGradingAttachmentList); + agents.add(results); + } + } + } + + // log.info("Sort type is " + bean.getSortType() + "."); + bs = new BeanSort(agents, bean.getSortType()); + if ((bean.getSortType()).equals("assessmentGradingId") + || (bean.getSortType()).equals("totalAutoScore") + || (bean.getSortType()).equals("totalOverrideScore") + || (bean.getSortType()).equals("finalScore")) { + bs.toNumericSort(); + } else { + bs.toStringSort(); + } + + if (bean.isSortAscending()) { + log.debug("sortAscending"); + agents = (ArrayList) bs.sort(); + } else { + log.debug("!sortAscending"); + agents = (ArrayList) bs.sortDesc(); + } + + // log.info("Listing agents."); + bean.setAgents(agents); + bean.setAllAgents(agents); + bean + .setTotalPeople(Integer.valueOf(bean.getAgents().size()) + .toString()); + bean.setAgentResultsByItemGradingId(agentResultsByItemGradingIdMap); + } + + catch (RuntimeException e) { + e.printStackTrace(); + return false; + } + + return true; + } + + /** + * getting a list of itemGrading for a publishedItemId is a lot of work, + * read the code in GradingService.getItemScores() after we get the list, we + * are saving it in QuestionScoreBean.itemScoresMap itemScoresMap = + * (publishedItemId, HashMap) = (Long publishedItemId, (Long + * publishedItemId, Array itemGradings)) itemScoresMap will be refreshed + * when the next QuestionScore link is click + */ + private HashMap getItemScores(Long publishedId, Long itemId, String which, + boolean isValueChange) { + log.debug("getItemScores"); + GradingService delegate = new GradingService(); + QuestionScoresBean questionScoresBean = (QuestionScoresBean) ContextUtil + .lookupBean("questionScores"); + HashMap itemScoresMap = questionScoresBean.getItemScoresMap(); + log.debug("getItemScores: itemScoresMap ==null ?" + itemScoresMap); + log.debug("getItemScores: isValueChange ?" + isValueChange); + + if (itemScoresMap == null || isValueChange || questionScoresBean.getIsAnyItemGradingAttachmentListModified()) { + log + .debug("getItemScores: itemScoresMap == null or isValueChange == true "); + log.debug("getItemScores: isValueChange = " + isValueChange); + itemScoresMap = new HashMap(); + questionScoresBean.setItemScoresMap(itemScoresMap); + // reset this anyway (because the itemScoresMap will be refreshed as well as the + // attachment list) + questionScoresBean.setIsAnyItemGradingAttachmentListModified(false); + } + log + .debug("getItemScores: itemScoresMap.size() " + + itemScoresMap.size()); + HashMap map = (HashMap) itemScoresMap.get(itemId); + if (map == null) { + log.debug("getItemScores: map == null "); + map = delegate.getItemScores(publishedId, itemId, which, true); + log.debug("getItemScores: map size " + map.size()); + itemScoresMap.put(itemId, map); + } + return map; + } + + private void setDurationIsOver(ItemDataIfc item, ArrayList mediaList) { + try { + int maxDurationAllowed = item.getDuration().intValue(); + for (int i = 0; i < mediaList.size(); i++) { + MediaData m = (MediaData) mediaList.get(i); + double duration = (Double.valueOf(m.getDuration())).doubleValue(); + if (duration > maxDurationAllowed) { + m.setDurationIsOver(true); + m.setTimeAllowed(String.valueOf(maxDurationAllowed)); + } else + m.setDurationIsOver(false); + } + } catch (Exception e) { + log.warn("**duration recorded is not an integer value=" + + e.getMessage()); + } + } + + private void populateSections(PublishedAssessmentIfc publishedAssessment, + QuestionScoresBean bean, TotalScoresBean totalBean, + ArrayList scores, PublishedAssessmentService pubService) { + ArrayList sections = new ArrayList(); + log + .debug("questionScores(): populate sctions publishedAssessment.getSectionArraySorted size = " + + publishedAssessment.getSectionArraySorted().size()); + Iterator iter = publishedAssessment.getSectionArraySorted().iterator(); + int i = 1; + while (iter.hasNext()) { + SectionDataIfc section = (SectionDataIfc) iter.next(); + ArrayList items = new ArrayList(); + PartData part = new PartData(); + boolean isRandomDrawPart = pubService.isRandomDrawPart( + publishedAssessment.getPublishedAssessmentId(), section + .getSectionId()); + part.setIsRandomDrawPart(isRandomDrawPart); + part.setPartNumber("" + i); + part.setId(section.getSectionId().toString()); + + if (isRandomDrawPart) { + if (section.getSectionMetaDataByLabel(SectionDataIfc.NUM_QUESTIONS_DRAWN) !=null ) { + int numberToBeDrawn = Integer.parseInt(section.getSectionMetaDataByLabel(SectionDataIfc.NUM_QUESTIONS_DRAWN)); + part.setNumberQuestionsDraw(numberToBeDrawn); + } + PublishedAssessmentService publishedAssessmentService = new PublishedAssessmentService(); + HashSet itemSet = publishedAssessmentService.getPublishedItemSet(publishedAssessment + .getPublishedAssessmentId(), section.getSectionId()); + section.setItemSet(itemSet); + } + else { + GradingService gradingService = new GradingService(); + HashSet itemSet = gradingService.getItemSet(publishedAssessment + .getPublishedAssessmentId(), section.getSectionId()); + section.setItemSet(itemSet); + } + Iterator iter2 = section.getItemArraySortedForGrading().iterator(); + int j = 1; + while (iter2.hasNext()) { + ItemDataIfc item = (ItemDataIfc) iter2.next(); + PartData partitem = new PartData(); + + partitem.setPartNumber("" + j); + partitem.setId(item.getItemId().toString()); + log.debug("* item.getId = " + item.getItemId()); + partitem.setLinked(true); + + // Iterator iter3 = scores.iterator(); + items.add(partitem); + j++; + } + log.debug("questionScores(): items size = " + items.size()); + part.setQuestionNumberList(items); + sections.add(part); + i++; + } + log.debug("questionScores(): sections size = " + sections.size()); + bean.setSections(sections); + } +} diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/QuestionScorePagerListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/QuestionScorePagerListener.java index 2690214ed8b5..792df0e6a42f 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/QuestionScorePagerListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/QuestionScorePagerListener.java @@ -1,8 +1,8 @@ -/********************************************************************************** - * $URL$ - * $Id$ - *********************************************************************************** - * +/********************************************************************************** + * $URL$ + * $Id$ + *********************************************************************************** + * * Copyright (c) 2004, 2005, 2006, 2008 The Sakai Foundation * * Licensed under the Educational Community License, Version 2.0 (the "License"); @@ -16,112 +16,112 @@ * 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.sakaiproject.tool.assessment.ui.listener.evaluation; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; - -import javax.faces.event.AbortProcessingException; -import javax.faces.event.ActionEvent; -import javax.faces.event.ActionListener; -import javax.faces.event.ValueChangeEvent; -import javax.faces.event.ValueChangeListener; -import javax.faces.application.FacesMessage; -import javax.faces.context.FacesContext; - - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.sakaiproject.tool.assessment.data.dao.grading.ItemGradingData; -import org.sakaiproject.tool.assessment.services.GradingService; -import org.sakaiproject.tool.assessment.services.GradebookServiceException; -import org.sakaiproject.tool.assessment.services.assessment.PublishedAssessmentService; -import org.sakaiproject.tool.assessment.ui.bean.evaluation.AgentResults; -import org.sakaiproject.tool.assessment.ui.bean.evaluation.HistogramScoresBean; -import org.sakaiproject.tool.assessment.ui.bean.evaluation.QuestionScoresBean; -import org.sakaiproject.tool.assessment.ui.bean.evaluation.TotalScoresBean; -import org.sakaiproject.tool.assessment.ui.listener.evaluation.util.EvaluationListenerUtil; -import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; -import org.sakaiproject.tool.assessment.util.BeanSort; - -/** - *

- * This handles the updating of the Question Score page. - *

- *

Description: Action Listener Evaluation Updating Question Score front door

- *

Copyright: Copyright (c) 2004

- *

Organization: Sakai Project

- * @author Ed Smiley - * @version $Id$ - */ - -public class QuestionScorePagerListener - implements ActionListener, ValueChangeListener -{ - private static Log log = LogFactory.getLog(QuestionScorePagerListener.class); - //private static EvaluationListenerUtil util; - //private static BeanSort bs; - //private static ContextUtil cu; - - /** - * Standard process action method. - * @param event ActionEvent - * @throws AbortProcessingException - */ - public void processAction(ActionEvent event) throws - AbortProcessingException - { - log.debug("processAction"); - QuestionScoresBean bean = (QuestionScoresBean)ContextUtil.lookupBean("questionScores"); - setMaxDisplayedScoreRows(bean, false); - } - - /** - * Process a value change. - */ - public void processValueChange(ValueChangeEvent event) - { - log.debug("processValueChange"); - QuestionScoresBean bean = (QuestionScoresBean)ContextUtil.lookupBean("questionScores"); - setMaxDisplayedScoreRows(bean, true); - } - - private void setMaxDisplayedScoreRows(QuestionScoresBean bean, boolean isValueChange) { - PublishedAssessmentService pubService = new PublishedAssessmentService(); - String itemId = ContextUtil.lookupParam("itemId"); - if (ContextUtil.lookupParam("newItemId") != null && !ContextUtil.lookupParam("newItemId").trim().equals("")) { - itemId = ContextUtil.lookupParam("newItemId"); - } - Long itemType = pubService.getItemType(itemId); - // For audiio question, default the paging number to 5 - if (isValueChange) { - if (itemType.equals(Long.valueOf("7"))){ - bean.setAudioMaxDisplayedScoreRows(bean.getMaxDisplayedRows()); - bean.setHasAudioMaxDisplayedScoreRowsChanged(true); - } - else { - bean.setOtherMaxDisplayedScoreRows(bean.getMaxDisplayedRows()); - } - } - else { - if (itemType.equals(Long.valueOf("7"))){ - if (bean.getHasAudioMaxDisplayedScoreRowsChanged()) { - bean.setMaxDisplayedRows(bean.getAudioMaxDisplayedScoreRows()); - } - else { - bean.setMaxDisplayedRows(5); - bean.setAudioMaxDisplayedScoreRows(5); - } - } - else { - bean.setMaxDisplayedRows(bean.getOtherMaxDisplayedScoreRows()); - } - } - } -} + * + **********************************************************************************/ + + + +package org.sakaiproject.tool.assessment.ui.listener.evaluation; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; + +import javax.faces.event.AbortProcessingException; +import javax.faces.event.ActionEvent; +import javax.faces.event.ActionListener; +import javax.faces.event.ValueChangeEvent; +import javax.faces.event.ValueChangeListener; +import javax.faces.application.FacesMessage; +import javax.faces.context.FacesContext; + + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sakaiproject.tool.assessment.data.dao.grading.ItemGradingData; +import org.sakaiproject.tool.assessment.services.GradingService; +import org.sakaiproject.tool.assessment.services.GradebookServiceException; +import org.sakaiproject.tool.assessment.services.assessment.PublishedAssessmentService; +import org.sakaiproject.tool.assessment.ui.bean.evaluation.AgentResults; +import org.sakaiproject.tool.assessment.ui.bean.evaluation.HistogramScoresBean; +import org.sakaiproject.tool.assessment.ui.bean.evaluation.QuestionScoresBean; +import org.sakaiproject.tool.assessment.ui.bean.evaluation.TotalScoresBean; +import org.sakaiproject.tool.assessment.ui.listener.evaluation.util.EvaluationListenerUtil; +import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; +import org.sakaiproject.tool.assessment.util.BeanSort; + +/** + *

+ * This handles the updating of the Question Score page. + *

+ *

Description: Action Listener Evaluation Updating Question Score front door

+ *

Copyright: Copyright (c) 2004

+ *

Organization: Sakai Project

+ * @author Ed Smiley + * @version $Id$ + */ + +public class QuestionScorePagerListener + implements ActionListener, ValueChangeListener +{ + private static Logger log = LoggerFactory.getLogger(QuestionScorePagerListener.class); + //private static EvaluationListenerUtil util; + //private static BeanSort bs; + //private static ContextUtil cu; + + /** + * Standard process action method. + * @param event ActionEvent + * @throws AbortProcessingException + */ + public void processAction(ActionEvent event) throws + AbortProcessingException + { + log.debug("processAction"); + QuestionScoresBean bean = (QuestionScoresBean)ContextUtil.lookupBean("questionScores"); + setMaxDisplayedScoreRows(bean, false); + } + + /** + * Process a value change. + */ + public void processValueChange(ValueChangeEvent event) + { + log.debug("processValueChange"); + QuestionScoresBean bean = (QuestionScoresBean)ContextUtil.lookupBean("questionScores"); + setMaxDisplayedScoreRows(bean, true); + } + + private void setMaxDisplayedScoreRows(QuestionScoresBean bean, boolean isValueChange) { + PublishedAssessmentService pubService = new PublishedAssessmentService(); + String itemId = ContextUtil.lookupParam("itemId"); + if (ContextUtil.lookupParam("newItemId") != null && !ContextUtil.lookupParam("newItemId").trim().equals("")) { + itemId = ContextUtil.lookupParam("newItemId"); + } + Long itemType = pubService.getItemType(itemId); + // For audiio question, default the paging number to 5 + if (isValueChange) { + if (itemType.equals(Long.valueOf("7"))){ + bean.setAudioMaxDisplayedScoreRows(bean.getMaxDisplayedRows()); + bean.setHasAudioMaxDisplayedScoreRowsChanged(true); + } + else { + bean.setOtherMaxDisplayedScoreRows(bean.getMaxDisplayedRows()); + } + } + else { + if (itemType.equals(Long.valueOf("7"))){ + if (bean.getHasAudioMaxDisplayedScoreRowsChanged()) { + bean.setMaxDisplayedRows(bean.getAudioMaxDisplayedScoreRows()); + } + else { + bean.setMaxDisplayedRows(5); + bean.setAudioMaxDisplayedScoreRows(5); + } + } + else { + bean.setMaxDisplayedRows(bean.getOtherMaxDisplayedScoreRows()); + } + } + } +} diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/QuestionScoreUpdateListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/QuestionScoreUpdateListener.java index be301f57b3a6..41eb5bbe8ee6 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/QuestionScoreUpdateListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/QuestionScoreUpdateListener.java @@ -37,8 +37,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.math.util.MathUtils; import org.sakaiproject.event.cover.EventTrackingService; import org.sakaiproject.tool.assessment.data.dao.grading.ItemGradingAttachment; @@ -67,7 +67,7 @@ public class QuestionScoreUpdateListener implements ActionListener { - private static Log log = LogFactory.getLog(QuestionScoreUpdateListener.class); + private static Logger log = LoggerFactory.getLogger(QuestionScoreUpdateListener.class); //private static EvaluationListenerUtil util; //private static BeanSort bs; //private static ContextUtil cu; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/ResetQuestionScoreListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/ResetQuestionScoreListener.java index c1128d0264ba..e023e302f231 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/ResetQuestionScoreListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/ResetQuestionScoreListener.java @@ -28,8 +28,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.ui.bean.evaluation.QuestionScoresBean; import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; @@ -46,7 +46,7 @@ public class ResetQuestionScoreListener implements ActionListener { - private static Log log = LogFactory.getLog(ResetQuestionScoreListener.class); + private static Logger log = LoggerFactory.getLogger(ResetQuestionScoreListener.class); private static ContextUtil cu; /** diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/ResetTotalScoreListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/ResetTotalScoreListener.java index 507bb3bbb972..9b9bed83b267 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/ResetTotalScoreListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/ResetTotalScoreListener.java @@ -28,8 +28,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.ui.bean.evaluation.TotalScoresBean; import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; @@ -46,7 +46,7 @@ public class ResetTotalScoreListener implements ActionListener { - private static Log log = LogFactory.getLog(ResetTotalScoreListener.class); + private static Logger log = LoggerFactory.getLogger(ResetTotalScoreListener.class); private static ContextUtil cu; /** diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/RetakeAssessmentListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/RetakeAssessmentListener.java index 66a21486476e..6419d8984935 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/RetakeAssessmentListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/RetakeAssessmentListener.java @@ -1,8 +1,8 @@ -/********************************************************************************** - * $URL$ - * $Id$ - *********************************************************************************** - * +/********************************************************************************** + * $URL$ + * $Id$ + *********************************************************************************** + * * Copyright (c) 2004, 2005, 2006, 2007, 2008 The Sakai Foundation * * Licensed under the Educational Community License, Version 2.0 (the "License"); @@ -16,59 +16,59 @@ * 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.sakaiproject.tool.assessment.ui.listener.evaluation; - -import java.util.Date; -import java.util.List; - -import javax.faces.event.AbortProcessingException; -import javax.faces.event.ActionEvent; -import javax.faces.event.ActionListener; - -import org.sakaiproject.tool.assessment.data.dao.grading.StudentGradingSummaryData; -import org.sakaiproject.tool.assessment.facade.AgentFacade; -import org.sakaiproject.tool.assessment.services.GradingService; -import org.sakaiproject.tool.assessment.ui.bean.evaluation.RetakeAssessmentBean; -import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; - -/** - *

Title: Samigo

- *

Description: Sakai Assessment Manager

- * @author Ed Smiley - * @version $Id$ - */ - -public class RetakeAssessmentListener implements ActionListener { - //private static Log log = LogFactory.getLog(ConfirmRemovePartListener.class); - - public RetakeAssessmentListener() { - } - - public void processAction(ActionEvent ae) throws AbortProcessingException { - RetakeAssessmentBean retakeAssessment = (RetakeAssessmentBean) ContextUtil.lookupBean("retakeAssessment"); - GradingService gradingService = new GradingService(); - StudentGradingSummaryData studentGradingSummaryData = (StudentGradingSummaryData) retakeAssessment.getStudentGradingSummaryDataMap().get(retakeAssessment.getAgentId()); - if (studentGradingSummaryData == null) { - studentGradingSummaryData = new StudentGradingSummaryData(); - studentGradingSummaryData.setPublishedAssessmentId(retakeAssessment.getPublishedAssessmentId()); - studentGradingSummaryData.setAgentId(retakeAssessment.getAgentId()); - studentGradingSummaryData.setNumberRetake(Integer.valueOf(1)); - studentGradingSummaryData.setCreatedBy(AgentFacade.getAgentString()); - studentGradingSummaryData.setCreatedDate(new Date()); - studentGradingSummaryData.setLastModifiedBy(AgentFacade.getAgentString()); - studentGradingSummaryData.setLastModifiedDate(new Date()); - } - else { - int updatedNumberRetake = studentGradingSummaryData.getNumberRetake().intValue() + 1; - studentGradingSummaryData.setNumberRetake(Integer.valueOf(updatedNumberRetake)); - studentGradingSummaryData.setLastModifiedBy(AgentFacade.getAgentString()); - studentGradingSummaryData.setLastModifiedDate(new Date()); - } - - gradingService.saveStudentGradingSummaryData(studentGradingSummaryData); - } - -} + * + **********************************************************************************/ + +package org.sakaiproject.tool.assessment.ui.listener.evaluation; + +import java.util.Date; +import java.util.List; + +import javax.faces.event.AbortProcessingException; +import javax.faces.event.ActionEvent; +import javax.faces.event.ActionListener; + +import org.sakaiproject.tool.assessment.data.dao.grading.StudentGradingSummaryData; +import org.sakaiproject.tool.assessment.facade.AgentFacade; +import org.sakaiproject.tool.assessment.services.GradingService; +import org.sakaiproject.tool.assessment.ui.bean.evaluation.RetakeAssessmentBean; +import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; + +/** + *

Title: Samigo

+ *

Description: Sakai Assessment Manager

+ * @author Ed Smiley + * @version $Id$ + */ + +public class RetakeAssessmentListener implements ActionListener { + //private static Logger log = LoggerFactory.getLogger(ConfirmRemovePartListener.class); + + public RetakeAssessmentListener() { + } + + public void processAction(ActionEvent ae) throws AbortProcessingException { + RetakeAssessmentBean retakeAssessment = (RetakeAssessmentBean) ContextUtil.lookupBean("retakeAssessment"); + GradingService gradingService = new GradingService(); + StudentGradingSummaryData studentGradingSummaryData = (StudentGradingSummaryData) retakeAssessment.getStudentGradingSummaryDataMap().get(retakeAssessment.getAgentId()); + if (studentGradingSummaryData == null) { + studentGradingSummaryData = new StudentGradingSummaryData(); + studentGradingSummaryData.setPublishedAssessmentId(retakeAssessment.getPublishedAssessmentId()); + studentGradingSummaryData.setAgentId(retakeAssessment.getAgentId()); + studentGradingSummaryData.setNumberRetake(Integer.valueOf(1)); + studentGradingSummaryData.setCreatedBy(AgentFacade.getAgentString()); + studentGradingSummaryData.setCreatedDate(new Date()); + studentGradingSummaryData.setLastModifiedBy(AgentFacade.getAgentString()); + studentGradingSummaryData.setLastModifiedDate(new Date()); + } + else { + int updatedNumberRetake = studentGradingSummaryData.getNumberRetake().intValue() + 1; + studentGradingSummaryData.setNumberRetake(Integer.valueOf(updatedNumberRetake)); + studentGradingSummaryData.setLastModifiedBy(AgentFacade.getAgentString()); + studentGradingSummaryData.setLastModifiedDate(new Date()); + } + + gradingService.saveStudentGradingSummaryData(studentGradingSummaryData); + } + +} diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/StudentScoreAttachmentListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/StudentScoreAttachmentListener.java index 3a2dae7cc32d..82c2f17a17e6 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/StudentScoreAttachmentListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/StudentScoreAttachmentListener.java @@ -4,14 +4,14 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.ui.bean.evaluation.StudentScoresBean; import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; public class StudentScoreAttachmentListener implements ActionListener { - private static Log log = LogFactory.getLog(StudentScoreAttachmentListener.class); + private static Logger log = LoggerFactory.getLogger(StudentScoreAttachmentListener.class); public void processAction(ActionEvent event) throws AbortProcessingException { StudentScoresBean studentScoresBean = (StudentScoresBean) ContextUtil.lookupBean("studentScores"); diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/StudentScoreListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/StudentScoreListener.java index 774596ae6c3c..6a95968842a9 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/StudentScoreListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/StudentScoreListener.java @@ -32,8 +32,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.ui.bean.delivery.DeliveryBean; import org.sakaiproject.tool.assessment.ui.bean.delivery.ItemContentsBean; import org.sakaiproject.tool.assessment.ui.bean.delivery.SectionContentsBean; @@ -64,7 +64,7 @@ public class StudentScoreListener implements ActionListener { - private static Log log = LogFactory.getLog(StudentScoreListener.class); + private static Logger log = LoggerFactory.getLogger(StudentScoreListener.class); private static EvaluationListenerUtil util; private static BeanSort bs; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/StudentScoreUpdateListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/StudentScoreUpdateListener.java index a2af6910a06f..1f8835d82eed 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/StudentScoreUpdateListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/StudentScoreUpdateListener.java @@ -37,8 +37,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.math.util.MathUtils; import org.sakaiproject.event.cover.EventTrackingService; import org.sakaiproject.tool.assessment.data.dao.grading.AssessmentGradingData; @@ -69,7 +69,7 @@ public class StudentScoreUpdateListener implements ActionListener { - private static Log log = LogFactory.getLog(StudentScoreUpdateListener.class); + private static Logger log = LoggerFactory.getLogger(StudentScoreUpdateListener.class); private static ContextUtil cu; /** diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/SubmissionStatusListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/SubmissionStatusListener.java index d6451c4e607a..5f1612090e08 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/SubmissionStatusListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/SubmissionStatusListener.java @@ -39,8 +39,8 @@ import javax.faces.event.ValueChangeListener; import org.apache.commons.beanutils.BeanUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.dao.assessment.PublishedAssessmentData; import org.sakaiproject.tool.assessment.data.dao.grading.AssessmentGradingData; import org.sakaiproject.tool.assessment.data.dao.grading.StudentGradingSummaryData; @@ -68,7 +68,7 @@ public class SubmissionStatusListener implements ActionListener, ValueChangeListener { - private static Log log = LogFactory.getLog(SubmissionStatusListener.class); + private static Logger log = LoggerFactory.getLogger(SubmissionStatusListener.class); //private static EvaluationListenerUtil util; private static BeanSort bs; //private static ContextUtil cu; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/TotalScoreListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/TotalScoreListener.java index fe600cda83fb..ea9141a642f3 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/TotalScoreListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/TotalScoreListener.java @@ -42,8 +42,8 @@ import javax.faces.event.ValueChangeListener; import org.apache.commons.beanutils.BeanUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.business.entity.RecordingData; import org.sakaiproject.tool.assessment.data.dao.assessment.AssessmentAccessControl; import org.sakaiproject.tool.assessment.data.dao.assessment.PublishedAccessControl; @@ -88,7 +88,7 @@ public class TotalScoreListener implements ActionListener, ValueChangeListener { - private static Log log = LogFactory.getLog(TotalScoreListener.class); + private static Logger log = LoggerFactory.getLogger(TotalScoreListener.class); private static BeanSort bs; //private SectionAwareness sectionAwareness; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/TotalScoreUpdateListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/TotalScoreUpdateListener.java index eac0b0bdfc0f..6d0da18c7fc5 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/TotalScoreUpdateListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/TotalScoreUpdateListener.java @@ -40,8 +40,8 @@ import javax.faces.event.ActionListener; import org.apache.commons.beanutils.BeanUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.math.util.MathUtils; import org.sakaiproject.event.cover.EventTrackingService; import org.sakaiproject.tool.assessment.data.dao.grading.AssessmentGradingAttachment; @@ -73,7 +73,7 @@ public class TotalScoreUpdateListener implements ActionListener { - private static Log log = LogFactory.getLog(TotalScoreUpdateListener.class); + private static Logger log = LoggerFactory.getLogger(TotalScoreUpdateListener.class); /** * Standard process action method. diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/util/EvaluationListenerUtil.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/util/EvaluationListenerUtil.java index 39e432c50b9f..32495704e6e0 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/util/EvaluationListenerUtil.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/util/EvaluationListenerUtil.java @@ -25,8 +25,8 @@ import java.util.StringTokenizer; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; @@ -42,7 +42,7 @@ public class EvaluationListenerUtil { - private static Log log = LogFactory.getLog(EvaluationListenerUtil.class); + private static Logger log = LoggerFactory.getLogger(EvaluationListenerUtil.class); private static ContextUtil cu; /** diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/questionpool/CancelImportToAssessmentListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/questionpool/CancelImportToAssessmentListener.java index a10669376ccd..ec2e53614a68 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/questionpool/CancelImportToAssessmentListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/questionpool/CancelImportToAssessmentListener.java @@ -25,8 +25,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.ui.bean.questionpool.QuestionPoolBean; import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; @@ -38,7 +38,7 @@ public class CancelImportToAssessmentListener implements ActionListener { - private static Log log = LogFactory.getLog(CancelImportToAssessmentListener.class); + private static Logger log = LoggerFactory.getLogger(CancelImportToAssessmentListener.class); private static ContextUtil cu; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/questionpool/CancelPoolListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/questionpool/CancelPoolListener.java index 3f606b797272..8f9f8d8ffeef 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/questionpool/CancelPoolListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/questionpool/CancelPoolListener.java @@ -26,8 +26,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.ui.bean.questionpool.QuestionPoolBean; import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; @@ -39,7 +39,7 @@ public class CancelPoolListener implements ActionListener { - private static Log log = LogFactory.getLog(CancelPoolListener.class); + private static Logger log = LoggerFactory.getLogger(CancelPoolListener.class); private static ContextUtil cu; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/questionpool/ImportQuestionsToAuthoring.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/questionpool/ImportQuestionsToAuthoring.java index 237ec0cf98a5..51952691f76d 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/questionpool/ImportQuestionsToAuthoring.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/questionpool/ImportQuestionsToAuthoring.java @@ -54,7 +54,7 @@ public class ImportQuestionsToAuthoring implements ActionListener { - //private static Log log = LogFactory.getLog(ImportQuestionsToAuthoring.class); + //private static Logger log = LoggerFactory.getLogger(ImportQuestionsToAuthoring.class); //private static ContextUtil cu; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/questionpool/PoolSaveListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/questionpool/PoolSaveListener.java index ce4c62c34a4d..96ba1d716bc6 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/questionpool/PoolSaveListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/questionpool/PoolSaveListener.java @@ -1,8 +1,8 @@ -/********************************************************************************** - * $URL$ - * $Id$ - *********************************************************************************** - * +/********************************************************************************** + * $URL$ + * $Id$ + *********************************************************************************** + * * Copyright (c) 2004, 2005, 2006, 2008 The Sakai Foundation * * Licensed under the Educational Community License, Version 2.0 (the "License"); @@ -16,249 +16,249 @@ * 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.sakaiproject.tool.assessment.ui.listener.questionpool; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Iterator; - -import javax.faces.event.AbortProcessingException; -import javax.faces.event.ActionEvent; -import javax.faces.event.ActionListener; -import javax.faces.application.FacesMessage; - -import javax.faces.context.FacesContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.sakaiproject.tool.assessment.facade.AgentFacade; -import org.sakaiproject.tool.assessment.facade.QuestionPoolFacade; -import org.sakaiproject.tool.assessment.services.QuestionPoolService; -import org.sakaiproject.tool.assessment.facade.ItemFacade; -import org.sakaiproject.tool.assessment.services.ItemService; -import org.sakaiproject.tool.assessment.ui.bean.questionpool.QuestionPoolBean; -import org.sakaiproject.tool.assessment.ui.bean.questionpool.QuestionPoolDataBean; -import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; -import org.sakaiproject.tool.assessment.util.TextFormat; - -/** - *

Title: Samigo

- *

Description: Sakai Assessment Manager

- * @version $Id$ - */ - -public class PoolSaveListener implements ActionListener -{ - - private static Log log = LogFactory.getLog(PoolSaveListener.class); - //private static ContextUtil cu; - - - /** - * Standard process action method. - * @param ae ActionEvent - * @throws AbortProcessingException - */ - public void processAction(ActionEvent ae) throws AbortProcessingException - { - //log.info("PoolSaveListener :"); - QuestionPoolBean qpoolbean= (QuestionPoolBean) ContextUtil.lookupBean("questionpool"); - String currentName= TextFormat.convertPlaintextToFormattedTextNoHighUnicode(log, qpoolbean.getCurrentPool().getDisplayName()); - - String addsource = (String)ae.getComponent().getAttributes().get("addsource"); - qpoolbean.setAddPoolSource(addsource); - - boolean isUnique=true; - QuestionPoolService service = new QuestionPoolService(); - QuestionPoolDataBean bean = qpoolbean.getCurrentPool(); - Long currentId = new Long ("0"); - FacesContext context = FacesContext.getCurrentInstance(); - if(bean.getId() != null) - { - currentId = bean.getId(); - } - - Long currentParentId = new Long("0"); - if(bean.getParentPoolId() != null) - { - currentParentId = bean.getParentPoolId(); - } - if(currentName!=null &&(currentName.trim()).equals("")){ - String err1=ContextUtil.getLocalizedString("org.sakaiproject.tool.assessment.bundle.QuestionPoolMessages","poolName_empty"); - context.addMessage(null,new FacesMessage(err1)); - qpoolbean.setOutcomeEdit("editPool"); - qpoolbean.setOutcome("addPool"); - return; - } - - try { - - if((qpoolbean.getAddOrEdit()).equals("add")){ - isUnique=service.poolIsUnique("0",currentName,""+currentParentId, AgentFacade.getAgentString()) ; - } - else { - isUnique=service.poolIsUnique(""+currentId,currentName,""+currentParentId, AgentFacade.getAgentString()); - } - - if(!isUnique){ - - String error=ContextUtil.getLocalizedString("org.sakaiproject.tool.assessment.bundle.QuestionPoolMessages","duplicateName_error"); - - context.addMessage(null,new FacesMessage(error)); - - qpoolbean.setOutcomeEdit("editPool"); - qpoolbean.setOutcome("addPool"); - - return; - } - - - if (!savePool(qpoolbean)){ - - throw new RuntimeException("failed to populateItemBean."); - } - - if((qpoolbean.getAddOrEdit()).equals("edit")){ - if (!startRemoveItems(qpoolbean)){ - throw new RuntimeException("failed to populateItemBean."); - } - } - qpoolbean.setAddOrEdit("edit"); - - } - catch(Exception e){ - throw new RuntimeException(e); - } //if error=false then save, if not then create error message - - } - - public boolean savePool(QuestionPoolBean qpbean) { - QuestionPoolDataBean bean = qpbean.getCurrentPool(); - Long beanid = new Long ("0"); - if(bean.getId() != null) - { - beanid = bean.getId(); - } - - Long parentid = new Long("0"); - if(bean.getParentPoolId() != null) - { - parentid = bean.getParentPoolId(); - } - - QuestionPoolFacade questionpool = - new QuestionPoolFacade (beanid, parentid); - questionpool.updateDisplayName(TextFormat.convertPlaintextToFormattedTextNoHighUnicode(log, bean.getDisplayName())); - questionpool.updateDescription(TextFormat.convertPlaintextToFormattedTextNoHighUnicode(log, bean.getDescription())); - questionpool.setOrganizationName(TextFormat.convertPlaintextToFormattedTextNoHighUnicode(log, bean.getOrganizationName())); - questionpool.setObjectives(TextFormat.convertPlaintextToFormattedTextNoHighUnicode(log, bean.getObjectives())); - questionpool.setKeywords(TextFormat.convertPlaintextToFormattedTextNoHighUnicode(log, bean.getKeywords())); - // need to set owner and accesstype - questionpool.setAccessTypeId(QuestionPoolFacade.ACCESS_DENIED); // set as default - - QuestionPoolService service = new QuestionPoolService(); - // add pool - if (beanid.toString().equals("0")) { - questionpool.setOwnerId(AgentFacade.getAgentString()); - questionpool.setDateCreated(new Date()); - } - // edit pool - else { - questionpool.setOwnerId(service.getPool(beanid, AgentFacade.getAgentString()).getOwnerId()); - questionpool.setDateCreated(bean.getDateCreated()); - } - QuestionPoolService delegate = new QuestionPoolService(); - //log.info("Saving pool"); - delegate.savePool(questionpool); - - // Rebuild the tree with the new pool - qpbean.buildTree(); - - // System.out.println( "SAVE - POOLSOURCE= "+qpbean.getAddPoolSource()); - //where do you get value from addPoolSource? It always return null though. - if ("editpool".equals(qpbean.getAddPoolSource()) && !qpbean.ORIGIN_TOP.equals(qpbean.getOutcome())) { - // so reset subpools tree -// QuestionPoolFacade thepool= delegate.getPool(parentid, AgentFacade.getAgentString()); -// qpbean.getCurrentPool().setNumberOfSubpools(thepool.getSubPoolSize().toString()); - qpbean.startEditPoolAgain(Long.toString(qpbean.getOutcomePool())); // return to edit pool with the pool where the action was performed - - // Reset the properties for current pool to reflect the early changes (before click on "Add") in edit pool - QuestionPoolDataBean currentPool = qpbean.getCurrentPool(); - currentPool.setDisplayName(TextFormat.convertPlaintextToFormattedTextNoHighUnicode(log, qpbean.getParentPool().getDisplayName())); - currentPool.setOrganizationName(TextFormat.convertPlaintextToFormattedTextNoHighUnicode(log, qpbean.getParentPool().getOrganizationName())); - currentPool.setDescription(TextFormat.convertPlaintextToFormattedTextNoHighUnicode(log, qpbean.getParentPool().getDescription())); - currentPool.setObjectives(TextFormat.convertPlaintextToFormattedTextNoHighUnicode(log, qpbean.getParentPool().getObjectives())); - currentPool.setKeywords(TextFormat.convertPlaintextToFormattedTextNoHighUnicode(log, qpbean.getParentPool().getKeywords())); - ArrayList addedPools = qpbean.getAddedPools(); - if (addedPools == null) { - addedPools = new ArrayList(); - } - addedPools.add(questionpool.getQuestionPoolId()); - qpbean.setAddedPools(addedPools); - qpbean.setOutcome("editPool"); - qpbean.setAddPoolSource(""); - qpbean.setSubQpDataModelByLevel(); - } - else if("editpoolattr".equals(qpbean.getAddPoolSource())){ - //when change the pool's field - qpbean.startEditPoolAgain(bean.getId().toString()); - qpbean.setOutcomeEdit("editPool"); - qpbean.setOutcome("editPool"); - qpbean.setSubQpDataModelByLevel(); - } - else { - qpbean.setOutcomeEdit("poolList"); - qpbean.setOutcome("poolList"); - qpbean.setCurrentPool(null); - qpbean.setOutcomePool(0); - - qpbean.setQpDataModelByLevel(); - } - // set outcome for action - return true; - } - - - public boolean startRemoveItems(QuestionPoolBean qpoolbean){ -// used by the editPool.jsp, to remove one or more items - try { - String itemId= ""; - - ArrayList destItems= ContextUtil.paramArrayValueLike("removeCheckbox"); - - if (destItems.size() > 0) { - // only go to remove confirmatin page when at least one checkbox is checked - - List items= new ArrayList(); - Iterator iter = destItems.iterator(); - while(iter.hasNext()) - { - - itemId = (String) iter.next(); - - ItemService delegate = new ItemService(); - ItemFacade itemfacade= delegate.getItem(new Long(itemId), AgentFacade.getAgentString()); - items.add(itemfacade); - - } - - qpoolbean.setItemsToDelete(items); - qpoolbean.setOutcomeEdit("removeQuestionFromPool"); - qpoolbean.setOutcome("removeQuestionFromPool"); - } - else { - // otherwise go to poollist - qpoolbean.setOutcome("poolList"); - } - } - catch (Exception e) { - e.printStackTrace(); - return false; - } - return true; - } -} + * + **********************************************************************************/ + + +package org.sakaiproject.tool.assessment.ui.listener.questionpool; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Iterator; + +import javax.faces.event.AbortProcessingException; +import javax.faces.event.ActionEvent; +import javax.faces.event.ActionListener; +import javax.faces.application.FacesMessage; + +import javax.faces.context.FacesContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sakaiproject.tool.assessment.facade.AgentFacade; +import org.sakaiproject.tool.assessment.facade.QuestionPoolFacade; +import org.sakaiproject.tool.assessment.services.QuestionPoolService; +import org.sakaiproject.tool.assessment.facade.ItemFacade; +import org.sakaiproject.tool.assessment.services.ItemService; +import org.sakaiproject.tool.assessment.ui.bean.questionpool.QuestionPoolBean; +import org.sakaiproject.tool.assessment.ui.bean.questionpool.QuestionPoolDataBean; +import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; +import org.sakaiproject.tool.assessment.util.TextFormat; + +/** + *

Title: Samigo

+ *

Description: Sakai Assessment Manager

+ * @version $Id$ + */ + +public class PoolSaveListener implements ActionListener +{ + + private static Logger log = LoggerFactory.getLogger(PoolSaveListener.class); + //private static ContextUtil cu; + + + /** + * Standard process action method. + * @param ae ActionEvent + * @throws AbortProcessingException + */ + public void processAction(ActionEvent ae) throws AbortProcessingException + { + //log.info("PoolSaveListener :"); + QuestionPoolBean qpoolbean= (QuestionPoolBean) ContextUtil.lookupBean("questionpool"); + String currentName= TextFormat.convertPlaintextToFormattedTextNoHighUnicode(log, qpoolbean.getCurrentPool().getDisplayName()); + + String addsource = (String)ae.getComponent().getAttributes().get("addsource"); + qpoolbean.setAddPoolSource(addsource); + + boolean isUnique=true; + QuestionPoolService service = new QuestionPoolService(); + QuestionPoolDataBean bean = qpoolbean.getCurrentPool(); + Long currentId = new Long ("0"); + FacesContext context = FacesContext.getCurrentInstance(); + if(bean.getId() != null) + { + currentId = bean.getId(); + } + + Long currentParentId = new Long("0"); + if(bean.getParentPoolId() != null) + { + currentParentId = bean.getParentPoolId(); + } + if(currentName!=null &&(currentName.trim()).equals("")){ + String err1=ContextUtil.getLocalizedString("org.sakaiproject.tool.assessment.bundle.QuestionPoolMessages","poolName_empty"); + context.addMessage(null,new FacesMessage(err1)); + qpoolbean.setOutcomeEdit("editPool"); + qpoolbean.setOutcome("addPool"); + return; + } + + try { + + if((qpoolbean.getAddOrEdit()).equals("add")){ + isUnique=service.poolIsUnique("0",currentName,""+currentParentId, AgentFacade.getAgentString()) ; + } + else { + isUnique=service.poolIsUnique(""+currentId,currentName,""+currentParentId, AgentFacade.getAgentString()); + } + + if(!isUnique){ + + String error=ContextUtil.getLocalizedString("org.sakaiproject.tool.assessment.bundle.QuestionPoolMessages","duplicateName_error"); + + context.addMessage(null,new FacesMessage(error)); + + qpoolbean.setOutcomeEdit("editPool"); + qpoolbean.setOutcome("addPool"); + + return; + } + + + if (!savePool(qpoolbean)){ + + throw new RuntimeException("failed to populateItemBean."); + } + + if((qpoolbean.getAddOrEdit()).equals("edit")){ + if (!startRemoveItems(qpoolbean)){ + throw new RuntimeException("failed to populateItemBean."); + } + } + qpoolbean.setAddOrEdit("edit"); + + } + catch(Exception e){ + throw new RuntimeException(e); + } //if error=false then save, if not then create error message + + } + + public boolean savePool(QuestionPoolBean qpbean) { + QuestionPoolDataBean bean = qpbean.getCurrentPool(); + Long beanid = new Long ("0"); + if(bean.getId() != null) + { + beanid = bean.getId(); + } + + Long parentid = new Long("0"); + if(bean.getParentPoolId() != null) + { + parentid = bean.getParentPoolId(); + } + + QuestionPoolFacade questionpool = + new QuestionPoolFacade (beanid, parentid); + questionpool.updateDisplayName(TextFormat.convertPlaintextToFormattedTextNoHighUnicode(log, bean.getDisplayName())); + questionpool.updateDescription(TextFormat.convertPlaintextToFormattedTextNoHighUnicode(log, bean.getDescription())); + questionpool.setOrganizationName(TextFormat.convertPlaintextToFormattedTextNoHighUnicode(log, bean.getOrganizationName())); + questionpool.setObjectives(TextFormat.convertPlaintextToFormattedTextNoHighUnicode(log, bean.getObjectives())); + questionpool.setKeywords(TextFormat.convertPlaintextToFormattedTextNoHighUnicode(log, bean.getKeywords())); + // need to set owner and accesstype + questionpool.setAccessTypeId(QuestionPoolFacade.ACCESS_DENIED); // set as default + + QuestionPoolService service = new QuestionPoolService(); + // add pool + if (beanid.toString().equals("0")) { + questionpool.setOwnerId(AgentFacade.getAgentString()); + questionpool.setDateCreated(new Date()); + } + // edit pool + else { + questionpool.setOwnerId(service.getPool(beanid, AgentFacade.getAgentString()).getOwnerId()); + questionpool.setDateCreated(bean.getDateCreated()); + } + QuestionPoolService delegate = new QuestionPoolService(); + //log.info("Saving pool"); + delegate.savePool(questionpool); + + // Rebuild the tree with the new pool + qpbean.buildTree(); + + // System.out.println( "SAVE - POOLSOURCE= "+qpbean.getAddPoolSource()); + //where do you get value from addPoolSource? It always return null though. + if ("editpool".equals(qpbean.getAddPoolSource()) && !qpbean.ORIGIN_TOP.equals(qpbean.getOutcome())) { + // so reset subpools tree +// QuestionPoolFacade thepool= delegate.getPool(parentid, AgentFacade.getAgentString()); +// qpbean.getCurrentPool().setNumberOfSubpools(thepool.getSubPoolSize().toString()); + qpbean.startEditPoolAgain(Long.toString(qpbean.getOutcomePool())); // return to edit pool with the pool where the action was performed + + // Reset the properties for current pool to reflect the early changes (before click on "Add") in edit pool + QuestionPoolDataBean currentPool = qpbean.getCurrentPool(); + currentPool.setDisplayName(TextFormat.convertPlaintextToFormattedTextNoHighUnicode(log, qpbean.getParentPool().getDisplayName())); + currentPool.setOrganizationName(TextFormat.convertPlaintextToFormattedTextNoHighUnicode(log, qpbean.getParentPool().getOrganizationName())); + currentPool.setDescription(TextFormat.convertPlaintextToFormattedTextNoHighUnicode(log, qpbean.getParentPool().getDescription())); + currentPool.setObjectives(TextFormat.convertPlaintextToFormattedTextNoHighUnicode(log, qpbean.getParentPool().getObjectives())); + currentPool.setKeywords(TextFormat.convertPlaintextToFormattedTextNoHighUnicode(log, qpbean.getParentPool().getKeywords())); + ArrayList addedPools = qpbean.getAddedPools(); + if (addedPools == null) { + addedPools = new ArrayList(); + } + addedPools.add(questionpool.getQuestionPoolId()); + qpbean.setAddedPools(addedPools); + qpbean.setOutcome("editPool"); + qpbean.setAddPoolSource(""); + qpbean.setSubQpDataModelByLevel(); + } + else if("editpoolattr".equals(qpbean.getAddPoolSource())){ + //when change the pool's field + qpbean.startEditPoolAgain(bean.getId().toString()); + qpbean.setOutcomeEdit("editPool"); + qpbean.setOutcome("editPool"); + qpbean.setSubQpDataModelByLevel(); + } + else { + qpbean.setOutcomeEdit("poolList"); + qpbean.setOutcome("poolList"); + qpbean.setCurrentPool(null); + qpbean.setOutcomePool(0); + + qpbean.setQpDataModelByLevel(); + } + // set outcome for action + return true; + } + + + public boolean startRemoveItems(QuestionPoolBean qpoolbean){ +// used by the editPool.jsp, to remove one or more items + try { + String itemId= ""; + + ArrayList destItems= ContextUtil.paramArrayValueLike("removeCheckbox"); + + if (destItems.size() > 0) { + // only go to remove confirmatin page when at least one checkbox is checked + + List items= new ArrayList(); + Iterator iter = destItems.iterator(); + while(iter.hasNext()) + { + + itemId = (String) iter.next(); + + ItemService delegate = new ItemService(); + ItemFacade itemfacade= delegate.getItem(new Long(itemId), AgentFacade.getAgentString()); + items.add(itemfacade); + + } + + qpoolbean.setItemsToDelete(items); + qpoolbean.setOutcomeEdit("removeQuestionFromPool"); + qpoolbean.setOutcome("removeQuestionFromPool"); + } + else { + // otherwise go to poollist + qpoolbean.setOutcome("poolList"); + } + } + catch (Exception e) { + e.printStackTrace(); + return false; + } + return true; + } +} diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/questionpool/SortQuestionListListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/questionpool/SortQuestionListListener.java index f697416aede9..507285c50fd3 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/questionpool/SortQuestionListListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/questionpool/SortQuestionListListener.java @@ -32,8 +32,8 @@ import javax.faces.event.ActionListener; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.services.QuestionPoolService; import org.sakaiproject.tool.assessment.ui.bean.questionpool.QuestionPoolBean; import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; @@ -47,7 +47,7 @@ public class SortQuestionListListener implements ActionListener { - private static Log log = LogFactory.getLog(SortQuestionListListener.class); + private static Logger log = LoggerFactory.getLogger(SortQuestionListListener.class); public void processAction(ActionEvent ae) throws AbortProcessingException { diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/questionpool/StartRemoveItemsListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/questionpool/StartRemoveItemsListener.java index 09ae5fd60492..69c8d11aee78 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/questionpool/StartRemoveItemsListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/questionpool/StartRemoveItemsListener.java @@ -30,8 +30,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.facade.AgentFacade; import org.sakaiproject.tool.assessment.facade.ItemFacade; import org.sakaiproject.tool.assessment.services.ItemService; @@ -46,7 +46,7 @@ public class StartRemoveItemsListener implements ActionListener { - private static Log log = LogFactory.getLog(StartRemoveItemsListener.class); + private static Logger log = LoggerFactory.getLogger(StartRemoveItemsListener.class); private static ContextUtil cu; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/samlite/AssessmentListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/samlite/AssessmentListener.java index a49a6fb54c42..5d54629d95c4 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/samlite/AssessmentListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/samlite/AssessmentListener.java @@ -3,8 +3,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.event.cover.EventTrackingService; import org.sakaiproject.tool.assessment.facade.AgentFacade; import org.sakaiproject.tool.assessment.facade.AssessmentFacade; @@ -15,7 +15,7 @@ import org.w3c.dom.Document; public class AssessmentListener implements ActionListener { - private static Log log = LogFactory.getLog(AssessmentListener.class); + private static Logger log = LoggerFactory.getLogger(AssessmentListener.class); public AssessmentListener() {} diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/samlite/ParserListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/samlite/ParserListener.java index 4f22d8029117..096098a3746c 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/samlite/ParserListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/samlite/ParserListener.java @@ -1,18 +1,17 @@ package org.sakaiproject.tool.assessment.ui.listener.samlite; -import javax.faces.application.FacesMessage; -import javax.faces.context.FacesContext; -import javax.faces.event.ActionEvent; -import javax.faces.event.ActionListener; - -import lombok.extern.apachecommons.CommonsLog; - +import lombok.extern.slf4j.Slf4j; import org.sakaiproject.tool.assessment.services.assessment.AssessmentService; import org.sakaiproject.tool.assessment.ui.bean.samlite.SamLiteBean; import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; import org.sakaiproject.tool.assessment.util.TextFormat; -@CommonsLog +import javax.faces.application.FacesMessage; +import javax.faces.context.FacesContext; +import javax.faces.event.ActionEvent; +import javax.faces.event.ActionListener; + +@Slf4j public class ParserListener implements ActionListener { public ParserListener() {} diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/select/SelectActionListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/select/SelectActionListener.java index 0a074dd8e897..a8d57832fe47 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/select/SelectActionListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/select/SelectActionListener.java @@ -37,8 +37,8 @@ import javax.faces.event.ActionListener; import javax.servlet.http.HttpServletRequest; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.api.SamigoApiFactory; import org.sakaiproject.tool.assessment.data.dao.grading.AssessmentGradingData; import org.sakaiproject.tool.assessment.data.dao.grading.StudentGradingSummaryData; @@ -72,7 +72,7 @@ public class SelectActionListener implements ActionListener { - private static Log log = LogFactory.getLog(SelectActionListener.class); + private static Logger log = LoggerFactory.getLogger(SelectActionListener.class); //private static ContextUtil cu; private static BeanSort bs; private static BeanSort bs2; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/select/SelectRecordedListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/select/SelectRecordedListener.java index ea8d2d089ac8..c6a172c5e8a4 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/select/SelectRecordedListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/select/SelectRecordedListener.java @@ -5,12 +5,12 @@ import javax.faces.event.ValueChangeEvent; import javax.faces.event.ValueChangeListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class SelectRecordedListener implements ValueChangeListener { - private static Log log = LogFactory.getLog(SelectRecordedListener.class); + private static Logger log = LoggerFactory.getLogger(SelectRecordedListener.class); public void processValueChange(ValueChangeEvent event) throws AbortProcessingException { log.debug("Processing ... ValueChangeListener"); @@ -19,4 +19,4 @@ public void processValueChange(ValueChangeEvent event) throws AbortProcessingExc action.processAction(new ActionEvent(event.getComponent())); } -} \ No newline at end of file +} diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/shared/ConfirmRemoveMediaListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/shared/ConfirmRemoveMediaListener.java index 3c5e761a2051..90a713ee0665 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/shared/ConfirmRemoveMediaListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/shared/ConfirmRemoveMediaListener.java @@ -39,7 +39,7 @@ public class ConfirmRemoveMediaListener implements ActionListener { - //private static Log log = LogFactory.getLog(ConfirmRemoveMediaListener.class); + //private static Logger log = LoggerFactory.getLogger(ConfirmRemoveMediaListener.class); public ConfirmRemoveMediaListener() { diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/shared/RemoveMediaListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/shared/RemoveMediaListener.java index 394652ac7ef6..547f268c983b 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/shared/RemoveMediaListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/shared/RemoveMediaListener.java @@ -47,7 +47,7 @@ public class RemoveMediaListener implements ActionListener { - //private static Log log = LogFactory.getLog(RemoveMediaListener.class); + //private static Logger log = LoggerFactory.getLogger(RemoveMediaListener.class); public RemoveMediaListener() { diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/util/ContextUtil.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/util/ContextUtil.java index d8c74a0bafaa..8211a1b74e7e 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/util/ContextUtil.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/util/ContextUtil.java @@ -41,8 +41,8 @@ import java.util.ArrayList; import javax.servlet.*; import javax.servlet.http.*; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; /** @@ -56,7 +56,7 @@ public class ContextUtil { - private static Log log = LogFactory.getLog(ContextUtil.class); + private static Logger log = LoggerFactory.getLogger(ContextUtil.class); private static ServletContext M_servletContext = null; /** diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/util/EmailListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/util/EmailListener.java index 38669a999ab1..9fca5d09ecee 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/util/EmailListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/util/EmailListener.java @@ -25,14 +25,14 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.facade.AgentFacade; import org.sakaiproject.tool.assessment.ui.bean.evaluation.TotalScoresBean; import org.sakaiproject.tool.assessment.ui.bean.util.EmailBean; public class EmailListener implements ActionListener { - private static Log log = LogFactory.getLog(EmailListener.class); + private static Logger log = LoggerFactory.getLogger(EmailListener.class); /** * Standard process action method. diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/util/TimeUtil.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/util/TimeUtil.java index b712b7324396..5225862a4d34 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/util/TimeUtil.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/util/TimeUtil.java @@ -29,8 +29,8 @@ import java.util.GregorianCalendar; import java.util.TimeZone; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.joda.time.DateTime; import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormatter; @@ -45,7 +45,7 @@ public class TimeUtil { - private static Log log = LogFactory.getLog(TimeUtil.class); + private static Logger log = LoggerFactory.getLogger(TimeUtil.class); private static final String ISO_8601_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ssZZ"; private static DateTimeFormatter dtf = DateTimeFormat.forPattern(ISO_8601_DATE_FORMAT); diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/queue/delivery/SubmitTimedAssessmentThread.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/queue/delivery/SubmitTimedAssessmentThread.java index 51e2031c0240..5555017856bf 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/queue/delivery/SubmitTimedAssessmentThread.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/queue/delivery/SubmitTimedAssessmentThread.java @@ -23,8 +23,8 @@ import java.util.*; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.event.cover.EventTrackingService; import org.sakaiproject.event.cover.NotificationService; import org.sakaiproject.samigo.util.SamigoConstants; @@ -52,7 +52,7 @@ public class SubmitTimedAssessmentThread extends TimerTask { - private static final Log log = LogFactory.getLog(SubmitTimedAssessmentThread.class); + private static final Logger log = LoggerFactory.getLogger(SubmitTimedAssessmentThread.class); private static final ResourceBundle eventLogMessages = ResourceBundle.getBundle("org.sakaiproject.tool.assessment.bundle.EventLogMessages"); public SubmitTimedAssessmentThread(){} diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/queue/delivery/TimedAssessmentQueue.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/queue/delivery/TimedAssessmentQueue.java index 33aec7e8fccd..225fbebdce78 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/queue/delivery/TimedAssessmentQueue.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/queue/delivery/TimedAssessmentQueue.java @@ -26,8 +26,8 @@ import java.util.Timer; import java.util.concurrent.ConcurrentHashMap; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.ui.model.delivery.TimedAssessmentGradingModel; /** @@ -45,7 +45,7 @@ public class TimedAssessmentQueue { // private SubmitTimedAssessmentThread thread; private Timer timer; - private static Log log = LogFactory.getLog(TimedAssessmentQueue.class); + private static Logger log = LoggerFactory.getLogger(TimedAssessmentQueue.class); private TimedAssessmentQueue() { queue = new ConcurrentHashMap (); } diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/InitMimeTypes.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/InitMimeTypes.java index 9cfdc7f1b7f7..04a32697df5b 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/InitMimeTypes.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/InitMimeTypes.java @@ -26,8 +26,8 @@ import javax.servlet.http.HttpServlet; import javax.servlet.ServletConfig; import javax.servlet.ServletException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.FileInputStream; import java.io.IOException; import javax.activation.MimetypesFileTypeMap; @@ -39,7 +39,7 @@ public class InitMimeTypes extends HttpServlet{ * */ private static final long serialVersionUID = 6032485774950035961L; - private static Log log = LogFactory.getLog(InitMimeTypes.class); + private static Logger log = LoggerFactory.getLogger(InitMimeTypes.class); public void init (ServletConfig config) throws ServletException { super.init(config); diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/StoreApplicationContext.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/StoreApplicationContext.java index dda545de17c3..f76801365324 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/StoreApplicationContext.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/StoreApplicationContext.java @@ -26,8 +26,8 @@ import javax.servlet.http.HttpServlet; import javax.servlet.ServletConfig; import javax.servlet.ServletException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.WebApplicationContextUtils; import org.sakaiproject.spring.SpringBeanLocator; @@ -39,7 +39,7 @@ public class StoreApplicationContext extends HttpServlet{ * */ private static final long serialVersionUID = -930231313808212406L; -private static Log log = LogFactory.getLog(StoreApplicationContext.class); +private static Logger log = LoggerFactory.getLogger(StoreApplicationContext.class); private WebApplicationContext ctx = null; public void init (ServletConfig config) throws ServletException { diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/cp/DownloadCPServlet.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/cp/DownloadCPServlet.java index 392d9c3de480..fec3b7d95b90 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/cp/DownloadCPServlet.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/cp/DownloadCPServlet.java @@ -1,8 +1,8 @@ -/********************************************************************************** - * $URL: - * $Id: - *********************************************************************************** - * +/********************************************************************************** + * $URL: + * $Id: + *********************************************************************************** + * * Copyright (c) 2007, 2008, 2009 The Sakai Foundation * * Licensed under the Educational Community License, Version 2.0 (the "License"); @@ -16,213 +16,213 @@ * 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.sakaiproject.tool.assessment.ui.servlet.cp; - -import java.io.BufferedInputStream; -import java.io.IOException; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - -import javax.faces.application.FacesMessage; -import javax.faces.context.FacesContext; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.sakaiproject.authz.cover.SecurityService; -import org.sakaiproject.tool.assessment.contentpackaging.ManifestGenerator; -import org.sakaiproject.tool.assessment.facade.AgentFacade; -import org.sakaiproject.tool.assessment.services.assessment.AssessmentService; -import org.sakaiproject.tool.assessment.ui.bean.qti.XMLController; -import org.sakaiproject.tool.assessment.ui.bean.shared.PersonBean; -import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; - - -/** - *

Title: Samigo

- * @version $Id$ - */ - -public class DownloadCPServlet extends HttpServlet { - - private static Log log = LogFactory.getLog(DownloadCPServlet.class); - - /** - * passthu to post - * - * @param req - * @param res - * @throws ServletException - * @throws IOException - */ - public void doGet(HttpServletRequest req, HttpServletResponse res) - throws ServletException, IOException { - doPost(req, res); - } - - /** - * Get the faces context and display the contents of the XMLDisplay bean - * - * @param req - * @param res - * @throws ServletException - * @throws IOException - */ - public void doPost(HttpServletRequest req, HttpServletResponse res) - throws ServletException, IOException { - String assessmentId = req.getParameter("assessmentId"); - - //update random question pools (if any) before exporting - AssessmentService assessmentService = new AssessmentService(); - int success = assessmentService.updateAllRandomPoolQuestions(assessmentService.getAssessment(assessmentId)); - if(success == AssessmentService.UPDATE_SUCCESS){ - String agentIdString = getAgentString(req, res); - String currentSiteId = assessmentService - .getAssessmentSiteId(assessmentId); - String assessmentCreatedBy = assessmentService - .getAssessmentCreatedBy(assessmentId); - boolean accessDenied = true; - if (canExport(req, res, agentIdString, currentSiteId, - assessmentCreatedBy)) { - accessDenied = false; - } - - if (accessDenied) { - String path = "/jsf/qti/exportDenied.faces"; - RequestDispatcher dispatcher = req.getRequestDispatcher(path); - dispatcher.forward(req, res); - } else { - res.setContentType("application/x-zip-compressed"); - String zipFilename = "exportAssessment.zip"; - res.setHeader("Content-Disposition", "attachment;filename=\"" - + zipFilename + "\";"); - - ServletOutputStream outputStream = null; - //BufferedInputStream bufInputStream = null; - ZipOutputStream zos = null; - ZipEntry ze = null; - - try { - byte[] b = null; - outputStream = res.getOutputStream(); - zos = new ZipOutputStream(outputStream); - - // QTI file - ze = new ZipEntry("exportAssessment.xml"); - zos.putNextEntry(ze); - XMLController xmlController = (XMLController) ContextUtil - .lookupBeanFromExternalServlet("xmlController", req, - res); - xmlController.setId(assessmentId); - xmlController.setQtiVersion(1); - xmlController.displayAssessmentXml(); - String qtiString = xmlController.getXmlBean().getXml(); - log.debug("qtiString = " + qtiString); - b = qtiString.getBytes(); - zos.write(b, 0, b.length); - zos.closeEntry(); - - // imsmanifest.xml - ze = new ZipEntry("imsmanifest.xml"); - zos.putNextEntry(ze); - ManifestGenerator manifestGenerator = new ManifestGenerator( - assessmentId); - String manString = manifestGenerator.getManifest(); - log.debug("manString = " + manString); - b = manString.getBytes(); - zos.write(b, 0, b.length); - zos.closeEntry(); - - // Attachments - HashMap contentMap = manifestGenerator.getContentMap(); - - String filename = null; - for (Iterator it = contentMap.entrySet().iterator(); it.hasNext();) { - Map.Entry entry = (Map.Entry) it.next(); - filename = (String) entry.getKey(); - ze = new ZipEntry(filename.substring(1)); - zos.putNextEntry(ze); - b = (byte[]) entry.getValue(); - zos.write(b, 0, b.length); - zos.closeEntry(); - } - - } catch (IOException e) { - log.error(e.getMessage()); - throw e; - } finally { - if (zos != null) { - try { - zos.closeEntry(); - } catch (IOException e) { - log.error(e.getMessage()); - } - try { - zos.close(); - } catch (IOException e) { - log.error(e.getMessage()); - } - - } - } - } - }else{ - if(success == AssessmentService.UPDATE_ERROR_DRAW_SIZE_TOO_LARGE){ - String err=ContextUtil.getLocalizedString("org.sakaiproject.tool.assessment.bundle.AuthorMessages","update_pool_error_size_too_large"); - req.setAttribute("error", err); - }else{ - String err=ContextUtil.getLocalizedString("org.sakaiproject.tool.assessment.bundle.AuthorMessages","update_pool_error_unknown"); - req.setAttribute("error", err); - } - - String path = "/jsf/qti/poolUpdateError.faces"; - RequestDispatcher dispatcher = req.getRequestDispatcher(path); - dispatcher.forward(req, res); - } - } - - private boolean isOwner(String agentId, String ownerId) { - boolean isOwner = false; - isOwner = agentId.equals(ownerId); - return isOwner; - } - - private String getAgentString(HttpServletRequest req, - HttpServletResponse res) { - String agentIdString = AgentFacade.getAgentString(); - if (agentIdString == null || agentIdString.equals("")) { // try this - PersonBean person = (PersonBean) ContextUtil - .lookupBeanFromExternalServlet("person", req, res); - agentIdString = person.getAnonymousId(); - } - return agentIdString; - } - - public boolean canExport(HttpServletRequest req, HttpServletResponse res, - String agentId, String currentSiteId, String createdBy) { - log.debug("agentId=" + agentId); - log.debug("currentSiteId=" + currentSiteId); - boolean hasPrivilege_any = hasPrivilege(req, "assessment.editAssessment.any", - currentSiteId); - boolean hasPrivilege_own = hasPrivilege(req, "assessment.editAssessment.own", - currentSiteId); - log.debug("hasPrivilege_any=" + hasPrivilege_any); - log.debug("hasPrivilege_own=" + hasPrivilege_own); - boolean hasPrivilege = (hasPrivilege_any || (hasPrivilege_own && isOwner( - agentId, createdBy))); - return hasPrivilege; + * + **********************************************************************************/ + +package org.sakaiproject.tool.assessment.ui.servlet.cp; + +import java.io.BufferedInputStream; +import java.io.IOException; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +import javax.faces.application.FacesMessage; +import javax.faces.context.FacesContext; + +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletException; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sakaiproject.authz.cover.SecurityService; +import org.sakaiproject.tool.assessment.contentpackaging.ManifestGenerator; +import org.sakaiproject.tool.assessment.facade.AgentFacade; +import org.sakaiproject.tool.assessment.services.assessment.AssessmentService; +import org.sakaiproject.tool.assessment.ui.bean.qti.XMLController; +import org.sakaiproject.tool.assessment.ui.bean.shared.PersonBean; +import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; + + +/** + *

Title: Samigo

+ * @version $Id$ + */ + +public class DownloadCPServlet extends HttpServlet { + + private static Logger log = LoggerFactory.getLogger(DownloadCPServlet.class); + + /** + * passthu to post + * + * @param req + * @param res + * @throws ServletException + * @throws IOException + */ + public void doGet(HttpServletRequest req, HttpServletResponse res) + throws ServletException, IOException { + doPost(req, res); + } + + /** + * Get the faces context and display the contents of the XMLDisplay bean + * + * @param req + * @param res + * @throws ServletException + * @throws IOException + */ + public void doPost(HttpServletRequest req, HttpServletResponse res) + throws ServletException, IOException { + String assessmentId = req.getParameter("assessmentId"); + + //update random question pools (if any) before exporting + AssessmentService assessmentService = new AssessmentService(); + int success = assessmentService.updateAllRandomPoolQuestions(assessmentService.getAssessment(assessmentId)); + if(success == AssessmentService.UPDATE_SUCCESS){ + String agentIdString = getAgentString(req, res); + String currentSiteId = assessmentService + .getAssessmentSiteId(assessmentId); + String assessmentCreatedBy = assessmentService + .getAssessmentCreatedBy(assessmentId); + boolean accessDenied = true; + if (canExport(req, res, agentIdString, currentSiteId, + assessmentCreatedBy)) { + accessDenied = false; + } + + if (accessDenied) { + String path = "/jsf/qti/exportDenied.faces"; + RequestDispatcher dispatcher = req.getRequestDispatcher(path); + dispatcher.forward(req, res); + } else { + res.setContentType("application/x-zip-compressed"); + String zipFilename = "exportAssessment.zip"; + res.setHeader("Content-Disposition", "attachment;filename=\"" + + zipFilename + "\";"); + + ServletOutputStream outputStream = null; + //BufferedInputStream bufInputStream = null; + ZipOutputStream zos = null; + ZipEntry ze = null; + + try { + byte[] b = null; + outputStream = res.getOutputStream(); + zos = new ZipOutputStream(outputStream); + + // QTI file + ze = new ZipEntry("exportAssessment.xml"); + zos.putNextEntry(ze); + XMLController xmlController = (XMLController) ContextUtil + .lookupBeanFromExternalServlet("xmlController", req, + res); + xmlController.setId(assessmentId); + xmlController.setQtiVersion(1); + xmlController.displayAssessmentXml(); + String qtiString = xmlController.getXmlBean().getXml(); + log.debug("qtiString = " + qtiString); + b = qtiString.getBytes(); + zos.write(b, 0, b.length); + zos.closeEntry(); + + // imsmanifest.xml + ze = new ZipEntry("imsmanifest.xml"); + zos.putNextEntry(ze); + ManifestGenerator manifestGenerator = new ManifestGenerator( + assessmentId); + String manString = manifestGenerator.getManifest(); + log.debug("manString = " + manString); + b = manString.getBytes(); + zos.write(b, 0, b.length); + zos.closeEntry(); + + // Attachments + HashMap contentMap = manifestGenerator.getContentMap(); + + String filename = null; + for (Iterator it = contentMap.entrySet().iterator(); it.hasNext();) { + Map.Entry entry = (Map.Entry) it.next(); + filename = (String) entry.getKey(); + ze = new ZipEntry(filename.substring(1)); + zos.putNextEntry(ze); + b = (byte[]) entry.getValue(); + zos.write(b, 0, b.length); + zos.closeEntry(); + } + + } catch (IOException e) { + log.error(e.getMessage()); + throw e; + } finally { + if (zos != null) { + try { + zos.closeEntry(); + } catch (IOException e) { + log.error(e.getMessage()); + } + try { + zos.close(); + } catch (IOException e) { + log.error(e.getMessage()); + } + + } + } + } + }else{ + if(success == AssessmentService.UPDATE_ERROR_DRAW_SIZE_TOO_LARGE){ + String err=ContextUtil.getLocalizedString("org.sakaiproject.tool.assessment.bundle.AuthorMessages","update_pool_error_size_too_large"); + req.setAttribute("error", err); + }else{ + String err=ContextUtil.getLocalizedString("org.sakaiproject.tool.assessment.bundle.AuthorMessages","update_pool_error_unknown"); + req.setAttribute("error", err); + } + + String path = "/jsf/qti/poolUpdateError.faces"; + RequestDispatcher dispatcher = req.getRequestDispatcher(path); + dispatcher.forward(req, res); + } + } + + private boolean isOwner(String agentId, String ownerId) { + boolean isOwner = false; + isOwner = agentId.equals(ownerId); + return isOwner; + } + + private String getAgentString(HttpServletRequest req, + HttpServletResponse res) { + String agentIdString = AgentFacade.getAgentString(); + if (agentIdString == null || agentIdString.equals("")) { // try this + PersonBean person = (PersonBean) ContextUtil + .lookupBeanFromExternalServlet("person", req, res); + agentIdString = person.getAnonymousId(); + } + return agentIdString; + } + + public boolean canExport(HttpServletRequest req, HttpServletResponse res, + String agentId, String currentSiteId, String createdBy) { + log.debug("agentId=" + agentId); + log.debug("currentSiteId=" + currentSiteId); + boolean hasPrivilege_any = hasPrivilege(req, "assessment.editAssessment.any", + currentSiteId); + boolean hasPrivilege_own = hasPrivilege(req, "assessment.editAssessment.own", + currentSiteId); + log.debug("hasPrivilege_any=" + hasPrivilege_any); + log.debug("hasPrivilege_own=" + hasPrivilege_own); + boolean hasPrivilege = (hasPrivilege_any || (hasPrivilege_own && isOwner( + agentId, createdBy))); + return hasPrivilege; } public boolean hasPrivilege(HttpServletRequest req, String functionName, String context) { diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/delivery/DownloadAllMediaServlet.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/delivery/DownloadAllMediaServlet.java index cd37fb4fa27a..be2a87deec0b 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/delivery/DownloadAllMediaServlet.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/delivery/DownloadAllMediaServlet.java @@ -1,8 +1,8 @@ -/********************************************************************************** - * $URL$ - * $Id$ - *********************************************************************************** - * +/********************************************************************************** + * $URL$ + * $Id$ + *********************************************************************************** + * * Copyright (c) 2005, 2006, 2007, 2008, 2009 The Sakai Foundation * * Licensed under the Educational Community License, Version 2.0 (the "License"); @@ -16,465 +16,465 @@ * 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.sakaiproject.tool.assessment.ui.servlet.delivery; -import java.io.BufferedInputStream; -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.sakaiproject.tool.assessment.data.dao.grading.ItemGradingData; -import org.sakaiproject.tool.assessment.data.dao.grading.MediaData; -import org.sakaiproject.tool.assessment.data.ifc.assessment.ItemDataIfc; -import org.sakaiproject.tool.assessment.data.ifc.assessment.PublishedAssessmentIfc; -import org.sakaiproject.tool.assessment.facade.AgentFacade; -import org.sakaiproject.tool.assessment.integration.helper.integrated.AgentHelperImpl; -import org.sakaiproject.tool.assessment.services.GradingService; -import org.sakaiproject.tool.assessment.services.assessment.PublishedAssessmentService; -import org.sakaiproject.tool.assessment.shared.impl.assessment.PublishedAssessmentServiceImpl; -import org.sakaiproject.tool.assessment.ui.bean.authz.AuthorizationBean; -import org.sakaiproject.tool.assessment.ui.bean.evaluation.QuestionScoresBean; -import org.sakaiproject.tool.assessment.ui.bean.shared.PersonBean; -import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; - -/** - *

Title: Samigo

- *

Description: Sakai Assessment Manager

- * @author Ed Smiley - * @version $Id$ - */ - -public class DownloadAllMediaServlet extends HttpServlet -{ - /** - * - */ - private static final long serialVersionUID = 1465451058167004991L; - private static Log log = LogFactory.getLog(DownloadAllMediaServlet.class); - private GradingService gradingService = new GradingService(); - - public DownloadAllMediaServlet() - { - } - - public void doGet(HttpServletRequest req, HttpServletResponse res) - throws ServletException, IOException - { - doPost(req,res); - } - - public void doPost(HttpServletRequest req, HttpServletResponse res) - throws ServletException, IOException - { - String publishedItemId = req.getParameter("publishedItemId"); - String publishedId = req.getParameter("publishedId"); - log.debug("publishedItemId = " + publishedItemId + " publishedId = " + publishedId); - - // who can access the zip file? You can, - // if you have a assessment.grade.any or assessment.grade.own permission - boolean accessDenied = true; - String agentIdString = getAgentString(req, res); - String currentSiteId=""; - String assessmentName = ""; - - PublishedAssessmentIfc pub = gradingService.getPublishedAssessmentByPublishedItemId(publishedItemId); - if (pub != null){ - assessmentName = pub.getTitle(); - PublishedAssessmentService service = new PublishedAssessmentService(); - log.debug("pub.getPublishedAssessmentId() = " + pub.getPublishedAssessmentId()); - currentSiteId = service.getPublishedAssessmentOwner(pub.getPublishedAssessmentId()); - } - // get assessment's ownerId - String assessmentCreatedBy = req.getParameter("createdBy"); - - AuthorizationBean authzBean = (AuthorizationBean) ContextUtil.lookupBeanFromExternalServlet("authorization", req, res); - if (authzBean.isUserAllowedToGradeAssessment(publishedId, assessmentCreatedBy, true, currentSiteId)) { - accessDenied = false; - } - - if (accessDenied){ - String path = "/jsf/delivery/mediaAccessDenied.faces"; - RequestDispatcher dispatcher = req.getRequestDispatcher(path); - dispatcher.forward(req, res); - } - else { - res.setContentType("application/x-zip-compressed"); - StringBuilder zipFilename = new StringBuilder(); - zipFilename.append(assessmentName); - String partAndQues = getPartNumAndQuestionNum(publishedItemId); - log.debug("partAndQues = " + partAndQues); - zipFilename.append(partAndQues); - zipFilename.append((".zip")); - log.debug("zipFilename = " + zipFilename); - res.setHeader("Content-Disposition", "attachment;filename=\"" + zipFilename + "\";"); - - String anonymous = req.getParameter("anonymous"); - if ("true".equals(anonymous)) { - processAnonymous(req, res); - } - else { - processNonAnonymous(req, res); - } - } - } - - private void processAnonymous(HttpServletRequest req, HttpServletResponse res){ - String publishedId = req.getParameter("publishedId"); - String publishedItemId = req.getParameter("publishedItemId"); - String scoringType = req.getParameter("scoringType"); - log.debug("publishedId = " + publishedId); - log.debug("publishedItemId = " + publishedItemId); - log.debug("scoringType = " + scoringType); - - GradingService gradingService = new GradingService(); - List mediaList = gradingService.getMediaArray(publishedId,publishedItemId, scoringType); - - MediaData mediaData; - log.debug("mediaList.size() = " + mediaList.size()); - - ZipOutputStream zos = null; - try{ - ServletOutputStream outputStream = res.getOutputStream(); - zos = new ZipOutputStream(outputStream); - for (int i = 0; i < mediaList.size(); i++){ - mediaData = (MediaData) mediaList.get(i); - processOneMediaData(zos, mediaData, true, -1); - } - } - catch(IOException e){ - log.error(e.getMessage()); - e.printStackTrace(); - } - finally { - if (zos != null) { - try { - zos.close(); - } - catch(IOException e) { - log.error(e.getMessage()); - } - } - } - } - - private void processNonAnonymous(HttpServletRequest req, HttpServletResponse res){ - String publishedId = req.getParameter("publishedId"); - String publishedItemId = req.getParameter("publishedItemId"); - String scoringType = req.getParameter("scoringType"); - log.debug("publishedId = " + publishedId); - log.debug("publishedItemId = " + publishedItemId); - log.debug("scoringType = " + scoringType); - - Map>> hashByAgentId = new HashMap>>(); - Map> subHashByAssessmentGradingId; - MediaData mediaData; - List list; - ItemGradingData itemGradingData; - - List mediaList; - mediaList = gradingService.getMediaArray(publishedId, publishedItemId, scoringType); - log.debug("mediaList.size() = " + mediaList.size()); - - QuestionScoresBean questionScoresBean = (QuestionScoresBean) ContextUtil.lookupBeanFromExternalServlet( - "questionScores", req, res); - Map userIdMap = questionScoresBean.getUserIdMap(); - - String agentId; - Long assessmentGradingId; - for (int i = 0; i < mediaList.size(); i++) { - mediaData = (MediaData) mediaList.get(i); - itemGradingData = (ItemGradingData) mediaData.getItemGradingData(); - agentId = itemGradingData.getAgentId(); - assessmentGradingId = itemGradingData.getAssessmentGradingId(); - log.debug("agentId = " + agentId); - log.debug("assessmentGradingId = " + assessmentGradingId); - if (!userIdMap.containsKey(agentId)) { - log.debug("Do not download files from this user - agentId = " + agentId); - continue; - } - if (hashByAgentId.containsKey(agentId)) { - log.debug("same agentId"); - subHashByAssessmentGradingId = hashByAgentId.get(agentId); - if (subHashByAssessmentGradingId.containsKey(assessmentGradingId)) { - log.debug("same assessmentGradingId"); - list = subHashByAssessmentGradingId.get(assessmentGradingId); - list.add(mediaData); - } - else { - log.debug("different assessmentGradingId"); - list = new ArrayList(); - list.add(mediaData); - subHashByAssessmentGradingId.put(assessmentGradingId, list); - } - } - else { - log.debug("different agentId"); - list = new ArrayList(); - list.add(mediaData); - subHashByAssessmentGradingId = new HashMap>(); - subHashByAssessmentGradingId.put(assessmentGradingId, list); - hashByAgentId.put(agentId, subHashByAssessmentGradingId); - } - } - log.debug("HashMap built successfully"); - ZipOutputStream zos = null; - try { - ServletOutputStream outputStream = res.getOutputStream(); - zos = new ZipOutputStream(outputStream); - - Map hashMap; - Iterator iter = hashByAgentId.values().iterator(); - int numberSubmission; - while (iter.hasNext()) { - hashMap = (HashMap) iter.next(); - numberSubmission = hashMap.size(); - log.debug("numberSubmission = " + numberSubmission); - Iterator subIter = hashMap.keySet().iterator(); - // this student has submitted more than once - if (numberSubmission > 1) { - // Because Hashmap makes no guarantees as to the order of the map; - // and it does not guarantee that the order will remain constant over time, - // following implementation is to make sure we get the correct order - // that is, if there are two submissions from John Doe: - // submission id 24 submitted on Jun 28, 2006 (file A.txt) - // submission id 33 submitted on Jul 03, 2006 (file B.txt) - // We want to make sure the filename of these two are: - // Doe_John_sub1_A.txt and Doe_John_sub2_B.txt - // If we don't sort it, the outcome might be: - // Doe_John_sub2_A.txt and Doe_John_sub1_B.txt which are not what we want - List keyList = new ArrayList(); - Long key; - while(subIter.hasNext()) { - key = (Long) subIter.next(); - log.debug("key = " + key); - keyList.add(key); - Collections.sort(keyList); - } - - ArrayList valueList; - Long sortedKey; - for (int i = 0; i < keyList.size(); i++) { - sortedKey = (Long) keyList.get(i); - valueList = (ArrayList) hashMap.get(sortedKey); - for (int j = 0; j < valueList.size(); j++) { - log.debug("j = " + j); - mediaData = (MediaData) valueList.get(j); - processOneMediaData(zos, mediaData, false, i+1); - } - } - } - // this student has only one submission - else if (numberSubmission == 1){ - ArrayList valueList; - while(subIter.hasNext()) { - valueList = (ArrayList) hashMap.get(subIter.next()); - log.debug("valueList.size() = " + valueList.size()); - for (int i = 0; i < valueList.size(); i++) { - log.debug("i = " + i); - mediaData = (MediaData) valueList.get(i); - // we use "-1" to indicate one submission - // "sub" will not be instered into filename - processOneMediaData(zos, mediaData, false, -1); - } - } - } - } - } - catch (IOException e) { - log.error(e.getMessage()); - e.printStackTrace(); - } - finally { - if (zos != null) { - try { - zos.close(); - } - catch(IOException e) { - log.error(e.getMessage()); - } - } - } - } - - private void processOneMediaData(ZipOutputStream zos, MediaData mediaData, boolean anonymous, int numberSubmission) - throws IOException { - int BUFFER_SIZE = 2048; - byte data[] = new byte[ BUFFER_SIZE ]; - int count = 0; - BufferedInputStream bufInputStream = null; - ZipEntry ze = null; - String mediaLocation = mediaData.getLocation(); - log.debug("mediaLocation = " + mediaLocation); - String filename = getFilename(mediaData, anonymous, numberSubmission); - //SAM-1468 we need to ensure the fileName is unique - filename = getUniqueFilename(filename); - if (mediaLocation == null || (mediaLocation.trim()).equals("")){ - byte[] media = mediaData.getMedia(); - log.debug("media.length = " + media.length); - bufInputStream = new BufferedInputStream(new ByteArrayInputStream(media)); - } - else { - bufInputStream = new BufferedInputStream(getFileStream(mediaLocation)); - } - ze = new ZipEntry(filename); - try { - zos.putNextEntry(ze); - while( (count = bufInputStream.read(data, 0, BUFFER_SIZE)) != -1 ) { - zos.write(data, 0, count); - } - } - catch(IOException e){ - log.error(e.getMessage()); - throw e; - } - finally { - if (bufInputStream != null) { - try { - bufInputStream.close(); - } - catch(IOException e) { - log.error(e.getMessage()); - } - } - if (zos != null) { - try { - zos.closeEntry(); - } - catch(IOException e) { - log.error(e.getMessage()); - } - } - } - } - - //A list of the files in the Zip - private List filesInZip = new ArrayList(); - - public String getUniqueFilename(String fileName) { - - if (!filesInZip.contains(fileName)) { - filesInZip.add(fileName); - return fileName; - } else { - //there already is a file of this name - int i = 1; - String origFileName = fileName; - while (filesInZip.contains(fileName)) { - - String extension = ""; - if (origFileName.contains(".")) { - extension = origFileName.substring(origFileName.lastIndexOf(".")); - } - - fileName = origFileName.substring(0, origFileName.length() - extension.length()); - fileName = fileName + "-" + i + extension; - i++; - } - filesInZip.add(fileName); - } - - return fileName; -} - -private FileInputStream getFileStream(String mediaLocation){ - FileInputStream inputStream=null; - try{ - File media=new File(mediaLocation); - inputStream = new FileInputStream(media); - } - catch (FileNotFoundException ex) { - log.warn("file not found="+ex.getMessage()); - } - return inputStream; - } - - public String getAgentString(HttpServletRequest req, HttpServletResponse res){ - String agentIdString = AgentFacade.getAgentString(); - if (agentIdString == null || agentIdString.equals("")){ // try this - PersonBean person = (PersonBean) ContextUtil.lookupBeanFromExternalServlet( - "person", req, res); - agentIdString = person.getAnonymousId(); - } - return agentIdString; - } - - private String getPartNumAndQuestionNum(String itemId){ - log.debug("itemId = " + itemId); - PublishedAssessmentServiceImpl pubAssessmentServiceImpl = new PublishedAssessmentServiceImpl(); - ItemDataIfc item = pubAssessmentServiceImpl.loadPublishedItem(itemId); - Integer partNum = item.getSection().getSequence(); - log.debug("partNum = " + partNum); - Integer questionNum = item.getSequence(); - log.debug("questionNum=" + questionNum); - StringBuilder partAndQues = new StringBuilder("_Part"); - partAndQues.append(partNum); - partAndQues.append("_Ques"); - partAndQues.append(questionNum); - log.debug("partAndQues = " + partAndQues); - return partAndQues.toString(); - } - - private String getFilename(MediaData mediaData, boolean anonymous, int numberSubmission) { - log.debug("numberSubmission = " + numberSubmission); - StringBuilder filename = new StringBuilder(); - ItemGradingData itemGradingData = (ItemGradingData) mediaData.getItemGradingData(); - if (anonymous) { - Long assessmentGradingId = itemGradingData.getAssessmentGradingId(); - log.debug("submissionId(assessmentGradingId) = " + assessmentGradingId); - filename.append(assessmentGradingId); - filename.append("_"); - filename.append(mediaData.getFilename()); - log.debug("filename = " + filename); - } - else { - AgentHelperImpl helper = new AgentHelperImpl(); - String agentId = itemGradingData.getAgentId(); - String lastName = helper.getLastName(agentId); - String firstName = helper.getFirstName(agentId); - String eid = helper.getEidById(agentId); - filename.append(lastName); - filename.append("_"); - filename.append(firstName); - filename.append("_"); - filename.append(eid); - filename.append("_"); - log.debug("filename = " + filename); - if (numberSubmission == -1) { - filename.append(mediaData.getFilename()); - log.debug("filename = " + filename); - } - else { - filename.append("sub"); - filename.append(numberSubmission); - filename.append("_"); - filename.append(mediaData.getFilename()); - log.debug("filename = " + filename); - } - } - - return filename.toString(); - } -} + * + **********************************************************************************/ + + + +package org.sakaiproject.tool.assessment.ui.servlet.delivery; +import java.io.BufferedInputStream; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletException; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sakaiproject.tool.assessment.data.dao.grading.ItemGradingData; +import org.sakaiproject.tool.assessment.data.dao.grading.MediaData; +import org.sakaiproject.tool.assessment.data.ifc.assessment.ItemDataIfc; +import org.sakaiproject.tool.assessment.data.ifc.assessment.PublishedAssessmentIfc; +import org.sakaiproject.tool.assessment.facade.AgentFacade; +import org.sakaiproject.tool.assessment.integration.helper.integrated.AgentHelperImpl; +import org.sakaiproject.tool.assessment.services.GradingService; +import org.sakaiproject.tool.assessment.services.assessment.PublishedAssessmentService; +import org.sakaiproject.tool.assessment.shared.impl.assessment.PublishedAssessmentServiceImpl; +import org.sakaiproject.tool.assessment.ui.bean.authz.AuthorizationBean; +import org.sakaiproject.tool.assessment.ui.bean.evaluation.QuestionScoresBean; +import org.sakaiproject.tool.assessment.ui.bean.shared.PersonBean; +import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; + +/** + *

Title: Samigo

+ *

Description: Sakai Assessment Manager

+ * @author Ed Smiley + * @version $Id$ + */ + +public class DownloadAllMediaServlet extends HttpServlet +{ + /** + * + */ + private static final long serialVersionUID = 1465451058167004991L; + private static Logger log = LoggerFactory.getLogger(DownloadAllMediaServlet.class); + private GradingService gradingService = new GradingService(); + + public DownloadAllMediaServlet() + { + } + + public void doGet(HttpServletRequest req, HttpServletResponse res) + throws ServletException, IOException + { + doPost(req,res); + } + + public void doPost(HttpServletRequest req, HttpServletResponse res) + throws ServletException, IOException + { + String publishedItemId = req.getParameter("publishedItemId"); + String publishedId = req.getParameter("publishedId"); + log.debug("publishedItemId = " + publishedItemId + " publishedId = " + publishedId); + + // who can access the zip file? You can, + // if you have a assessment.grade.any or assessment.grade.own permission + boolean accessDenied = true; + String agentIdString = getAgentString(req, res); + String currentSiteId=""; + String assessmentName = ""; + + PublishedAssessmentIfc pub = gradingService.getPublishedAssessmentByPublishedItemId(publishedItemId); + if (pub != null){ + assessmentName = pub.getTitle(); + PublishedAssessmentService service = new PublishedAssessmentService(); + log.debug("pub.getPublishedAssessmentId() = " + pub.getPublishedAssessmentId()); + currentSiteId = service.getPublishedAssessmentOwner(pub.getPublishedAssessmentId()); + } + // get assessment's ownerId + String assessmentCreatedBy = req.getParameter("createdBy"); + + AuthorizationBean authzBean = (AuthorizationBean) ContextUtil.lookupBeanFromExternalServlet("authorization", req, res); + if (authzBean.isUserAllowedToGradeAssessment(publishedId, assessmentCreatedBy, true, currentSiteId)) { + accessDenied = false; + } + + if (accessDenied){ + String path = "/jsf/delivery/mediaAccessDenied.faces"; + RequestDispatcher dispatcher = req.getRequestDispatcher(path); + dispatcher.forward(req, res); + } + else { + res.setContentType("application/x-zip-compressed"); + StringBuilder zipFilename = new StringBuilder(); + zipFilename.append(assessmentName); + String partAndQues = getPartNumAndQuestionNum(publishedItemId); + log.debug("partAndQues = " + partAndQues); + zipFilename.append(partAndQues); + zipFilename.append((".zip")); + log.debug("zipFilename = " + zipFilename); + res.setHeader("Content-Disposition", "attachment;filename=\"" + zipFilename + "\";"); + + String anonymous = req.getParameter("anonymous"); + if ("true".equals(anonymous)) { + processAnonymous(req, res); + } + else { + processNonAnonymous(req, res); + } + } + } + + private void processAnonymous(HttpServletRequest req, HttpServletResponse res){ + String publishedId = req.getParameter("publishedId"); + String publishedItemId = req.getParameter("publishedItemId"); + String scoringType = req.getParameter("scoringType"); + log.debug("publishedId = " + publishedId); + log.debug("publishedItemId = " + publishedItemId); + log.debug("scoringType = " + scoringType); + + GradingService gradingService = new GradingService(); + List mediaList = gradingService.getMediaArray(publishedId,publishedItemId, scoringType); + + MediaData mediaData; + log.debug("mediaList.size() = " + mediaList.size()); + + ZipOutputStream zos = null; + try{ + ServletOutputStream outputStream = res.getOutputStream(); + zos = new ZipOutputStream(outputStream); + for (int i = 0; i < mediaList.size(); i++){ + mediaData = (MediaData) mediaList.get(i); + processOneMediaData(zos, mediaData, true, -1); + } + } + catch(IOException e){ + log.error(e.getMessage()); + e.printStackTrace(); + } + finally { + if (zos != null) { + try { + zos.close(); + } + catch(IOException e) { + log.error(e.getMessage()); + } + } + } + } + + private void processNonAnonymous(HttpServletRequest req, HttpServletResponse res){ + String publishedId = req.getParameter("publishedId"); + String publishedItemId = req.getParameter("publishedItemId"); + String scoringType = req.getParameter("scoringType"); + log.debug("publishedId = " + publishedId); + log.debug("publishedItemId = " + publishedItemId); + log.debug("scoringType = " + scoringType); + + Map>> hashByAgentId = new HashMap>>(); + Map> subHashByAssessmentGradingId; + MediaData mediaData; + List list; + ItemGradingData itemGradingData; + + List mediaList; + mediaList = gradingService.getMediaArray(publishedId, publishedItemId, scoringType); + log.debug("mediaList.size() = " + mediaList.size()); + + QuestionScoresBean questionScoresBean = (QuestionScoresBean) ContextUtil.lookupBeanFromExternalServlet( + "questionScores", req, res); + Map userIdMap = questionScoresBean.getUserIdMap(); + + String agentId; + Long assessmentGradingId; + for (int i = 0; i < mediaList.size(); i++) { + mediaData = (MediaData) mediaList.get(i); + itemGradingData = (ItemGradingData) mediaData.getItemGradingData(); + agentId = itemGradingData.getAgentId(); + assessmentGradingId = itemGradingData.getAssessmentGradingId(); + log.debug("agentId = " + agentId); + log.debug("assessmentGradingId = " + assessmentGradingId); + if (!userIdMap.containsKey(agentId)) { + log.debug("Do not download files from this user - agentId = " + agentId); + continue; + } + if (hashByAgentId.containsKey(agentId)) { + log.debug("same agentId"); + subHashByAssessmentGradingId = hashByAgentId.get(agentId); + if (subHashByAssessmentGradingId.containsKey(assessmentGradingId)) { + log.debug("same assessmentGradingId"); + list = subHashByAssessmentGradingId.get(assessmentGradingId); + list.add(mediaData); + } + else { + log.debug("different assessmentGradingId"); + list = new ArrayList(); + list.add(mediaData); + subHashByAssessmentGradingId.put(assessmentGradingId, list); + } + } + else { + log.debug("different agentId"); + list = new ArrayList(); + list.add(mediaData); + subHashByAssessmentGradingId = new HashMap>(); + subHashByAssessmentGradingId.put(assessmentGradingId, list); + hashByAgentId.put(agentId, subHashByAssessmentGradingId); + } + } + log.debug("HashMap built successfully"); + ZipOutputStream zos = null; + try { + ServletOutputStream outputStream = res.getOutputStream(); + zos = new ZipOutputStream(outputStream); + + Map hashMap; + Iterator iter = hashByAgentId.values().iterator(); + int numberSubmission; + while (iter.hasNext()) { + hashMap = (HashMap) iter.next(); + numberSubmission = hashMap.size(); + log.debug("numberSubmission = " + numberSubmission); + Iterator subIter = hashMap.keySet().iterator(); + // this student has submitted more than once + if (numberSubmission > 1) { + // Because Hashmap makes no guarantees as to the order of the map; + // and it does not guarantee that the order will remain constant over time, + // following implementation is to make sure we get the correct order + // that is, if there are two submissions from John Doe: + // submission id 24 submitted on Jun 28, 2006 (file A.txt) + // submission id 33 submitted on Jul 03, 2006 (file B.txt) + // We want to make sure the filename of these two are: + // Doe_John_sub1_A.txt and Doe_John_sub2_B.txt + // If we don't sort it, the outcome might be: + // Doe_John_sub2_A.txt and Doe_John_sub1_B.txt which are not what we want + List keyList = new ArrayList(); + Long key; + while(subIter.hasNext()) { + key = (Long) subIter.next(); + log.debug("key = " + key); + keyList.add(key); + Collections.sort(keyList); + } + + ArrayList valueList; + Long sortedKey; + for (int i = 0; i < keyList.size(); i++) { + sortedKey = (Long) keyList.get(i); + valueList = (ArrayList) hashMap.get(sortedKey); + for (int j = 0; j < valueList.size(); j++) { + log.debug("j = " + j); + mediaData = (MediaData) valueList.get(j); + processOneMediaData(zos, mediaData, false, i+1); + } + } + } + // this student has only one submission + else if (numberSubmission == 1){ + ArrayList valueList; + while(subIter.hasNext()) { + valueList = (ArrayList) hashMap.get(subIter.next()); + log.debug("valueList.size() = " + valueList.size()); + for (int i = 0; i < valueList.size(); i++) { + log.debug("i = " + i); + mediaData = (MediaData) valueList.get(i); + // we use "-1" to indicate one submission + // "sub" will not be instered into filename + processOneMediaData(zos, mediaData, false, -1); + } + } + } + } + } + catch (IOException e) { + log.error(e.getMessage()); + e.printStackTrace(); + } + finally { + if (zos != null) { + try { + zos.close(); + } + catch(IOException e) { + log.error(e.getMessage()); + } + } + } + } + + private void processOneMediaData(ZipOutputStream zos, MediaData mediaData, boolean anonymous, int numberSubmission) + throws IOException { + int BUFFER_SIZE = 2048; + byte data[] = new byte[ BUFFER_SIZE ]; + int count = 0; + BufferedInputStream bufInputStream = null; + ZipEntry ze = null; + String mediaLocation = mediaData.getLocation(); + log.debug("mediaLocation = " + mediaLocation); + String filename = getFilename(mediaData, anonymous, numberSubmission); + //SAM-1468 we need to ensure the fileName is unique + filename = getUniqueFilename(filename); + if (mediaLocation == null || (mediaLocation.trim()).equals("")){ + byte[] media = mediaData.getMedia(); + log.debug("media.length = " + media.length); + bufInputStream = new BufferedInputStream(new ByteArrayInputStream(media)); + } + else { + bufInputStream = new BufferedInputStream(getFileStream(mediaLocation)); + } + ze = new ZipEntry(filename); + try { + zos.putNextEntry(ze); + while( (count = bufInputStream.read(data, 0, BUFFER_SIZE)) != -1 ) { + zos.write(data, 0, count); + } + } + catch(IOException e){ + log.error(e.getMessage()); + throw e; + } + finally { + if (bufInputStream != null) { + try { + bufInputStream.close(); + } + catch(IOException e) { + log.error(e.getMessage()); + } + } + if (zos != null) { + try { + zos.closeEntry(); + } + catch(IOException e) { + log.error(e.getMessage()); + } + } + } + } + + //A list of the files in the Zip + private List filesInZip = new ArrayList(); + + public String getUniqueFilename(String fileName) { + + if (!filesInZip.contains(fileName)) { + filesInZip.add(fileName); + return fileName; + } else { + //there already is a file of this name + int i = 1; + String origFileName = fileName; + while (filesInZip.contains(fileName)) { + + String extension = ""; + if (origFileName.contains(".")) { + extension = origFileName.substring(origFileName.lastIndexOf(".")); + } + + fileName = origFileName.substring(0, origFileName.length() - extension.length()); + fileName = fileName + "-" + i + extension; + i++; + } + filesInZip.add(fileName); + } + + return fileName; +} + +private FileInputStream getFileStream(String mediaLocation){ + FileInputStream inputStream=null; + try{ + File media=new File(mediaLocation); + inputStream = new FileInputStream(media); + } + catch (FileNotFoundException ex) { + log.warn("file not found="+ex.getMessage()); + } + return inputStream; + } + + public String getAgentString(HttpServletRequest req, HttpServletResponse res){ + String agentIdString = AgentFacade.getAgentString(); + if (agentIdString == null || agentIdString.equals("")){ // try this + PersonBean person = (PersonBean) ContextUtil.lookupBeanFromExternalServlet( + "person", req, res); + agentIdString = person.getAnonymousId(); + } + return agentIdString; + } + + private String getPartNumAndQuestionNum(String itemId){ + log.debug("itemId = " + itemId); + PublishedAssessmentServiceImpl pubAssessmentServiceImpl = new PublishedAssessmentServiceImpl(); + ItemDataIfc item = pubAssessmentServiceImpl.loadPublishedItem(itemId); + Integer partNum = item.getSection().getSequence(); + log.debug("partNum = " + partNum); + Integer questionNum = item.getSequence(); + log.debug("questionNum=" + questionNum); + StringBuilder partAndQues = new StringBuilder("_Part"); + partAndQues.append(partNum); + partAndQues.append("_Ques"); + partAndQues.append(questionNum); + log.debug("partAndQues = " + partAndQues); + return partAndQues.toString(); + } + + private String getFilename(MediaData mediaData, boolean anonymous, int numberSubmission) { + log.debug("numberSubmission = " + numberSubmission); + StringBuilder filename = new StringBuilder(); + ItemGradingData itemGradingData = (ItemGradingData) mediaData.getItemGradingData(); + if (anonymous) { + Long assessmentGradingId = itemGradingData.getAssessmentGradingId(); + log.debug("submissionId(assessmentGradingId) = " + assessmentGradingId); + filename.append(assessmentGradingId); + filename.append("_"); + filename.append(mediaData.getFilename()); + log.debug("filename = " + filename); + } + else { + AgentHelperImpl helper = new AgentHelperImpl(); + String agentId = itemGradingData.getAgentId(); + String lastName = helper.getLastName(agentId); + String firstName = helper.getFirstName(agentId); + String eid = helper.getEidById(agentId); + filename.append(lastName); + filename.append("_"); + filename.append(firstName); + filename.append("_"); + filename.append(eid); + filename.append("_"); + log.debug("filename = " + filename); + if (numberSubmission == -1) { + filename.append(mediaData.getFilename()); + log.debug("filename = " + filename); + } + else { + filename.append("sub"); + filename.append(numberSubmission); + filename.append("_"); + filename.append(mediaData.getFilename()); + log.debug("filename = " + filename); + } + } + + return filename.toString(); + } +} diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/delivery/LoginServlet.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/delivery/LoginServlet.java index 73648607ebd1..3d11e2f5c8da 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/delivery/LoginServlet.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/delivery/LoginServlet.java @@ -38,8 +38,8 @@ import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.exception.IdUnusedException; import org.sakaiproject.site.api.Group; import org.sakaiproject.site.cover.SiteService; @@ -71,7 +71,7 @@ public class LoginServlet * */ private static final long serialVersionUID = -5495078878170443939L; - private static Log log = LogFactory.getLog(LoginServlet.class); + private static Logger log = LoggerFactory.getLogger(LoginServlet.class); private SiteService siteService; diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/delivery/ShowAttachmentMediaServlet.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/delivery/ShowAttachmentMediaServlet.java index 00637a684ab4..9d43e43ec3b4 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/delivery/ShowAttachmentMediaServlet.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/delivery/ShowAttachmentMediaServlet.java @@ -1,8 +1,8 @@ -/********************************************************************************** - * $URL$ - * $Id$ - *********************************************************************************** - * +/********************************************************************************** + * $URL$ + * $Id$ + *********************************************************************************** + * * Copyright (c) 2005, 2006, 2007, 2008, 2009 The Sakai Foundation * * Licensed under the Educational Community License, Version 2.0 (the "License"); @@ -16,177 +16,177 @@ * 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.sakaiproject.tool.assessment.ui.servlet.delivery; -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.ByteArrayInputStream; -import java.io.FileInputStream; -import java.io.IOException; - -import javax.servlet.ServletException; -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.sakaiproject.content.api.ContentResource; -import org.sakaiproject.exception.IdUnusedException; -import org.sakaiproject.exception.PermissionException; -import org.sakaiproject.exception.ServerOverloadException; -import org.sakaiproject.exception.TypeException; -import org.sakaiproject.tool.assessment.data.dao.assessment.PublishedAttachmentData; -import org.sakaiproject.tool.assessment.services.assessment.AssessmentService; -import org.sakaiproject.tool.assessment.util.TextFormat; - -/** - *

- * Title: Samigo - *

- *

- * Description: Sakai Assessment Manager - *

- *

- * Copyright: Copyright (c) 2004 Sakai Project - *

- *

- * Organization: Sakai Project - *

- * - * @author Ed Smiley - * @version $Id: .java 17070 2006-10-12 00:07:52Z - * ktsao@stanford.edu $ - */ - -public class ShowAttachmentMediaServlet extends HttpServlet -{ - /** - * - */ - private static final long serialVersionUID = 2203681863823855810L; - private static Log log = LogFactory.getLog(ShowAttachmentMediaServlet.class); - - public ShowAttachmentMediaServlet() - { - } - - public void doGet(HttpServletRequest req, HttpServletResponse res) - throws ServletException, IOException - { - doPost(req,res); - } - - public void doPost(HttpServletRequest req, HttpServletResponse res) - throws ServletException, IOException - { - String resourceId = req.getParameter("resourceId"); - String mimeType = req.getParameter("mimeType"); - String filename = req.getParameter("filename"); - - String cleanedFilename = TextFormat.convertPlaintextToFormattedTextNoHighUnicode(log, filename); - - res.setHeader("Content-Disposition", "inline;filename=\"" + cleanedFilename +"\";"); - log.debug("resourceId = " + resourceId); - log.debug("mimeType = " + mimeType); - log.debug("cleanedFilename = " + cleanedFilename); - - // ** note that res.setContentType() must be called before - // res.getOutputStream(). see javadoc on this - res.setContentType(mimeType); - - ContentResource cr = null; - byte[] media = null; - try { - // create a copy of the resource - cr = AssessmentService.getContentHostingService().getResource(resourceId); - if (cr == null) { - return; - } - media = cr.getContent(); - if (media == null) { - return; - } - res.setContentLength((int) cr.getContentLength()); - log.debug("**** media.length = " + media.length); - - } catch (PermissionException e) { - log.warn("PermissionException from doPost(): " + e.getMessage()); - } catch (IdUnusedException e) { - log.warn("IdUnusedException from doPost(): " + e.getMessage()); - } catch (TypeException e) { - log.warn("TypeException from doPost(): " + e.getMessage()); - } catch (ServerOverloadException e) { - log.warn("ServerOverloadException from doPost(): " + e.getMessage()); - } - finally { + * + **********************************************************************************/ + + + +package org.sakaiproject.tool.assessment.ui.servlet.delivery; +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.ByteArrayInputStream; +import java.io.FileInputStream; +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sakaiproject.content.api.ContentResource; +import org.sakaiproject.exception.IdUnusedException; +import org.sakaiproject.exception.PermissionException; +import org.sakaiproject.exception.ServerOverloadException; +import org.sakaiproject.exception.TypeException; +import org.sakaiproject.tool.assessment.data.dao.assessment.PublishedAttachmentData; +import org.sakaiproject.tool.assessment.services.assessment.AssessmentService; +import org.sakaiproject.tool.assessment.util.TextFormat; + +/** + *

+ * Title: Samigo + *

+ *

+ * Description: Sakai Assessment Manager + *

+ *

+ * Copyright: Copyright (c) 2004 Sakai Project + *

+ *

+ * Organization: Sakai Project + *

+ * + * @author Ed Smiley + * @version $Id: .java 17070 2006-10-12 00:07:52Z + * ktsao@stanford.edu $ + */ + +public class ShowAttachmentMediaServlet extends HttpServlet +{ + /** + * + */ + private static final long serialVersionUID = 2203681863823855810L; + private static Logger log = LoggerFactory.getLogger(ShowAttachmentMediaServlet.class); + + public ShowAttachmentMediaServlet() + { + } + + public void doGet(HttpServletRequest req, HttpServletResponse res) + throws ServletException, IOException + { + doPost(req,res); + } + + public void doPost(HttpServletRequest req, HttpServletResponse res) + throws ServletException, IOException + { + String resourceId = req.getParameter("resourceId"); + String mimeType = req.getParameter("mimeType"); + String filename = req.getParameter("filename"); + + String cleanedFilename = TextFormat.convertPlaintextToFormattedTextNoHighUnicode(log, filename); + + res.setHeader("Content-Disposition", "inline;filename=\"" + cleanedFilename +"\";"); + log.debug("resourceId = " + resourceId); + log.debug("mimeType = " + mimeType); + log.debug("cleanedFilename = " + cleanedFilename); + + // ** note that res.setContentType() must be called before + // res.getOutputStream(). see javadoc on this + res.setContentType(mimeType); + + ContentResource cr = null; + byte[] media = null; + try { + // create a copy of the resource + cr = AssessmentService.getContentHostingService().getResource(resourceId); + if (cr == null) { + return; + } + media = cr.getContent(); + if (media == null) { + return; + } + res.setContentLength((int) cr.getContentLength()); + log.debug("**** media.length = " + media.length); + + } catch (PermissionException e) { + log.warn("PermissionException from doPost(): " + e.getMessage()); + } catch (IdUnusedException e) { + log.warn("IdUnusedException from doPost(): " + e.getMessage()); + } catch (TypeException e) { + log.warn("TypeException from doPost(): " + e.getMessage()); + } catch (ServerOverloadException e) { + log.warn("ServerOverloadException from doPost(): " + e.getMessage()); + } + finally { // in case of any exceptions above being caught, media would still be null - if (media == null) { - return; - } + if (media == null) { + return; + } } - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(media); - BufferedInputStream buf_inputStream = new BufferedInputStream(byteArrayInputStream); - ServletOutputStream outputStream = res.getOutputStream(); - BufferedOutputStream buf_outputStream = null; - int count=0; - try{ - - buf_outputStream = new BufferedOutputStream(outputStream); - - int i=0; - while ((i=buf_inputStream.read()) != -1){ - // System.out.print(i); - buf_outputStream.write(i); - count++; - } - - //res.setContentLength(count); - res.flushBuffer(); - } - catch(Exception e){ - log.warn(e.getMessage()); - } - finally { - if (buf_outputStream != null) { - try { - buf_outputStream.close(); - } - catch(IOException e) { - log.error(e.getMessage()); - } - } - if (buf_inputStream != null) { - try { - buf_inputStream.close(); - } - catch(IOException e) { - log.error(e.getMessage()); - } - } - if (outputStream != null) { - try { - outputStream.close(); - } - catch(IOException e) { - log.error(e.getMessage()); - } - } - if (byteArrayInputStream != null) { - try { - byteArrayInputStream.close(); - } - catch(IOException e) { - log.error(e.getMessage()); - } - } - } - } -} - + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(media); + BufferedInputStream buf_inputStream = new BufferedInputStream(byteArrayInputStream); + ServletOutputStream outputStream = res.getOutputStream(); + BufferedOutputStream buf_outputStream = null; + int count=0; + try{ + + buf_outputStream = new BufferedOutputStream(outputStream); + + int i=0; + while ((i=buf_inputStream.read()) != -1){ + // System.out.print(i); + buf_outputStream.write(i); + count++; + } + + //res.setContentLength(count); + res.flushBuffer(); + } + catch(Exception e){ + log.warn(e.getMessage()); + } + finally { + if (buf_outputStream != null) { + try { + buf_outputStream.close(); + } + catch(IOException e) { + log.error(e.getMessage()); + } + } + if (buf_inputStream != null) { + try { + buf_inputStream.close(); + } + catch(IOException e) { + log.error(e.getMessage()); + } + } + if (outputStream != null) { + try { + outputStream.close(); + } + catch(IOException e) { + log.error(e.getMessage()); + } + } + if (byteArrayInputStream != null) { + try { + byteArrayInputStream.close(); + } + catch(IOException e) { + log.error(e.getMessage()); + } + } + } + } +} + diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/delivery/ShowMediaServlet.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/delivery/ShowMediaServlet.java index d0b9a79d6014..48e04f8a1293 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/delivery/ShowMediaServlet.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/delivery/ShowMediaServlet.java @@ -45,8 +45,8 @@ import javax.servlet.RequestDispatcher; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** *

Title: Samigo

@@ -61,7 +61,7 @@ public class ShowMediaServlet extends HttpServlet * */ private static final long serialVersionUID = 2203681863823855810L; - private static Log log = LogFactory.getLog(ShowMediaServlet.class); + private static Logger log = LoggerFactory.getLogger(ShowMediaServlet.class); private static final Pattern HTTP_RANGE_PATTERN = Pattern.compile("bytes=(?\\d*)-(?\\d*)"); public ShowMediaServlet() diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/delivery/UploadAudioMediaServlet.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/delivery/UploadAudioMediaServlet.java index f4aed9f21557..a9932e496179 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/delivery/UploadAudioMediaServlet.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/delivery/UploadAudioMediaServlet.java @@ -37,8 +37,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.dao.grading.AssessmentGradingData; import org.sakaiproject.tool.assessment.data.dao.grading.ItemGradingData; @@ -67,7 +67,7 @@ public class UploadAudioMediaServlet extends HttpServlet * */ private static final long serialVersionUID = 8389831837152012411L; -private static Log log = LogFactory.getLog(UploadAudioMediaServlet.class); +private static Logger log = LoggerFactory.getLogger(UploadAudioMediaServlet.class); public UploadAudioMediaServlet() { diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/qti/ShowQTIServlet.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/qti/ShowQTIServlet.java index 91a70d22e3cf..2d06cd8d73a0 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/qti/ShowQTIServlet.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/qti/ShowQTIServlet.java @@ -30,8 +30,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.ui.bean.qti.XMLDisplay; import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; @@ -49,7 +49,7 @@ public class ShowQTIServlet extends HttpServlet * */ private static final long serialVersionUID = 3855448630209417469L; -private static Log log = LogFactory.getLog(ShowQTIServlet.class); +private static Logger log = LoggerFactory.getLogger(ShowQTIServlet.class); //private String xmlData; /** diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/web/action/InitAction.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/web/action/InitAction.java index b96443062bb1..52fe495d3382 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/web/action/InitAction.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/web/action/InitAction.java @@ -23,8 +23,8 @@ package org.sakaiproject.tool.assessment.ui.web.action; import javax.servlet.http.HttpServlet; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.tool.assessment.facade.AssessmentFacadeQueriesAPI; @@ -60,7 +60,7 @@ public class InitAction extends HttpServlet{ * */ private static final long serialVersionUID = 8101462284850616249L; -private static Log log = LogFactory.getLog(InitAction.class); +private static Logger log = LoggerFactory.getLogger(InitAction.class); public void init(){ // store all types in memory diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/web/session/SessionUtil.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/web/session/SessionUtil.java index 83e1422efe37..182d270fc818 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/web/session/SessionUtil.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/web/session/SessionUtil.java @@ -26,8 +26,8 @@ import javax.faces.context.FacesContext; import javax.servlet.http.HttpSession; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.api.ToolSession; import org.sakaiproject.tool.cover.SessionManager; import org.sakaiproject.tool.assessment.ui.bean.delivery.DeliveryBean; @@ -63,7 +63,7 @@ public class SessionUtil { public static final int DEFAULT_APP_INTERVAL_VAL = 5 * HOURS_TO_SECONDS_MULTIPLIER; private static final int INTERVAL_BUFFER = 60 * 15; - private static Log log = LogFactory.getLog(SessionUtil.class); + private static Logger log = LoggerFactory.getLogger(SessionUtil.class); /** * Sets the current HttpSession maxInactiveInterval value diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/util/AttachmentUtil.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/util/AttachmentUtil.java index 4a9dc8550f99..b67121760ad7 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/util/AttachmentUtil.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/util/AttachmentUtil.java @@ -6,8 +6,8 @@ import java.util.List; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.content.api.ContentResource; import org.sakaiproject.content.api.FilePickerHelper; import org.sakaiproject.content.cover.ContentHostingService; @@ -30,7 +30,7 @@ public class AttachmentUtil { - private static Log log = LogFactory.getLog(AttachmentUtil.class); + private static Logger log = LoggerFactory.getLogger(AttachmentUtil.class); public AttachmentUtil() {} diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/util/BeanSortComparator.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/util/BeanSortComparator.java index 5b686d00634a..3e780ab14167 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/util/BeanSortComparator.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/util/BeanSortComparator.java @@ -33,8 +33,8 @@ import org.apache.commons.beanutils.BeanUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * DOCUMENTATION PENDING @@ -45,7 +45,7 @@ public class BeanSortComparator implements Comparator { - private static Log log = LogFactory.getLog(BeanSortComparator.class); + private static Logger log = LoggerFactory.getLogger(BeanSortComparator.class); private String propertyName; /** diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/util/DownloadFileUtil.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/util/DownloadFileUtil.java index 2392848cad42..910376532e2d 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/util/DownloadFileUtil.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/util/DownloadFileUtil.java @@ -15,8 +15,8 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.servlet.ServletContext; import javax.servlet.ServletException; @@ -39,7 +39,7 @@ public class DownloadFileUtil { - private static Log log = LogFactory.getLog(DownloadFileUtil.class); + private static Logger log = LoggerFactory.getLogger(DownloadFileUtil.class); public void processWholeSiteOrOneSection(HttpServletRequest req, HttpServletResponse res, ArrayList idataList, ArrayList userUidList) { processWholeSiteOrOneSection(req, res, idataList, userUidList, null); diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/util/SamigoEmailService.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/util/SamigoEmailService.java index a101da1e5b32..1aa99d68cc2e 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/util/SamigoEmailService.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/util/SamigoEmailService.java @@ -1,8 +1,8 @@ -/********************************************************************************** - * $URL$ - * $Id$ - *********************************************************************************** - * +/********************************************************************************** + * $URL$ + * $Id$ + *********************************************************************************** + * * Copyright (c) 2006, 2007, 2008, 2009 The Sakai Foundation * * Licensed under the Educational Community License, Version 2.0 (the "License"); @@ -16,377 +16,377 @@ * 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.sakaiproject.tool.assessment.util; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Properties; -import java.util.Vector; - -import javax.activation.DataHandler; -import javax.activation.FileDataSource; -import javax.mail.Message; -import javax.mail.MessagingException; -import javax.mail.Multipart; -import javax.mail.SendFailedException; -import javax.mail.Session; -import javax.mail.Transport; -import javax.mail.internet.AddressException; -import javax.mail.internet.InternetAddress; -import javax.mail.internet.MimeBodyPart; -import javax.mail.internet.MimeMessage; -import javax.mail.internet.MimeMultipart; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.sakaiproject.component.cover.ServerConfigurationService; -import org.sakaiproject.content.api.ContentResource; -import org.sakaiproject.exception.IdUnusedException; -import org.sakaiproject.exception.PermissionException; -import org.sakaiproject.exception.ServerOverloadException; -import org.sakaiproject.exception.TypeException; -import org.sakaiproject.tool.assessment.data.dao.assessment.AttachmentData; -import org.sakaiproject.tool.assessment.services.assessment.AssessmentService; -import org.sakaiproject.tool.assessment.ui.bean.util.EmailBean; -import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; - - -/** - * The ItemService calls persistent service locator to reach the - * manager on the back end. - */ -public class SamigoEmailService { - private static Log log = LogFactory.getLog(SamigoEmailService.class); - - private String fromName; - private String fromEmailAddress; - private String toName; - private String toEmailAddress; - private ArrayList toEmailAddressList; - private String ccMe; - private String subject; - private String message; - private String smtpServer; - private String smtpPort; - private String prefixedPath; - - /** - * Creates a new SamigoEmailService object. - */ - public SamigoEmailService(String fromName, String fromEmailAddress, String toName, String toEmailAddress, - ArrayList toEmailAddressList, String ccMe, String subject, String message) { - this.fromName = fromName; - this.fromEmailAddress = fromEmailAddress; - this.toName = toName; - this.toEmailAddress = toEmailAddress; - this.toEmailAddressList = toEmailAddressList; - this.ccMe = ccMe; - this.subject = subject; - this.message = message; - this.smtpServer = ServerConfigurationService.getString("samigo.smtp.server"); - this.smtpPort = ServerConfigurationService.getString("samigo.smtp.port"); - this.prefixedPath = ServerConfigurationService.getString("samigo.email.prefixedPath"); - } - - public SamigoEmailService(String fromName, String fromEmailAddress, - String toName, String toEmailAddress, String ccMe, String subject, String message) { - this(fromName, fromEmailAddress, toName, toEmailAddress, null, ccMe, subject, message); - } - - public SamigoEmailService(String fromEmailAddress, ArrayList toEmailAddressList, String ccMe, String subject, String message) { - this(null, fromEmailAddress, null, null, toEmailAddressList, ccMe, subject, message); - } - - // Not sure if we are going to obsolete/change this email flow. I keep this here and make a new one sendMail() - public String send() { - List attachmentList = null; - AttachmentData a = null; - try { - Properties props = new Properties(); - - // Server - if (smtpServer == null || smtpServer.equals("")) { - log.info("samigo.email.smtpServer is not set"); - smtpServer = ServerConfigurationService.getString("smtp@org.sakaiproject.email.api.EmailService"); - if (smtpServer == null || smtpServer.equals("")) { - log.info("smtp@org.sakaiproject.email.api.EmailService is not set"); - log.error("Please set the value of samigo.email.smtpServer or smtp@org.sakaiproject.email.api.EmailService"); - return "error"; - } - } - props.setProperty("mail.smtp.host", smtpServer); - - // Port - if (smtpPort == null || smtpPort.equals("")) { - log.warn("samigo.email.smtpPort is not set. The default port 25 will be used."); - } else { - props.setProperty("mail.smtp.port", smtpPort); - } - - Session session; - session = Session.getInstance(props); - session.setDebug(true); - MimeMessage msg = new MimeMessage(session); - - InternetAddress fromIA = new InternetAddress(fromEmailAddress, fromName); - msg.setFrom(fromIA); - InternetAddress[] toIA = { new InternetAddress(toEmailAddress, toName) }; - msg.setRecipients(Message.RecipientType.TO, toIA); - - if ("yes".equals(ccMe)) { - InternetAddress[] ccIA = { new InternetAddress(fromEmailAddress, fromName) }; - msg.setRecipients(Message.RecipientType.CC, ccIA); - } - msg.setSubject(subject); - - EmailBean emailBean = (EmailBean) ContextUtil.lookupBean("email"); - attachmentList = emailBean.getAttachmentList(); - StringBuilder content = new StringBuilder(message); - ArrayList fileList = new ArrayList(); - ArrayList fileNameList = new ArrayList(); - if (attachmentList != null) { - if (prefixedPath == null || prefixedPath.equals("")) { - log.error("samigo.email.prefixedPath is not set"); - return "error"; - } - Iterator iter = attachmentList.iterator(); - while (iter.hasNext()) { - a = (AttachmentData) iter.next(); - if (a.getIsLink().booleanValue()) { - log.debug("send(): url"); - content.append("
\n\r"); - content.append("
"); // give a new line - content.append(a.getFilename()); - } - else { - log.debug("send(): file"); - File attachedFile = getAttachedFile(a.getResourceId()); - fileList.add(attachedFile); - fileNameList.add(a.getFilename()); - } - } - } - - Multipart multipart = new MimeMultipart(); - MimeBodyPart messageBodyPart = new MimeBodyPart(); - messageBodyPart.setContent(content.toString(), "text/html"); - multipart.addBodyPart(messageBodyPart); - msg.setContent(multipart); - - for (int i = 0; i < fileList.size(); i++) { - messageBodyPart = new MimeBodyPart(); - FileDataSource source = new FileDataSource((File)fileList.get(i)); - messageBodyPart.setDataHandler(new DataHandler(source)); - messageBodyPart.setFileName((String)fileNameList.get(i)); - multipart.addBodyPart(messageBodyPart); - } - msg.setContent(multipart); - - Transport.send(msg); - } catch (UnsupportedEncodingException e) { - log.error("Exception throws from send()" + e.getMessage()); - return "error"; - } catch (MessagingException e) { - log.error("Exception throws from send()" + e.getMessage()); - return "error"; - } catch (ServerOverloadException e) { - log.error("Exception throws from send()" + e.getMessage()); - return "error"; - } catch (PermissionException e) { - log.error("Exception throws from send()" + e.getMessage()); - return "error"; - } catch (IdUnusedException e) { - log.error("Exception throws from send()" + e.getMessage()); - return "error"; - } catch (TypeException e) { - log.error("Exception throws from send()" + e.getMessage()); - return "error"; - } catch (IOException e) { - log.error("Exception throws from send()" + e.getMessage()); - return "error"; - } finally { - if (attachmentList != null) { - if (prefixedPath != null && !prefixedPath.equals("")) { - StringBuilder sbPrefixedPath; - Iterator iter = attachmentList.iterator(); - while (iter.hasNext()) { - sbPrefixedPath = new StringBuilder(prefixedPath); - sbPrefixedPath.append("/email_tmp/"); - a = (AttachmentData) iter.next(); - if (!a.getIsLink().booleanValue()) { - deleteAttachedFile(sbPrefixedPath.append(a.getResourceId()).toString()); - } - } - } - } - } - return "send"; - } - - public String sendMail() { - try { - Properties props = new Properties(); - - // Server - if (smtpServer == null || smtpServer.equals("")) { - log.info("samigo.email.smtpServer is not set"); - smtpServer = ServerConfigurationService.getString("smtp@org.sakaiproject.email.api.EmailService"); - if (smtpServer == null || smtpServer.equals("")) { - log.info("smtp@org.sakaiproject.email.api.EmailService is not set"); - log.error("Please set the value of samigo.email.smtpServer or smtp@org.sakaiproject.email.api.EmailService"); - return "error"; - } - } - props.setProperty("mail.smtp.host", smtpServer); - - // Port - if (smtpPort == null || smtpPort.equals("")) { - log.warn("samigo.email.smtpPort is not set. The default port 25 will be used."); - } else { - props.setProperty("mail.smtp.port", smtpPort); - } - - props.put("mail.smtp.sendpartial", "true"); - - Session session = Session.getInstance(props, null); - session.setDebug(true); - MimeMessage msg = new MimeMessage(session); - - InternetAddress fromIA = new InternetAddress(fromEmailAddress, fromName); - msg.setFrom(fromIA); - - //msg.addHeaderLine("Subject: " + subject); - msg.setSubject(subject, "UTF-8"); - String noReplyEmaillAddress = ServerConfigurationService.getString("setup.request","no-reply@" + ServerConfigurationService.getServerName()); - msg.addHeaderLine("To: " + noReplyEmaillAddress); - msg.setText(message, "UTF-8"); - msg.addHeaderLine("Content-Type: text/html"); - - ArrayList toIAList = new ArrayList(); - String email = ""; - Iterator iter = toEmailAddressList.iterator(); - while (iter.hasNext()) { - try { - email = (String) iter.next(); - toIAList.add(new InternetAddress(email)); - } catch (AddressException ae) { - log.error("invalid email address: " + email); - } - } - - InternetAddress[] toIA = new InternetAddress[toIAList.size()]; - int count = 0; - Iterator iter2 = toIAList.iterator(); - while (iter2.hasNext()) { - toIA[count++] = (InternetAddress) iter2.next(); - } - - try - { - Transport transport = session.getTransport("smtp"); - msg.saveChanges(); - transport.connect(); - - try { - transport.sendMessage(msg, toIA); - } - catch (SendFailedException e) - { - log.debug("SendFailedException: " + e); - return "error"; - } - catch (MessagingException e) - { - log.warn("1st MessagingException: " + e); - return "error"; - } - transport.close(); - } - catch (MessagingException e) - { - log.warn("2nd MessagingException:" + e); - return "error"; - } - - } catch (UnsupportedEncodingException ue) { - log.warn("UnsupportedEncodingException:" + ue); - ue.printStackTrace(); - - } catch (MessagingException me) { - log.warn("3rd MessagingException:" + me); - return "error"; - } - return "send"; - } - - private File getAttachedFile(String resourceId) throws PermissionException, IdUnusedException, TypeException, ServerOverloadException, IOException { - ContentResource cr = AssessmentService.getContentHostingService().getResource(resourceId); - log.debug("getAttachedFile(): resourceId = " + resourceId); - byte[] data = cr.getContent(); - StringBuilder sbPrefixedPath = new StringBuilder(prefixedPath); - sbPrefixedPath.append("/email_tmp/"); - sbPrefixedPath.append(resourceId); - String filename = sbPrefixedPath.toString().replace(" ", ""); - log.debug("getAttachedFile(): filename = " + filename); - String path = filename.substring(0, filename.lastIndexOf("/")); - log.debug("getAttachedFile(): path = " + path); - File dir = new File(path); - boolean success = dir.mkdirs(); - // Shouldn't come to here because resourceId is unique - if (!success) { - log.error("getAttachedFile(): File exists already! This should not heppen. Please check for resourceId."); - } - File file = new File(filename); - success = file.createNewFile(); - // Shouldn't come to here because resourceId is unique - if (!success) { - log.error("getAttachedFile(): File exists already! This should not heppen. Please check for resourceId."); - } - FileOutputStream fileOutputStream = null; - try { - fileOutputStream = new FileOutputStream(file); - fileOutputStream.write(data); - } catch (FileNotFoundException e) { - throw e; - } catch (IOException e) { - throw e; - } - finally { - if (fileOutputStream != null) { - fileOutputStream.close(); - } - } - return file; - } - - - - private void deleteAttachedFile(String filename) { - log.debug("deleteAttachedFile(): filename = " + filename); - // delete the file - String tunedFilename = filename.replace(" ", ""); - log.debug("deleteAttachedFile(): tunedFilename = " + tunedFilename); - File file = new File(tunedFilename); - boolean success = file.delete(); - if (!success) { - log.error("Fail to delete file: " + tunedFilename); - } - // delete the last directory - String directoryName = tunedFilename.substring(0, tunedFilename.lastIndexOf("/")); - log.debug("deleteAttachedFile(): directoryName = " + directoryName); - File dir = new File(directoryName); - success = dir.delete(); - if (!success) { - log.error("Fail to delete directory: " + directoryName); - } - } -} + * + **********************************************************************************/ + +package org.sakaiproject.tool.assessment.util; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Properties; +import java.util.Vector; + +import javax.activation.DataHandler; +import javax.activation.FileDataSource; +import javax.mail.Message; +import javax.mail.MessagingException; +import javax.mail.Multipart; +import javax.mail.SendFailedException; +import javax.mail.Session; +import javax.mail.Transport; +import javax.mail.internet.AddressException; +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeBodyPart; +import javax.mail.internet.MimeMessage; +import javax.mail.internet.MimeMultipart; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sakaiproject.component.cover.ServerConfigurationService; +import org.sakaiproject.content.api.ContentResource; +import org.sakaiproject.exception.IdUnusedException; +import org.sakaiproject.exception.PermissionException; +import org.sakaiproject.exception.ServerOverloadException; +import org.sakaiproject.exception.TypeException; +import org.sakaiproject.tool.assessment.data.dao.assessment.AttachmentData; +import org.sakaiproject.tool.assessment.services.assessment.AssessmentService; +import org.sakaiproject.tool.assessment.ui.bean.util.EmailBean; +import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil; + + +/** + * The ItemService calls persistent service locator to reach the + * manager on the back end. + */ +public class SamigoEmailService { + private static Logger log = LoggerFactory.getLogger(SamigoEmailService.class); + + private String fromName; + private String fromEmailAddress; + private String toName; + private String toEmailAddress; + private ArrayList toEmailAddressList; + private String ccMe; + private String subject; + private String message; + private String smtpServer; + private String smtpPort; + private String prefixedPath; + + /** + * Creates a new SamigoEmailService object. + */ + public SamigoEmailService(String fromName, String fromEmailAddress, String toName, String toEmailAddress, + ArrayList toEmailAddressList, String ccMe, String subject, String message) { + this.fromName = fromName; + this.fromEmailAddress = fromEmailAddress; + this.toName = toName; + this.toEmailAddress = toEmailAddress; + this.toEmailAddressList = toEmailAddressList; + this.ccMe = ccMe; + this.subject = subject; + this.message = message; + this.smtpServer = ServerConfigurationService.getString("samigo.smtp.server"); + this.smtpPort = ServerConfigurationService.getString("samigo.smtp.port"); + this.prefixedPath = ServerConfigurationService.getString("samigo.email.prefixedPath"); + } + + public SamigoEmailService(String fromName, String fromEmailAddress, + String toName, String toEmailAddress, String ccMe, String subject, String message) { + this(fromName, fromEmailAddress, toName, toEmailAddress, null, ccMe, subject, message); + } + + public SamigoEmailService(String fromEmailAddress, ArrayList toEmailAddressList, String ccMe, String subject, String message) { + this(null, fromEmailAddress, null, null, toEmailAddressList, ccMe, subject, message); + } + + // Not sure if we are going to obsolete/change this email flow. I keep this here and make a new one sendMail() + public String send() { + List attachmentList = null; + AttachmentData a = null; + try { + Properties props = new Properties(); + + // Server + if (smtpServer == null || smtpServer.equals("")) { + log.info("samigo.email.smtpServer is not set"); + smtpServer = ServerConfigurationService.getString("smtp@org.sakaiproject.email.api.EmailService"); + if (smtpServer == null || smtpServer.equals("")) { + log.info("smtp@org.sakaiproject.email.api.EmailService is not set"); + log.error("Please set the value of samigo.email.smtpServer or smtp@org.sakaiproject.email.api.EmailService"); + return "error"; + } + } + props.setProperty("mail.smtp.host", smtpServer); + + // Port + if (smtpPort == null || smtpPort.equals("")) { + log.warn("samigo.email.smtpPort is not set. The default port 25 will be used."); + } else { + props.setProperty("mail.smtp.port", smtpPort); + } + + Session session; + session = Session.getInstance(props); + session.setDebug(true); + MimeMessage msg = new MimeMessage(session); + + InternetAddress fromIA = new InternetAddress(fromEmailAddress, fromName); + msg.setFrom(fromIA); + InternetAddress[] toIA = { new InternetAddress(toEmailAddress, toName) }; + msg.setRecipients(Message.RecipientType.TO, toIA); + + if ("yes".equals(ccMe)) { + InternetAddress[] ccIA = { new InternetAddress(fromEmailAddress, fromName) }; + msg.setRecipients(Message.RecipientType.CC, ccIA); + } + msg.setSubject(subject); + + EmailBean emailBean = (EmailBean) ContextUtil.lookupBean("email"); + attachmentList = emailBean.getAttachmentList(); + StringBuilder content = new StringBuilder(message); + ArrayList fileList = new ArrayList(); + ArrayList fileNameList = new ArrayList(); + if (attachmentList != null) { + if (prefixedPath == null || prefixedPath.equals("")) { + log.error("samigo.email.prefixedPath is not set"); + return "error"; + } + Iterator iter = attachmentList.iterator(); + while (iter.hasNext()) { + a = (AttachmentData) iter.next(); + if (a.getIsLink().booleanValue()) { + log.debug("send(): url"); + content.append("
\n\r"); + content.append("
"); // give a new line + content.append(a.getFilename()); + } + else { + log.debug("send(): file"); + File attachedFile = getAttachedFile(a.getResourceId()); + fileList.add(attachedFile); + fileNameList.add(a.getFilename()); + } + } + } + + Multipart multipart = new MimeMultipart(); + MimeBodyPart messageBodyPart = new MimeBodyPart(); + messageBodyPart.setContent(content.toString(), "text/html"); + multipart.addBodyPart(messageBodyPart); + msg.setContent(multipart); + + for (int i = 0; i < fileList.size(); i++) { + messageBodyPart = new MimeBodyPart(); + FileDataSource source = new FileDataSource((File)fileList.get(i)); + messageBodyPart.setDataHandler(new DataHandler(source)); + messageBodyPart.setFileName((String)fileNameList.get(i)); + multipart.addBodyPart(messageBodyPart); + } + msg.setContent(multipart); + + Transport.send(msg); + } catch (UnsupportedEncodingException e) { + log.error("Exception throws from send()" + e.getMessage()); + return "error"; + } catch (MessagingException e) { + log.error("Exception throws from send()" + e.getMessage()); + return "error"; + } catch (ServerOverloadException e) { + log.error("Exception throws from send()" + e.getMessage()); + return "error"; + } catch (PermissionException e) { + log.error("Exception throws from send()" + e.getMessage()); + return "error"; + } catch (IdUnusedException e) { + log.error("Exception throws from send()" + e.getMessage()); + return "error"; + } catch (TypeException e) { + log.error("Exception throws from send()" + e.getMessage()); + return "error"; + } catch (IOException e) { + log.error("Exception throws from send()" + e.getMessage()); + return "error"; + } finally { + if (attachmentList != null) { + if (prefixedPath != null && !prefixedPath.equals("")) { + StringBuilder sbPrefixedPath; + Iterator iter = attachmentList.iterator(); + while (iter.hasNext()) { + sbPrefixedPath = new StringBuilder(prefixedPath); + sbPrefixedPath.append("/email_tmp/"); + a = (AttachmentData) iter.next(); + if (!a.getIsLink().booleanValue()) { + deleteAttachedFile(sbPrefixedPath.append(a.getResourceId()).toString()); + } + } + } + } + } + return "send"; + } + + public String sendMail() { + try { + Properties props = new Properties(); + + // Server + if (smtpServer == null || smtpServer.equals("")) { + log.info("samigo.email.smtpServer is not set"); + smtpServer = ServerConfigurationService.getString("smtp@org.sakaiproject.email.api.EmailService"); + if (smtpServer == null || smtpServer.equals("")) { + log.info("smtp@org.sakaiproject.email.api.EmailService is not set"); + log.error("Please set the value of samigo.email.smtpServer or smtp@org.sakaiproject.email.api.EmailService"); + return "error"; + } + } + props.setProperty("mail.smtp.host", smtpServer); + + // Port + if (smtpPort == null || smtpPort.equals("")) { + log.warn("samigo.email.smtpPort is not set. The default port 25 will be used."); + } else { + props.setProperty("mail.smtp.port", smtpPort); + } + + props.put("mail.smtp.sendpartial", "true"); + + Session session = Session.getInstance(props, null); + session.setDebug(true); + MimeMessage msg = new MimeMessage(session); + + InternetAddress fromIA = new InternetAddress(fromEmailAddress, fromName); + msg.setFrom(fromIA); + + //msg.addHeaderLine("Subject: " + subject); + msg.setSubject(subject, "UTF-8"); + String noReplyEmaillAddress = ServerConfigurationService.getString("setup.request","no-reply@" + ServerConfigurationService.getServerName()); + msg.addHeaderLine("To: " + noReplyEmaillAddress); + msg.setText(message, "UTF-8"); + msg.addHeaderLine("Content-Type: text/html"); + + ArrayList toIAList = new ArrayList(); + String email = ""; + Iterator iter = toEmailAddressList.iterator(); + while (iter.hasNext()) { + try { + email = (String) iter.next(); + toIAList.add(new InternetAddress(email)); + } catch (AddressException ae) { + log.error("invalid email address: " + email); + } + } + + InternetAddress[] toIA = new InternetAddress[toIAList.size()]; + int count = 0; + Iterator iter2 = toIAList.iterator(); + while (iter2.hasNext()) { + toIA[count++] = (InternetAddress) iter2.next(); + } + + try + { + Transport transport = session.getTransport("smtp"); + msg.saveChanges(); + transport.connect(); + + try { + transport.sendMessage(msg, toIA); + } + catch (SendFailedException e) + { + log.debug("SendFailedException: " + e); + return "error"; + } + catch (MessagingException e) + { + log.warn("1st MessagingException: " + e); + return "error"; + } + transport.close(); + } + catch (MessagingException e) + { + log.warn("2nd MessagingException:" + e); + return "error"; + } + + } catch (UnsupportedEncodingException ue) { + log.warn("UnsupportedEncodingException:" + ue); + ue.printStackTrace(); + + } catch (MessagingException me) { + log.warn("3rd MessagingException:" + me); + return "error"; + } + return "send"; + } + + private File getAttachedFile(String resourceId) throws PermissionException, IdUnusedException, TypeException, ServerOverloadException, IOException { + ContentResource cr = AssessmentService.getContentHostingService().getResource(resourceId); + log.debug("getAttachedFile(): resourceId = " + resourceId); + byte[] data = cr.getContent(); + StringBuilder sbPrefixedPath = new StringBuilder(prefixedPath); + sbPrefixedPath.append("/email_tmp/"); + sbPrefixedPath.append(resourceId); + String filename = sbPrefixedPath.toString().replace(" ", ""); + log.debug("getAttachedFile(): filename = " + filename); + String path = filename.substring(0, filename.lastIndexOf("/")); + log.debug("getAttachedFile(): path = " + path); + File dir = new File(path); + boolean success = dir.mkdirs(); + // Shouldn't come to here because resourceId is unique + if (!success) { + log.error("getAttachedFile(): File exists already! This should not heppen. Please check for resourceId."); + } + File file = new File(filename); + success = file.createNewFile(); + // Shouldn't come to here because resourceId is unique + if (!success) { + log.error("getAttachedFile(): File exists already! This should not heppen. Please check for resourceId."); + } + FileOutputStream fileOutputStream = null; + try { + fileOutputStream = new FileOutputStream(file); + fileOutputStream.write(data); + } catch (FileNotFoundException e) { + throw e; + } catch (IOException e) { + throw e; + } + finally { + if (fileOutputStream != null) { + fileOutputStream.close(); + } + } + return file; + } + + + + private void deleteAttachedFile(String filename) { + log.debug("deleteAttachedFile(): filename = " + filename); + // delete the file + String tunedFilename = filename.replace(" ", ""); + log.debug("deleteAttachedFile(): tunedFilename = " + tunedFilename); + File file = new File(tunedFilename); + boolean success = file.delete(); + if (!success) { + log.error("Fail to delete file: " + tunedFilename); + } + // delete the last directory + String directoryName = tunedFilename.substring(0, tunedFilename.lastIndexOf("/")); + log.debug("deleteAttachedFile(): directoryName = " + directoryName); + File dir = new File(directoryName); + success = dir.delete(); + if (!success) { + log.error("Fail to delete directory: " + directoryName); + } + } +} diff --git a/samigo/samigo-app/src/test/org/sakaiproject/tool/assessment/business/entity/helper/AuthoringHelperTest.java b/samigo/samigo-app/src/test/org/sakaiproject/tool/assessment/business/entity/helper/AuthoringHelperTest.java index e1a7754d0312..01371bca874a 100755 --- a/samigo/samigo-app/src/test/org/sakaiproject/tool/assessment/business/entity/helper/AuthoringHelperTest.java +++ b/samigo/samigo-app/src/test/org/sakaiproject/tool/assessment/business/entity/helper/AuthoringHelperTest.java @@ -23,8 +23,8 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.sakaiproject.tool.assessment.data.ifc.assessment.ItemDataIfc; import org.sakaiproject.tool.assessment.data.ifc.shared.TypeIfc; @@ -47,7 +47,7 @@ */ public class AuthoringHelperTest { - private static Log log = LogFactory.getLog(AuthoringHelperTest.class); + private static Logger log = LoggerFactory.getLogger(AuthoringHelperTest.class); private final static String xslPath = "C:\\Documents and Settings\\Ed Smiley\\jbproject\\sam\\webapp.war\\xml\\xsl\\dataTransform\\import\\v1p2"; @@ -300,4 +300,4 @@ public ItemFacade createImportedItem(Document document) return item; } -} \ No newline at end of file +} diff --git a/samigo/samigo-app/src/test/org/sakaiproject/tool/assessment/business/entity/helper/QTITester.java b/samigo/samigo-app/src/test/org/sakaiproject/tool/assessment/business/entity/helper/QTITester.java index 71a684fcc4f5..a5a5d0c3a3e7 100755 --- a/samigo/samigo-app/src/test/org/sakaiproject/tool/assessment/business/entity/helper/QTITester.java +++ b/samigo/samigo-app/src/test/org/sakaiproject/tool/assessment/business/entity/helper/QTITester.java @@ -24,8 +24,8 @@ import java.util.ArrayList; //import javax.faces.context.FacesContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.sakaiproject.tool.assessment.facade.PublishedAssessmentFacade; @@ -44,7 +44,7 @@ */ public class QTITester { - private static Log log = LogFactory.getLog(QTITester.class); + private static Logger log = LoggerFactory.getLogger(QTITester.class); // private static boolean useContextPath = true; private static boolean useContextPath = false; // private static int version = QTIVersion.VERSION_1_2; diff --git a/samigo/samigo-app/src/test/org/sakaiproject/tool/assessment/jsf/TestWSBean.java b/samigo/samigo-app/src/test/org/sakaiproject/tool/assessment/jsf/TestWSBean.java index 184ed68fbda9..73005ef18422 100644 --- a/samigo/samigo-app/src/test/org/sakaiproject/tool/assessment/jsf/TestWSBean.java +++ b/samigo/samigo-app/src/test/org/sakaiproject/tool/assessment/jsf/TestWSBean.java @@ -24,8 +24,8 @@ import javax.faces.context.FacesContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.facade.ItemFacade; import org.sakaiproject.tool.assessment.services.ItemService; @@ -40,7 +40,7 @@ public class TestWSBean implements Serializable { - private static Log log = LogFactory.getLog(TestWSBean.class); + private static Logger log = LoggerFactory.getLogger(TestWSBean.class); private String itemid; private String itembankxml; diff --git a/samigo/samigo-app/src/test/org/sakaiproject/tool/assessment/ui/listener/FakeBeginDeliveryActionListener.java b/samigo/samigo-app/src/test/org/sakaiproject/tool/assessment/ui/listener/FakeBeginDeliveryActionListener.java index a3ef0b5dd286..2cc93a093e49 100755 --- a/samigo/samigo-app/src/test/org/sakaiproject/tool/assessment/ui/listener/FakeBeginDeliveryActionListener.java +++ b/samigo/samigo-app/src/test/org/sakaiproject/tool/assessment/ui/listener/FakeBeginDeliveryActionListener.java @@ -26,8 +26,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.dao.assessment.AssessmentFeedback; import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentAccessControlIfc; import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentFeedbackIfc; @@ -48,7 +48,7 @@ public class FakeBeginDeliveryActionListener implements ActionListener { - private static Log log = LogFactory.getLog(FakeBeginDeliveryActionListener.class); + private static Logger log = LoggerFactory.getLogger(FakeBeginDeliveryActionListener.class); private static String ID_TO_TEST = "3"; /** diff --git a/samigo/samigo-app/src/test/org/sakaiproject/tool/assessment/ui/listener/TestActionListener.java b/samigo/samigo-app/src/test/org/sakaiproject/tool/assessment/ui/listener/TestActionListener.java index e89726aa1655..288169e476c2 100644 --- a/samigo/samigo-app/src/test/org/sakaiproject/tool/assessment/ui/listener/TestActionListener.java +++ b/samigo/samigo-app/src/test/org/sakaiproject/tool/assessment/ui/listener/TestActionListener.java @@ -27,8 +27,8 @@ import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** *

Title: Samigo

@@ -39,7 +39,7 @@ public class TestActionListener implements ActionListener { - private static Log log = LogFactory.getLog(TestActionListener.class); + private static Logger log = LoggerFactory.getLogger(TestActionListener.class); public TestActionListener() { } diff --git a/samigo/samigo-cp/src/java/org/sakaiproject/tool/assessment/contentpackaging/ImportService.java b/samigo/samigo-cp/src/java/org/sakaiproject/tool/assessment/contentpackaging/ImportService.java index cefb1f4122c6..df91c64e4f19 100644 --- a/samigo/samigo-cp/src/java/org/sakaiproject/tool/assessment/contentpackaging/ImportService.java +++ b/samigo/samigo-cp/src/java/org/sakaiproject/tool/assessment/contentpackaging/ImportService.java @@ -1,8 +1,8 @@ -/********************************************************************************** - * $URL$ - * $Id$ - *********************************************************************************** - * +/********************************************************************************** + * $URL$ + * $Id$ + *********************************************************************************** + * * Copyright (c) 2007, 2008, 2009 The Sakai Foundation * * Licensed under the Educational Community License, Version 2.0 (the "License"); @@ -16,176 +16,176 @@ * 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.sakaiproject.tool.assessment.contentpackaging; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Set; -import java.util.TreeSet; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; - -import javax.faces.context.ExternalContext; -import javax.faces.context.FacesContext; -import javax.servlet.ServletContext; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.sakaiproject.tool.assessment.facade.AgentFacade; -import org.w3c.dom.Document; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -/** - *

Copyright: Copyright (c) 2007 Sakai

- * @version $Id$ - */ - -public class ImportService { - private static Log log = LogFactory.getLog(ImportService.class); - private String qtiFilename; - - public String unzipImportFile(String filename) { - FileInputStream fileInputStream = null; - FileOutputStream ofile = null; - ZipInputStream zipStream = null; - ZipEntry entry = null; - - ExternalContext external = FacesContext.getCurrentInstance().getExternalContext(); - StringBuilder unzipLocation = new StringBuilder((String)((ServletContext)external.getContext()).getAttribute("FILEUPLOAD_REPOSITORY_PATH")); - log.debug("****"+unzipLocation); - unzipLocation.append("/jsf/upload_tmp/qti_imports/"); - unzipLocation.append(AgentFacade.getAgentString()); - unzipLocation.append("/unzip_files/"); - unzipLocation.append(Long.toString(new java.util.Date().getTime())); - - try { - fileInputStream = new FileInputStream(new File(filename)); - byte[] data = new byte[fileInputStream.available()]; - fileInputStream.read(data, 0, fileInputStream.available()); - - File dir = new File(unzipLocation.toString()); // directory where file would be saved - if (!dir.exists()) { - if (!dir.mkdirs()) { - log.error("unable to mkdir " + dir.getPath()); - } - } - - Set dirsMade = new TreeSet(); - zipStream = new ZipInputStream(new ByteArrayInputStream(data)); - entry = (ZipEntry) zipStream.getNextEntry(); - // Get the name of the imported zip file name. The value of "filename" has timestamp append to it. - String tmpName = filename.substring(filename.lastIndexOf("/") + 1); - qtiFilename = "exportAssessment.xml"; - ArrayList xmlFilenames = new ArrayList(); - while (entry != null) { - String zipName = entry.getName(); - int ix = zipName.lastIndexOf('/'); - if (ix > 0) { - String dirName = zipName.substring(0, ix); - if (!dirsMade.contains(dirName)) { - File d = new File(dir.getPath() + "/" + dirName); - // If it already exists as a dir, don't do anything - if (!(d.exists() && d.isDirectory())) { - // Try to create the directory, warn if it fails - if (!d.mkdirs()) { - log.error("unable to mkdir " + dir.getPath() + "/" + dirName); - } - dirsMade.add(dirName); - } - } - } - - File zipEntryFile = new File(dir.getPath() + "/" + entry.getName()); - if (!zipEntryFile.isDirectory()) { - ofile = new FileOutputStream(zipEntryFile); - byte[] buffer = new byte[1024 * 10]; - int bytesRead; - while ((bytesRead = zipStream.read(buffer)) != -1) { - ofile.write(buffer, 0, bytesRead); - } - } - - // Now try to get the QTI xml file name from the imsmanifest.xml - if ("imsmanifest.xml".equals(entry.getName())) { - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - try { - DocumentBuilder db = dbf.newDocumentBuilder(); - Document doc = db.parse(zipEntryFile); - doc.getDocumentElement().normalize(); - NodeList nodeLst = doc.getElementsByTagName("resource"); - Node fstNode = nodeLst.item(0); - NamedNodeMap namedNodeMap= fstNode.getAttributes(); - qtiFilename = namedNodeMap.getNamedItem("href").getNodeValue(); - } - catch (Exception e) { - log.error("error parsing imsmanifest.xml"); - } - } - else if (entry.getName() != null && entry.getName().trim().endsWith(".xml")) { - xmlFilenames.add(entry.getName().trim()); - } - - zipStream.closeEntry(); - entry = zipStream.getNextEntry(); - } - // If the QTI file doesn't exist in the zip, - // we guess the name might be either exportAssessment.xml or the same as the zip file name - if (!xmlFilenames.contains(qtiFilename.trim())) { - if (xmlFilenames.contains("exportAssessment.xml")) { - qtiFilename = "exportAssessment.xml"; - } - else { - qtiFilename = tmpName.substring(0, tmpName.lastIndexOf("_")) + ".xml"; - } - } - } catch (FileNotFoundException e) { - log.error(e.getMessage()); - } catch (IOException e) { - log.error(e.getMessage()); - e.printStackTrace(); - } finally { - if (ofile != null) { - try { - ofile.close(); - } catch (IOException e) { - log.error(e.getMessage()); - } - } - if (fileInputStream != null) { - try { - fileInputStream.close(); - } catch (IOException e) { - log.error(e.getMessage()); - } - } - if (zipStream != null) { - try { - zipStream.close(); - } catch (IOException e) { - log.error(e.getMessage()); - } - } - } - return unzipLocation.toString(); - } - - public String setQTIFilename() { - return qtiFilename; - } - - public String getQTIFilename() { - return qtiFilename; - } -} + * + **********************************************************************************/ + +package org.sakaiproject.tool.assessment.contentpackaging; + +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Set; +import java.util.TreeSet; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +import javax.faces.context.ExternalContext; +import javax.faces.context.FacesContext; +import javax.servlet.ServletContext; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sakaiproject.tool.assessment.facade.AgentFacade; +import org.w3c.dom.Document; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +/** + *

Copyright: Copyright (c) 2007 Sakai

+ * @version $Id$ + */ + +public class ImportService { + private static Logger log = LoggerFactory.getLogger(ImportService.class); + private String qtiFilename; + + public String unzipImportFile(String filename) { + FileInputStream fileInputStream = null; + FileOutputStream ofile = null; + ZipInputStream zipStream = null; + ZipEntry entry = null; + + ExternalContext external = FacesContext.getCurrentInstance().getExternalContext(); + StringBuilder unzipLocation = new StringBuilder((String)((ServletContext)external.getContext()).getAttribute("FILEUPLOAD_REPOSITORY_PATH")); + log.debug("****"+unzipLocation); + unzipLocation.append("/jsf/upload_tmp/qti_imports/"); + unzipLocation.append(AgentFacade.getAgentString()); + unzipLocation.append("/unzip_files/"); + unzipLocation.append(Long.toString(new java.util.Date().getTime())); + + try { + fileInputStream = new FileInputStream(new File(filename)); + byte[] data = new byte[fileInputStream.available()]; + fileInputStream.read(data, 0, fileInputStream.available()); + + File dir = new File(unzipLocation.toString()); // directory where file would be saved + if (!dir.exists()) { + if (!dir.mkdirs()) { + log.error("unable to mkdir " + dir.getPath()); + } + } + + Set dirsMade = new TreeSet(); + zipStream = new ZipInputStream(new ByteArrayInputStream(data)); + entry = (ZipEntry) zipStream.getNextEntry(); + // Get the name of the imported zip file name. The value of "filename" has timestamp append to it. + String tmpName = filename.substring(filename.lastIndexOf("/") + 1); + qtiFilename = "exportAssessment.xml"; + ArrayList xmlFilenames = new ArrayList(); + while (entry != null) { + String zipName = entry.getName(); + int ix = zipName.lastIndexOf('/'); + if (ix > 0) { + String dirName = zipName.substring(0, ix); + if (!dirsMade.contains(dirName)) { + File d = new File(dir.getPath() + "/" + dirName); + // If it already exists as a dir, don't do anything + if (!(d.exists() && d.isDirectory())) { + // Try to create the directory, warn if it fails + if (!d.mkdirs()) { + log.error("unable to mkdir " + dir.getPath() + "/" + dirName); + } + dirsMade.add(dirName); + } + } + } + + File zipEntryFile = new File(dir.getPath() + "/" + entry.getName()); + if (!zipEntryFile.isDirectory()) { + ofile = new FileOutputStream(zipEntryFile); + byte[] buffer = new byte[1024 * 10]; + int bytesRead; + while ((bytesRead = zipStream.read(buffer)) != -1) { + ofile.write(buffer, 0, bytesRead); + } + } + + // Now try to get the QTI xml file name from the imsmanifest.xml + if ("imsmanifest.xml".equals(entry.getName())) { + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + try { + DocumentBuilder db = dbf.newDocumentBuilder(); + Document doc = db.parse(zipEntryFile); + doc.getDocumentElement().normalize(); + NodeList nodeLst = doc.getElementsByTagName("resource"); + Node fstNode = nodeLst.item(0); + NamedNodeMap namedNodeMap= fstNode.getAttributes(); + qtiFilename = namedNodeMap.getNamedItem("href").getNodeValue(); + } + catch (Exception e) { + log.error("error parsing imsmanifest.xml"); + } + } + else if (entry.getName() != null && entry.getName().trim().endsWith(".xml")) { + xmlFilenames.add(entry.getName().trim()); + } + + zipStream.closeEntry(); + entry = zipStream.getNextEntry(); + } + // If the QTI file doesn't exist in the zip, + // we guess the name might be either exportAssessment.xml or the same as the zip file name + if (!xmlFilenames.contains(qtiFilename.trim())) { + if (xmlFilenames.contains("exportAssessment.xml")) { + qtiFilename = "exportAssessment.xml"; + } + else { + qtiFilename = tmpName.substring(0, tmpName.lastIndexOf("_")) + ".xml"; + } + } + } catch (FileNotFoundException e) { + log.error(e.getMessage()); + } catch (IOException e) { + log.error(e.getMessage()); + e.printStackTrace(); + } finally { + if (ofile != null) { + try { + ofile.close(); + } catch (IOException e) { + log.error(e.getMessage()); + } + } + if (fileInputStream != null) { + try { + fileInputStream.close(); + } catch (IOException e) { + log.error(e.getMessage()); + } + } + if (zipStream != null) { + try { + zipStream.close(); + } catch (IOException e) { + log.error(e.getMessage()); + } + } + } + return unzipLocation.toString(); + } + + public String setQTIFilename() { + return qtiFilename; + } + + public String getQTIFilename() { + return qtiFilename; + } +} diff --git a/samigo/samigo-cp/src/java/org/sakaiproject/tool/assessment/contentpackaging/Manifest.java b/samigo/samigo-cp/src/java/org/sakaiproject/tool/assessment/contentpackaging/Manifest.java index fc332a6cad84..5ef17e5a639d 100644 --- a/samigo/samigo-cp/src/java/org/sakaiproject/tool/assessment/contentpackaging/Manifest.java +++ b/samigo/samigo-cp/src/java/org/sakaiproject/tool/assessment/contentpackaging/Manifest.java @@ -1,8 +1,8 @@ -/********************************************************************************** - * $URL$ - * $Id$ - *********************************************************************************** - * +/********************************************************************************** + * $URL$ + * $Id$ + *********************************************************************************** + * * Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008 The Sakai Foundation * * Licensed under the Educational Community License, Version 2.0 (the "License"); @@ -16,276 +16,276 @@ * 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.sakaiproject.tool.assessment.contentpackaging; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.sakaiproject.tool.assessment.qti.asi.ASIBaseClass; -import org.sakaiproject.tool.assessment.qti.constants.QTIConstantStrings; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -/** - *

Copyright: Copyright (c) 2003-5

- *

Organization: Sakai Project

- * @author casong - * @author Ed Smiley esmiley@stanford.edu - * @version $Id$ - */ -public class Manifest extends ASIBaseClass -{ - private static Log log = LogFactory.getLog(Manifest.class); - private String basePath; - private Map sections; - private Map items; - public static final String MANIFEST_TAG = "manifest"; - public static final String RESOURCE_PATH = "manifest/resources/resource"; - public static final String FILE_PATH = "manifest/resources/resource/file"; - - /** - * Creates a new Assessment object. - */ - protected Manifest() - { - super(); - this.sections = new HashMap(); - this.items = new HashMap(); - this.basePath = QTIConstantStrings.QUESTESTINTEROP + "/" + - QTIConstantStrings.ASSESSMENT; - } - - /** - * Creates a new Assessment object. - * - * @param document the Document containing the assessment. - */ - public Manifest(Document document) - { - super(document); - this.sections = new HashMap(); - this.items = new HashMap(); - this.basePath = QTIConstantStrings.QUESTESTINTEROP + "/" + - QTIConstantStrings.ASSESSMENT; - } - - /** - * @param fieldlabel - * @param setValue - */ - public void setFieldentry(String prefixPath, String fieldlabel, String setValue) - { - //String xpath = "questestinterop/assessment/qtimetadata/qtimetadatafield/fieldlabel[text()='" + fieldlabel + "']/following-sibling::fieldentry"; - StringBuilder xpath = new StringBuilder(prefixPath); - xpath.append("/fieldlabel[text()='"); - xpath.append(fieldlabel); - xpath.append("']/following-sibling::fieldentry"); - - super.setFieldentry(xpath.toString(), setValue); - } - /** - * Add a section ref with section Id sectionId. - * - * @param sectionId - */ - public void addSectionRef(String sectionId) - { - if(log.isDebugEnabled()) - { - log.debug("addSection(String " + sectionId + ")"); - } - - try { - String xpath = basePath; - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - DocumentBuilder db = dbf.newDocumentBuilder(); - Document document = db.newDocument(); - Element element = document.createElement(QTIConstantStrings.SECTIONREF); - element.setAttribute(QTIConstantStrings.LINKREFID, sectionId); - this.addElement(xpath, element); - } catch(ParserConfigurationException pce) { - log.error("Exception thrown from addSectionRef() : " + pce.getMessage()); - pce.printStackTrace(); - } - } - - /** - * Remove a section ref with section Id sectionId. - * - * @param sectionId - */ - public void removeSectionRef(String sectionId) - { - if(log.isDebugEnabled()) - { - log.debug("removeSectionRef(String " + sectionId + ")"); - } - - String xpath = - basePath + "/" + QTIConstantStrings.SECTIONREF + "[@" + - QTIConstantStrings.LINKREFID + "='" + sectionId + "']"; - this.removeElement(xpath); - } - - /** - * Remove all section refs. - */ - public void removeSectionRefs() - { - log.debug("removeSectionRefs()"); - String xpath = basePath + "/" + QTIConstantStrings.SECTIONREF; - this.removeElement(xpath); - } - - /** - * Get a collection of section refs. - * - * @return - */ - public List getSectionRefs() - { - log.debug("getSectionRefs()"); - String xpath = basePath + "/" + QTIConstantStrings.SECTIONREF; - - return this.selectNodes(xpath); - } - - /** - * Get a collection of sections. - * @return the sections - */ - public Collection getSections() - { - return this.sections.values(); - } - - /** - * Get a collection of items. - * @return the items - */ - public Collection getItems() - { - return this.items.values(); - } - - /** - * - * - * @return - */ - public List getSectionRefIds() - { - log.debug("getSectionRefIds()"); - List refs = this.getSectionRefs(); - List ids = new ArrayList(); - int size = refs.size(); - for(int i = 0; i < size; i++) - { - Element ref = (Element) refs.get(0); - String idString = ref.getAttribute(QTIConstantStrings.LINKREFID); - ids.add(idString); - } - - return ids; - } - - /** - * Assessment title. - * @return title - */ - public String getTitle() - { - String title = ""; - String xpath = basePath; - List list = this.selectNodes(xpath); - if(list.size()>0) - { - Element element = (Element)list.get(0); - title = element.getAttribute("title"); - } - return title; - } - - /** - * Assessment id (ident attribute) - * @return ident - */ - public String getIdent() - { - String ident = ""; - String xpath = basePath; - List list = this.selectNodes(xpath); - if(list.size()>0) - { - Element element = (Element)list.get(0); - ident = element.getAttribute("ident"); - } - return ident; - } - - - /** - * Assessment id (ident attribute) - * @param ident the ident - */ - public void setIdent(String ident) - { - String xpath = basePath; - List list = this.selectNodes(xpath); - if(list.size()>0) - { - Element element = (Element)list.get(0); - element.setAttribute("ident", ident); - } - } - - /** - * Assessment title. - * @param title - */ - public void setTitle(String title) - { - String xpath = basePath; - List list = this.selectNodes(xpath); - if(list.size()>0) - { - Element element = (Element)list.get(0); - element.setAttribute("title", escapeXml(title)); - } - } - - /** - * Base XPath for the assessment. - * @return - */ - public String getBasePath() - { - return basePath; - } - - /** - * Base XPath for the assessment. - * @param basePath - */ - public void setBasePath(String basePath) - { - this.basePath = basePath; - } -} - - + * + **********************************************************************************/ + + + + +package org.sakaiproject.tool.assessment.contentpackaging; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sakaiproject.tool.assessment.qti.asi.ASIBaseClass; +import org.sakaiproject.tool.assessment.qti.constants.QTIConstantStrings; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +/** + *

Copyright: Copyright (c) 2003-5

+ *

Organization: Sakai Project

+ * @author casong + * @author Ed Smiley esmiley@stanford.edu + * @version $Id$ + */ +public class Manifest extends ASIBaseClass +{ + private static Logger log = LoggerFactory.getLogger(Manifest.class); + private String basePath; + private Map sections; + private Map items; + public static final String MANIFEST_TAG = "manifest"; + public static final String RESOURCE_PATH = "manifest/resources/resource"; + public static final String FILE_PATH = "manifest/resources/resource/file"; + + /** + * Creates a new Assessment object. + */ + protected Manifest() + { + super(); + this.sections = new HashMap(); + this.items = new HashMap(); + this.basePath = QTIConstantStrings.QUESTESTINTEROP + "/" + + QTIConstantStrings.ASSESSMENT; + } + + /** + * Creates a new Assessment object. + * + * @param document the Document containing the assessment. + */ + public Manifest(Document document) + { + super(document); + this.sections = new HashMap(); + this.items = new HashMap(); + this.basePath = QTIConstantStrings.QUESTESTINTEROP + "/" + + QTIConstantStrings.ASSESSMENT; + } + + /** + * @param fieldlabel + * @param setValue + */ + public void setFieldentry(String prefixPath, String fieldlabel, String setValue) + { + //String xpath = "questestinterop/assessment/qtimetadata/qtimetadatafield/fieldlabel[text()='" + fieldlabel + "']/following-sibling::fieldentry"; + StringBuilder xpath = new StringBuilder(prefixPath); + xpath.append("/fieldlabel[text()='"); + xpath.append(fieldlabel); + xpath.append("']/following-sibling::fieldentry"); + + super.setFieldentry(xpath.toString(), setValue); + } + /** + * Add a section ref with section Id sectionId. + * + * @param sectionId + */ + public void addSectionRef(String sectionId) + { + if(log.isDebugEnabled()) + { + log.debug("addSection(String " + sectionId + ")"); + } + + try { + String xpath = basePath; + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + DocumentBuilder db = dbf.newDocumentBuilder(); + Document document = db.newDocument(); + Element element = document.createElement(QTIConstantStrings.SECTIONREF); + element.setAttribute(QTIConstantStrings.LINKREFID, sectionId); + this.addElement(xpath, element); + } catch(ParserConfigurationException pce) { + log.error("Exception thrown from addSectionRef() : " + pce.getMessage()); + pce.printStackTrace(); + } + } + + /** + * Remove a section ref with section Id sectionId. + * + * @param sectionId + */ + public void removeSectionRef(String sectionId) + { + if(log.isDebugEnabled()) + { + log.debug("removeSectionRef(String " + sectionId + ")"); + } + + String xpath = + basePath + "/" + QTIConstantStrings.SECTIONREF + "[@" + + QTIConstantStrings.LINKREFID + "='" + sectionId + "']"; + this.removeElement(xpath); + } + + /** + * Remove all section refs. + */ + public void removeSectionRefs() + { + log.debug("removeSectionRefs()"); + String xpath = basePath + "/" + QTIConstantStrings.SECTIONREF; + this.removeElement(xpath); + } + + /** + * Get a collection of section refs. + * + * @return + */ + public List getSectionRefs() + { + log.debug("getSectionRefs()"); + String xpath = basePath + "/" + QTIConstantStrings.SECTIONREF; + + return this.selectNodes(xpath); + } + + /** + * Get a collection of sections. + * @return the sections + */ + public Collection getSections() + { + return this.sections.values(); + } + + /** + * Get a collection of items. + * @return the items + */ + public Collection getItems() + { + return this.items.values(); + } + + /** + * + * + * @return + */ + public List getSectionRefIds() + { + log.debug("getSectionRefIds()"); + List refs = this.getSectionRefs(); + List ids = new ArrayList(); + int size = refs.size(); + for(int i = 0; i < size; i++) + { + Element ref = (Element) refs.get(0); + String idString = ref.getAttribute(QTIConstantStrings.LINKREFID); + ids.add(idString); + } + + return ids; + } + + /** + * Assessment title. + * @return title + */ + public String getTitle() + { + String title = ""; + String xpath = basePath; + List list = this.selectNodes(xpath); + if(list.size()>0) + { + Element element = (Element)list.get(0); + title = element.getAttribute("title"); + } + return title; + } + + /** + * Assessment id (ident attribute) + * @return ident + */ + public String getIdent() + { + String ident = ""; + String xpath = basePath; + List list = this.selectNodes(xpath); + if(list.size()>0) + { + Element element = (Element)list.get(0); + ident = element.getAttribute("ident"); + } + return ident; + } + + + /** + * Assessment id (ident attribute) + * @param ident the ident + */ + public void setIdent(String ident) + { + String xpath = basePath; + List list = this.selectNodes(xpath); + if(list.size()>0) + { + Element element = (Element)list.get(0); + element.setAttribute("ident", ident); + } + } + + /** + * Assessment title. + * @param title + */ + public void setTitle(String title) + { + String xpath = basePath; + List list = this.selectNodes(xpath); + if(list.size()>0) + { + Element element = (Element)list.get(0); + element.setAttribute("title", escapeXml(title)); + } + } + + /** + * Base XPath for the assessment. + * @return + */ + public String getBasePath() + { + return basePath; + } + + /** + * Base XPath for the assessment. + * @param basePath + */ + public void setBasePath(String basePath) + { + this.basePath = basePath; + } +} + + diff --git a/samigo/samigo-cp/src/java/org/sakaiproject/tool/assessment/contentpackaging/ManifestGenerator.java b/samigo/samigo-cp/src/java/org/sakaiproject/tool/assessment/contentpackaging/ManifestGenerator.java index 54345fd9fd3a..914ad197ae3b 100644 --- a/samigo/samigo-cp/src/java/org/sakaiproject/tool/assessment/contentpackaging/ManifestGenerator.java +++ b/samigo/samigo-cp/src/java/org/sakaiproject/tool/assessment/contentpackaging/ManifestGenerator.java @@ -1,8 +1,8 @@ -/********************************************************************************** - * $URL$ - * $Id$ - *********************************************************************************** - * +/********************************************************************************** + * $URL$ + * $Id$ + *********************************************************************************** + * * Copyright (c) 2007, 2008, 2009 The Sakai Foundation * * Licensed under the Educational Community License, Version 2.0 (the "License"); @@ -16,482 +16,482 @@ * 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.sakaiproject.tool.assessment.contentpackaging; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Set; - -import javax.xml.parsers.ParserConfigurationException; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.w3c.dom.Document; -import org.w3c.dom.Text; -import org.w3c.dom.Element; - -import org.sakaiproject.component.cover.ServerConfigurationService; -import org.sakaiproject.exception.IdUnusedException; -import org.sakaiproject.exception.PermissionException; -import org.sakaiproject.exception.ServerOverloadException; -import org.sakaiproject.exception.TypeException; -import org.sakaiproject.tool.assessment.data.dao.assessment.Answer; -import org.sakaiproject.tool.assessment.data.dao.assessment.AnswerFeedback; -import org.sakaiproject.tool.assessment.data.dao.assessment.AssessmentAttachment; -import org.sakaiproject.tool.assessment.data.dao.assessment.AssessmentData; -import org.sakaiproject.tool.assessment.data.dao.assessment.ItemAttachment; -import org.sakaiproject.tool.assessment.data.dao.assessment.ItemData; -import org.sakaiproject.tool.assessment.data.dao.assessment.ItemFeedback; -import org.sakaiproject.tool.assessment.data.dao.assessment.ItemText; -import org.sakaiproject.tool.assessment.data.dao.assessment.SectionAttachment; -import org.sakaiproject.tool.assessment.data.dao.assessment.SectionData; -import org.sakaiproject.tool.assessment.data.ifc.shared.TypeIfc; -import org.sakaiproject.tool.assessment.facade.AssessmentFacade; -import org.sakaiproject.tool.assessment.facade.SectionFacade; -import org.sakaiproject.tool.assessment.qti.util.XmlUtil; -import org.sakaiproject.tool.assessment.services.assessment.AssessmentService; -import org.sakaiproject.user.api.User; -import org.sakaiproject.user.cover.UserDirectoryService; -import org.xml.sax.SAXException; -import org.sakaiproject.content.api.ContentHostingService; - -/** - *

- * Copyright: Copyright (c) 2007 Sakai - *

- * - * @version $Id$ - */ - -public class ManifestGenerator { - private static Log log = LogFactory.getLog(ManifestGenerator.class); - - /**default namespace and metadata namespace*/ - private static String DEFAULT_NAMESPACE_URI = "http://www.imsglobal.org/xsd/imscp_v1p1"; - private static String DEFAULT_NAMESPACE_SCHEMA_LOCATION = "http://www.imsglobal.org/xsd/imscp_v1p1.xsd"; - private static String IMSMD_NAMESPACE_URI = "http://www.imsglobal.org/xsd/imsmd_v1p2"; - private static String IMSMD_NAMESPACE_SCHEMA_LOCATION = "http://www.imsglobal.org/xsd/imsmd_v1p2.xsd"; - - private static String EXPORT_ASSESSMENT = "exportAssessment"; - private static String EXPORT_ASSESSMENT_XML = EXPORT_ASSESSMENT + ".xml"; - private Document document; - private String assessmentId; - private HashMap contentMap = new HashMap(); - private ContentHostingService contentHostingService; - - public ManifestGenerator(String assessmentId) { - this.assessmentId = assessmentId; - } - - public String getManifest() { - document = readXMLDocument(); - - if (document == null) { - log.info("document == null"); - return ""; - } - String xmlString = XmlUtil.getDOMString(document); - String newXmlString = xmlString; - if (xmlString.startsWith(" -1 || description.indexOf(" -1 || description.indexOf(" -1)) { - byte[] content = null; - int srcStartIndex = 0; - int srcEndIndex = 0; - String src = null; - String resourceId = null; - String eidResourceId = null; - - String[] splittedString = description.split(" -1) { - int offset = 5; - srcStartIndex = splittedRefString[j].indexOf("src=\""); - if(srcStartIndex == -1){ - srcStartIndex = splittedRefString[j].indexOf("href=\""); - offset++; - } - srcEndIndex = splittedRefString[j].indexOf("\"", - srcStartIndex + offset); - src = splittedRefString[j].substring(srcStartIndex + offset, - srcEndIndex).replace(" ", ""); - - try { - src = URLDecoder.decode(src, "UTF-8"); - } catch (UnsupportedEncodingException e) { - log.error(e.getMessage()); - e.printStackTrace(); - } - - if (src.indexOf(siteCollection) > -1) { - resourceId = src.replace(prependString, ""); - content = contentHostingService.getResource(resourceId).getContent(); - if (content != null) { - contentMap.put(resourceId, content); - } - } - else if (src.indexOf(userCollection) > -1) { - eidResourceId = src.replace(prependString, ""); - resourceId = eidResourceId.replace(eid, userId); - content = contentHostingService.getResource(resourceId).getContent(); - if (content != null) { - contentMap.put(eidResourceId, content); - } - } - else if (src.indexOf(attachment) > -1) { - resourceId = src.replace(prependString, ""); - content = contentHostingService.getResource(resourceId).getContent(); - if (content != null) { - contentMap.put(resourceId, content); - } - } - else { - log.error("Neither group nor user"); - } - } - } - } - } - } catch (PermissionException e) { - log.error(e.getMessage()); - e.printStackTrace(); - } catch (IdUnusedException e) { - log.error(e.getMessage()); - e.printStackTrace(); - } catch (TypeException e) { - log.error(e.getMessage()); - e.printStackTrace(); - } catch (ServerOverloadException e) { - log.error(e.getMessage()); - e.printStackTrace(); - } - } - - public void setContentHostingService(){ - if (contentHostingService == null) { - this.contentHostingService = AssessmentService.getContentHostingService(); - } - } - - private Element createManifestElement() - { - Element manifest = createDefaultNSElement("manifest"); - manifest.setAttribute("identifier", "MANIFEST1"); - manifest.setAttribute("xmlns", DEFAULT_NAMESPACE_URI); - manifest.setAttribute("xmlns:imsmd", IMSMD_NAMESPACE_URI); - manifest.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); - manifest.setAttribute("xsi:schemaLocation", - DEFAULT_NAMESPACE_URI + " " + DEFAULT_NAMESPACE_SCHEMA_LOCATION + " " - + IMSMD_NAMESPACE_URI + " " + IMSMD_NAMESPACE_SCHEMA_LOCATION); - - return manifest; - } - - public void appendLOMMetadataToElement(String title, Element parent) - { - // imsmd:lom - Element imsmdLom = createLOMElement("lom"); - // imsmd:general - Element imsmdGeneral = createLOMElement("general"); - // imsmd:identifier - String identifier = Long.toHexString((new Date()).getTime()); - Element imsmdIdentifier = createLOMElementWithLangstring("identifier", identifier); - imsmdGeneral.appendChild(imsmdIdentifier); - // imsmd:title - Element imsmdTitle = createLOMElementWithLangstring("title", title); - imsmdGeneral.appendChild(imsmdTitle); - imsmdLom.appendChild(imsmdGeneral); - parent.appendChild(imsmdLom); - } - - private Element createOrganizationsElement() - { - Element organizations = createDefaultNSElement("organizations"); - return organizations; - } - - public Element createResourceElement() - { - Element resourceElement = createDefaultNSElement("resource"); - resourceElement.setAttributeNS(DEFAULT_NAMESPACE_URI, "identifier", "RESOURCE1"); - resourceElement.setAttributeNS(DEFAULT_NAMESPACE_URI, "type","imsqti_xmlv1p1"); - resourceElement.setAttributeNS(DEFAULT_NAMESPACE_URI, "href", EXPORT_ASSESSMENT_XML); - - return resourceElement; - } - - public Element createFileElement(String href) - { - Element fileElement = createDefaultNSElement("file"); - fileElement.setAttributeNS(DEFAULT_NAMESPACE_URI, "href", href); - - return fileElement; - } - - private Element createDefaultNSElement(String elename) { - - return getDocument().createElementNS(DEFAULT_NAMESPACE_URI, elename); - } - - private Element createLOMElement(String elename) { - - Element imsmdlom = getDocument().createElementNS(IMSMD_NAMESPACE_URI, elename); - imsmdlom.setPrefix("imsmd"); - - return imsmdlom; - } - - - private Element createLOMElementWithLangstring(String elementName, String text) { - - Element element = createLOMElement(elementName); - //imsmd:langstring - Element imsmdlangstring = createLOMElement("langstring"); - imsmdlangstring.setAttribute("xml:lang", "en-US"); - setNodeValue(imsmdlangstring, text); - element.appendChild(imsmdlangstring); - - return element; - } - - private void setNodeValue( Element parent, String data ) { - Text textNode = getDocument().createTextNode(data); - parent.appendChild( textNode ); - } - - private Document getDocument() { - if (document != null) - return document; - else - document = XmlUtil.createDocument(); - return document; - } - -} + * + **********************************************************************************/ + +package org.sakaiproject.tool.assessment.contentpackaging; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Set; + +import javax.xml.parsers.ParserConfigurationException; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.w3c.dom.Document; +import org.w3c.dom.Text; +import org.w3c.dom.Element; + +import org.sakaiproject.component.cover.ServerConfigurationService; +import org.sakaiproject.exception.IdUnusedException; +import org.sakaiproject.exception.PermissionException; +import org.sakaiproject.exception.ServerOverloadException; +import org.sakaiproject.exception.TypeException; +import org.sakaiproject.tool.assessment.data.dao.assessment.Answer; +import org.sakaiproject.tool.assessment.data.dao.assessment.AnswerFeedback; +import org.sakaiproject.tool.assessment.data.dao.assessment.AssessmentAttachment; +import org.sakaiproject.tool.assessment.data.dao.assessment.AssessmentData; +import org.sakaiproject.tool.assessment.data.dao.assessment.ItemAttachment; +import org.sakaiproject.tool.assessment.data.dao.assessment.ItemData; +import org.sakaiproject.tool.assessment.data.dao.assessment.ItemFeedback; +import org.sakaiproject.tool.assessment.data.dao.assessment.ItemText; +import org.sakaiproject.tool.assessment.data.dao.assessment.SectionAttachment; +import org.sakaiproject.tool.assessment.data.dao.assessment.SectionData; +import org.sakaiproject.tool.assessment.data.ifc.shared.TypeIfc; +import org.sakaiproject.tool.assessment.facade.AssessmentFacade; +import org.sakaiproject.tool.assessment.facade.SectionFacade; +import org.sakaiproject.tool.assessment.qti.util.XmlUtil; +import org.sakaiproject.tool.assessment.services.assessment.AssessmentService; +import org.sakaiproject.user.api.User; +import org.sakaiproject.user.cover.UserDirectoryService; +import org.xml.sax.SAXException; +import org.sakaiproject.content.api.ContentHostingService; + +/** + *

+ * Copyright: Copyright (c) 2007 Sakai + *

+ * + * @version $Id$ + */ + +public class ManifestGenerator { + private static Logger log = LoggerFactory.getLogger(ManifestGenerator.class); + + /**default namespace and metadata namespace*/ + private static String DEFAULT_NAMESPACE_URI = "http://www.imsglobal.org/xsd/imscp_v1p1"; + private static String DEFAULT_NAMESPACE_SCHEMA_LOCATION = "http://www.imsglobal.org/xsd/imscp_v1p1.xsd"; + private static String IMSMD_NAMESPACE_URI = "http://www.imsglobal.org/xsd/imsmd_v1p2"; + private static String IMSMD_NAMESPACE_SCHEMA_LOCATION = "http://www.imsglobal.org/xsd/imsmd_v1p2.xsd"; + + private static String EXPORT_ASSESSMENT = "exportAssessment"; + private static String EXPORT_ASSESSMENT_XML = EXPORT_ASSESSMENT + ".xml"; + private Document document; + private String assessmentId; + private HashMap contentMap = new HashMap(); + private ContentHostingService contentHostingService; + + public ManifestGenerator(String assessmentId) { + this.assessmentId = assessmentId; + } + + public String getManifest() { + document = readXMLDocument(); + + if (document == null) { + log.info("document == null"); + return ""; + } + String xmlString = XmlUtil.getDOMString(document); + String newXmlString = xmlString; + if (xmlString.startsWith(" -1 || description.indexOf("
-1 || description.indexOf(" -1)) { + byte[] content = null; + int srcStartIndex = 0; + int srcEndIndex = 0; + String src = null; + String resourceId = null; + String eidResourceId = null; + + String[] splittedString = description.split(" -1) { + int offset = 5; + srcStartIndex = splittedRefString[j].indexOf("src=\""); + if(srcStartIndex == -1){ + srcStartIndex = splittedRefString[j].indexOf("href=\""); + offset++; + } + srcEndIndex = splittedRefString[j].indexOf("\"", + srcStartIndex + offset); + src = splittedRefString[j].substring(srcStartIndex + offset, + srcEndIndex).replace(" ", ""); + + try { + src = URLDecoder.decode(src, "UTF-8"); + } catch (UnsupportedEncodingException e) { + log.error(e.getMessage()); + e.printStackTrace(); + } + + if (src.indexOf(siteCollection) > -1) { + resourceId = src.replace(prependString, ""); + content = contentHostingService.getResource(resourceId).getContent(); + if (content != null) { + contentMap.put(resourceId, content); + } + } + else if (src.indexOf(userCollection) > -1) { + eidResourceId = src.replace(prependString, ""); + resourceId = eidResourceId.replace(eid, userId); + content = contentHostingService.getResource(resourceId).getContent(); + if (content != null) { + contentMap.put(eidResourceId, content); + } + } + else if (src.indexOf(attachment) > -1) { + resourceId = src.replace(prependString, ""); + content = contentHostingService.getResource(resourceId).getContent(); + if (content != null) { + contentMap.put(resourceId, content); + } + } + else { + log.error("Neither group nor user"); + } + } + } + } + } + } catch (PermissionException e) { + log.error(e.getMessage()); + e.printStackTrace(); + } catch (IdUnusedException e) { + log.error(e.getMessage()); + e.printStackTrace(); + } catch (TypeException e) { + log.error(e.getMessage()); + e.printStackTrace(); + } catch (ServerOverloadException e) { + log.error(e.getMessage()); + e.printStackTrace(); + } + } + + public void setContentHostingService(){ + if (contentHostingService == null) { + this.contentHostingService = AssessmentService.getContentHostingService(); + } + } + + private Element createManifestElement() + { + Element manifest = createDefaultNSElement("manifest"); + manifest.setAttribute("identifier", "MANIFEST1"); + manifest.setAttribute("xmlns", DEFAULT_NAMESPACE_URI); + manifest.setAttribute("xmlns:imsmd", IMSMD_NAMESPACE_URI); + manifest.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); + manifest.setAttribute("xsi:schemaLocation", + DEFAULT_NAMESPACE_URI + " " + DEFAULT_NAMESPACE_SCHEMA_LOCATION + " " + + IMSMD_NAMESPACE_URI + " " + IMSMD_NAMESPACE_SCHEMA_LOCATION); + + return manifest; + } + + public void appendLOMMetadataToElement(String title, Element parent) + { + // imsmd:lom + Element imsmdLom = createLOMElement("lom"); + // imsmd:general + Element imsmdGeneral = createLOMElement("general"); + // imsmd:identifier + String identifier = Long.toHexString((new Date()).getTime()); + Element imsmdIdentifier = createLOMElementWithLangstring("identifier", identifier); + imsmdGeneral.appendChild(imsmdIdentifier); + // imsmd:title + Element imsmdTitle = createLOMElementWithLangstring("title", title); + imsmdGeneral.appendChild(imsmdTitle); + imsmdLom.appendChild(imsmdGeneral); + parent.appendChild(imsmdLom); + } + + private Element createOrganizationsElement() + { + Element organizations = createDefaultNSElement("organizations"); + return organizations; + } + + public Element createResourceElement() + { + Element resourceElement = createDefaultNSElement("resource"); + resourceElement.setAttributeNS(DEFAULT_NAMESPACE_URI, "identifier", "RESOURCE1"); + resourceElement.setAttributeNS(DEFAULT_NAMESPACE_URI, "type","imsqti_xmlv1p1"); + resourceElement.setAttributeNS(DEFAULT_NAMESPACE_URI, "href", EXPORT_ASSESSMENT_XML); + + return resourceElement; + } + + public Element createFileElement(String href) + { + Element fileElement = createDefaultNSElement("file"); + fileElement.setAttributeNS(DEFAULT_NAMESPACE_URI, "href", href); + + return fileElement; + } + + private Element createDefaultNSElement(String elename) { + + return getDocument().createElementNS(DEFAULT_NAMESPACE_URI, elename); + } + + private Element createLOMElement(String elename) { + + Element imsmdlom = getDocument().createElementNS(IMSMD_NAMESPACE_URI, elename); + imsmdlom.setPrefix("imsmd"); + + return imsmdlom; + } + + + private Element createLOMElementWithLangstring(String elementName, String text) { + + Element element = createLOMElement(elementName); + //imsmd:langstring + Element imsmdlangstring = createLOMElement("langstring"); + imsmdlangstring.setAttribute("xml:lang", "en-US"); + setNodeValue(imsmdlangstring, text); + element.appendChild(imsmdlangstring); + + return element; + } + + private void setNodeValue( Element parent, String data ) { + Text textNode = getDocument().createTextNode(data); + parent.appendChild( textNode ); + } + + private Document getDocument() { + if (document != null) + return document; + else + document = XmlUtil.createDocument(); + return document; + } + +} diff --git a/samigo/samigo-hibernate/src/java/org/sakaiproject/tool/assessment/data/dao/assessment/AssessmentData.java b/samigo/samigo-hibernate/src/java/org/sakaiproject/tool/assessment/data/dao/assessment/AssessmentData.java index 1462e677367e..43178ee93878 100644 --- a/samigo/samigo-hibernate/src/java/org/sakaiproject/tool/assessment/data/dao/assessment/AssessmentData.java +++ b/samigo/samigo-hibernate/src/java/org/sakaiproject/tool/assessment/data/dao/assessment/AssessmentData.java @@ -27,8 +27,8 @@ import java.util.List; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentAttachmentIfc; import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentIfc; import org.sakaiproject.tool.assessment.data.ifc.assessment.SectionDataIfc; @@ -41,7 +41,7 @@ public class AssessmentData extends org.sakaiproject.tool.assessment.data.dao.as * */ private static final long serialVersionUID = -2260656620640273214L; - private static Log log = LogFactory.getLog(AssessmentData.class); + private static Logger log = LoggerFactory.getLogger(AssessmentData.class); // both Assessment and AssessmentTemplate inherits all the properties & methods from // AssessmentBaseData. // These are the properties that an assessment has and an assessmentTemplate don't diff --git a/samigo/samigo-hibernate/src/java/org/sakaiproject/tool/assessment/data/dao/assessment/PublishedAttachmentData.java b/samigo/samigo-hibernate/src/java/org/sakaiproject/tool/assessment/data/dao/assessment/PublishedAttachmentData.java index 1c4b139744ba..461c5a049e2a 100644 --- a/samigo/samigo-hibernate/src/java/org/sakaiproject/tool/assessment/data/dao/assessment/PublishedAttachmentData.java +++ b/samigo/samigo-hibernate/src/java/org/sakaiproject/tool/assessment/data/dao/assessment/PublishedAttachmentData.java @@ -26,8 +26,8 @@ import java.net.URLEncoder; import java.util.Date; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.ifc.assessment.AttachmentIfc; import org.sakaiproject.tool.assessment.data.ifc.assessment.ItemDataIfc; @@ -39,7 +39,7 @@ public class PublishedAttachmentData * */ private static final long serialVersionUID = -7673339618446778553L; - private static Log log = LogFactory.getLog(PublishedAttachmentData.class); + private static Logger log = LoggerFactory.getLogger(PublishedAttachmentData.class); private Long attachmentId; private ItemDataIfc item; private String resourceId; diff --git a/samigo/samigo-hibernate/src/java/org/sakaiproject/tool/assessment/data/dao/grading/AssessmentGradingComparatorByScoreAndUniqueIdentifier.java b/samigo/samigo-hibernate/src/java/org/sakaiproject/tool/assessment/data/dao/grading/AssessmentGradingComparatorByScoreAndUniqueIdentifier.java index 9f0c24674f28..011fc29ae12a 100644 --- a/samigo/samigo-hibernate/src/java/org/sakaiproject/tool/assessment/data/dao/grading/AssessmentGradingComparatorByScoreAndUniqueIdentifier.java +++ b/samigo/samigo-hibernate/src/java/org/sakaiproject/tool/assessment/data/dao/grading/AssessmentGradingComparatorByScoreAndUniqueIdentifier.java @@ -2,8 +2,8 @@ import java.util.Comparator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.user.api.UserNotDefinedException; import org.sakaiproject.user.cover.UserDirectoryService; @@ -15,7 +15,7 @@ */ public class AssessmentGradingComparatorByScoreAndUniqueIdentifier implements Comparator { - private static Log log = LogFactory.getLog(AssessmentGradingComparatorByScoreAndUniqueIdentifier.class); + private static Logger log = LoggerFactory.getLogger(AssessmentGradingComparatorByScoreAndUniqueIdentifier.class); private boolean anonymous; diff --git a/samigo/samigo-import/src/java/org/sakaiproject/importer/impl/handlers/SamigoAssessmentHandler.java b/samigo/samigo-import/src/java/org/sakaiproject/importer/impl/handlers/SamigoAssessmentHandler.java index c2c0a24afa0c..8a36307c2ff5 100644 --- a/samigo/samigo-import/src/java/org/sakaiproject/importer/impl/handlers/SamigoAssessmentHandler.java +++ b/samigo/samigo-import/src/java/org/sakaiproject/importer/impl/handlers/SamigoAssessmentHandler.java @@ -53,12 +53,12 @@ import org.sakaiproject.tool.cover.ToolManager; import org.sakaiproject.tool.assessment.data.ifc.assessment.SectionDataIfc; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class SamigoAssessmentHandler implements HandlesImportable { - private static Log log = LogFactory.getLog(SamigoAssessmentHandler.class); + private static Logger log = LoggerFactory.getLogger(SamigoAssessmentHandler.class); // Samigo identifies each question type with an int public static final int TRUE_FALSE = 4; diff --git a/samigo/samigo-import/src/java/org/sakaiproject/importer/impl/handlers/SamigoPoolHandler.java b/samigo/samigo-import/src/java/org/sakaiproject/importer/impl/handlers/SamigoPoolHandler.java index 721cbbd21f20..480495008d0c 100644 --- a/samigo/samigo-import/src/java/org/sakaiproject/importer/impl/handlers/SamigoPoolHandler.java +++ b/samigo/samigo-import/src/java/org/sakaiproject/importer/impl/handlers/SamigoPoolHandler.java @@ -46,12 +46,12 @@ import org.sakaiproject.tool.assessment.services.QuestionPoolService; import org.sakaiproject.tool.cover.SessionManager; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class SamigoPoolHandler implements HandlesImportable { - private static Log log = LogFactory.getLog(SamigoPoolHandler.class); + private static Logger log = LoggerFactory.getLogger(SamigoPoolHandler.class); // Samigo identifies each question type with an int public static final int TRUE_FALSE = 4; diff --git a/samigo/samigo-pack/src/java/org/sakaiproject/tool/assessment/shared/SakaiBootStrap.java b/samigo/samigo-pack/src/java/org/sakaiproject/tool/assessment/shared/SakaiBootStrap.java index 42831e63d7af..37e00472e88c 100644 --- a/samigo/samigo-pack/src/java/org/sakaiproject/tool/assessment/shared/SakaiBootStrap.java +++ b/samigo/samigo-pack/src/java/org/sakaiproject/tool/assessment/shared/SakaiBootStrap.java @@ -22,8 +22,8 @@ package org.sakaiproject.tool.assessment.shared; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.db.api.SqlService; @@ -43,7 +43,7 @@ public class SakaiBootStrap private static final String SAKAI_AUTO_DDL_PROPERTY = "auto.ddl"; - private static final Log LOG = LogFactory.getLog(SakaiBootStrap.class); + private static final Logger LOG = LoggerFactory.getLogger(SakaiBootStrap.class); /** Dependency: SqlService. */ private SqlService sqlService; diff --git a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/asi/ASIBaseClass.java b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/asi/ASIBaseClass.java index 53284533d196..f8c74f45f862 100755 --- a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/asi/ASIBaseClass.java +++ b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/asi/ASIBaseClass.java @@ -33,8 +33,8 @@ import javax.xml.parsers.ParserConfigurationException; import org.apache.commons.lang.StringEscapeUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.w3c.dom.CharacterData; import org.w3c.dom.Comment; import org.w3c.dom.DOMException; @@ -58,7 +58,7 @@ public abstract class ASIBaseClass extends XmlStringBuffer { - private static Log log = LogFactory.getLog(ASIBaseClass.class); + private static Logger log = LoggerFactory.getLogger(ASIBaseClass.class); private static final long serialVersionUID = 5670937321581940933L; private String idString; diff --git a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/asi/Assessment.java b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/asi/Assessment.java index e608da173276..31c889e22a2b 100755 --- a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/asi/Assessment.java +++ b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/asi/Assessment.java @@ -34,8 +34,8 @@ import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -50,7 +50,7 @@ */ public class Assessment extends ASIBaseClass { - private static Log log = LogFactory.getLog(Assessment.class); + private static Logger log = LoggerFactory.getLogger(Assessment.class); private String basePath; private Map sections; private Map items; diff --git a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/asi/Item.java b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/asi/Item.java index f2e114cda310..dd4c8e054e9e 100755 --- a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/asi/Item.java +++ b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/asi/Item.java @@ -30,8 +30,8 @@ import java.util.Set; import org.apache.commons.lang.StringEscapeUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.sakaiproject.tool.assessment.data.dao.assessment.Answer; @@ -57,7 +57,7 @@ */ public class Item extends ASIBaseClass { - private static Log log = LogFactory.getLog(Item.class); + private static Logger log = LoggerFactory.getLogger(Item.class); private ItemHelperIfc helper; diff --git a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/asi/Section.java b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/asi/Section.java index a6952302eba7..f4231fb926e6 100755 --- a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/asi/Section.java +++ b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/asi/Section.java @@ -32,8 +32,8 @@ import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -62,7 +62,7 @@ */ public class Section extends ASIBaseClass { - private static Log log = LogFactory.getLog(Section.class); + private static Logger log = LoggerFactory.getLogger(Section.class); public String basePath; /** diff --git a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/AttachmentHelper.java b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/AttachmentHelper.java index 1ce28e913abf..849596c274bf 100644 --- a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/AttachmentHelper.java +++ b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/AttachmentHelper.java @@ -1,8 +1,8 @@ -/********************************************************************************** - * $URL$ - * $Id$ - *********************************************************************************** - * +/********************************************************************************** + * $URL$ + * $Id$ + *********************************************************************************** + * * Copyright (c) 2007, 2008 The Sakai Foundation * * Licensed under the Educational Community License, Version 2.0 (the "License"); @@ -16,122 +16,122 @@ * 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.sakaiproject.tool.assessment.qti.helper; - -import java.io.BufferedInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.sakaiproject.content.api.ContentResource; -import org.sakaiproject.entity.api.ResourcePropertiesEdit; -import org.sakaiproject.exception.IdInvalidException; -import org.sakaiproject.exception.IdUsedException; -import org.sakaiproject.exception.InconsistentException; -import org.sakaiproject.exception.OverQuotaException; -import org.sakaiproject.exception.PermissionException; -import org.sakaiproject.exception.ServerOverloadException; -import org.sakaiproject.tool.assessment.services.assessment.AssessmentService; -import org.sakaiproject.tool.cover.ToolManager; -import org.sakaiproject.user.api.User; -import org.sakaiproject.user.cover.UserDirectoryService; - -public class AttachmentHelper { - private static Log log = LogFactory.getLog(AttachmentHelper.class); - - public ContentResource createContentResource(String fullFilePath, String filename, String mimeType) { - ContentResource contentResource = null; - int BUFFER_SIZE = 2048; - byte tempContent[] = new byte[BUFFER_SIZE]; - File file = null; - FileInputStream fileInputStream = null; - BufferedInputStream bufInputStream = null; - ByteArrayOutputStream byteArrayOutputStream = null; - byte content[]; - int count = 0; - - try { - try{ - fullFilePath = URLDecoder.decode(fullFilePath, "UTF-8"); - filename = URLDecoder.decode(filename, "UTF-8"); - } catch (UnsupportedEncodingException e) { - log.error(e.getMessage()); - e.printStackTrace(); - } - - if (mimeType.equalsIgnoreCase("text/url")) { - content = filename.getBytes(); - filename = filename.replaceAll("http://","http:__"); - } - else { - file = new File(fullFilePath); - fileInputStream = new FileInputStream(file); - bufInputStream = new BufferedInputStream(fileInputStream); - byteArrayOutputStream = new ByteArrayOutputStream(); - while ((count = bufInputStream.read(tempContent, 0, BUFFER_SIZE)) != -1) { - byteArrayOutputStream.write(tempContent, 0, count); - } - content = byteArrayOutputStream.toByteArray(); - } - - ResourcePropertiesEdit props = AssessmentService.getContentHostingService().newResourceProperties(); - // Maybe we need to put in some properties? - // props.addProperty(ResourceProperties.PROP_DISPLAY_NAME, name); - // props.addProperty(ResourceProperties.PROP_DESCRIPTION, name); - - contentResource = AssessmentService.getContentHostingService().addAttachmentResource( - filename, ToolManager.getCurrentPlacement().getContext(), - ToolManager.getTool("sakai.samigo").getTitle(), mimeType, content, props); - } catch (IdInvalidException e) { - log.error("IdInvalidException:" + e.getMessage()); - } catch (PermissionException e) { - log.error("PermissionException:" + e.getMessage()); - } catch (InconsistentException e) { - log.error("InconsistentException:" + e.getMessage()); - } catch (IdUsedException e) { - log.error("IdUsedException:" + e.getMessage()); - } catch (OverQuotaException e) { - log.error("OverQuotaException:" + e.getMessage()); - } catch (ServerOverloadException e) { - log.error("ServerOverloadException:" + e.getMessage()); - } catch (FileNotFoundException e) { - log.error("FileNotFoundException:" + e.getMessage()); - } catch (IOException e) { - log.error("IOException:" + e.getMessage()); - } - finally { - if (bufInputStream != null) { - try { - bufInputStream.close(); - } catch (IOException e) { - log.error(e.getMessage()); - } - } - if (fileInputStream != null) { - try { - fileInputStream.close(); - } catch (IOException e) { - log.error(e.getMessage()); - } - } - if (byteArrayOutputStream != null) { - try { - byteArrayOutputStream.close(); - } catch (IOException e) { - log.error(e.getMessage()); - } - } - } - - return contentResource; - } -} + * + **********************************************************************************/ + +package org.sakaiproject.tool.assessment.qti.helper; + +import java.io.BufferedInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sakaiproject.content.api.ContentResource; +import org.sakaiproject.entity.api.ResourcePropertiesEdit; +import org.sakaiproject.exception.IdInvalidException; +import org.sakaiproject.exception.IdUsedException; +import org.sakaiproject.exception.InconsistentException; +import org.sakaiproject.exception.OverQuotaException; +import org.sakaiproject.exception.PermissionException; +import org.sakaiproject.exception.ServerOverloadException; +import org.sakaiproject.tool.assessment.services.assessment.AssessmentService; +import org.sakaiproject.tool.cover.ToolManager; +import org.sakaiproject.user.api.User; +import org.sakaiproject.user.cover.UserDirectoryService; + +public class AttachmentHelper { + private static Logger log = LoggerFactory.getLogger(AttachmentHelper.class); + + public ContentResource createContentResource(String fullFilePath, String filename, String mimeType) { + ContentResource contentResource = null; + int BUFFER_SIZE = 2048; + byte tempContent[] = new byte[BUFFER_SIZE]; + File file = null; + FileInputStream fileInputStream = null; + BufferedInputStream bufInputStream = null; + ByteArrayOutputStream byteArrayOutputStream = null; + byte content[]; + int count = 0; + + try { + try{ + fullFilePath = URLDecoder.decode(fullFilePath, "UTF-8"); + filename = URLDecoder.decode(filename, "UTF-8"); + } catch (UnsupportedEncodingException e) { + log.error(e.getMessage()); + e.printStackTrace(); + } + + if (mimeType.equalsIgnoreCase("text/url")) { + content = filename.getBytes(); + filename = filename.replaceAll("http://","http:__"); + } + else { + file = new File(fullFilePath); + fileInputStream = new FileInputStream(file); + bufInputStream = new BufferedInputStream(fileInputStream); + byteArrayOutputStream = new ByteArrayOutputStream(); + while ((count = bufInputStream.read(tempContent, 0, BUFFER_SIZE)) != -1) { + byteArrayOutputStream.write(tempContent, 0, count); + } + content = byteArrayOutputStream.toByteArray(); + } + + ResourcePropertiesEdit props = AssessmentService.getContentHostingService().newResourceProperties(); + // Maybe we need to put in some properties? + // props.addProperty(ResourceProperties.PROP_DISPLAY_NAME, name); + // props.addProperty(ResourceProperties.PROP_DESCRIPTION, name); + + contentResource = AssessmentService.getContentHostingService().addAttachmentResource( + filename, ToolManager.getCurrentPlacement().getContext(), + ToolManager.getTool("sakai.samigo").getTitle(), mimeType, content, props); + } catch (IdInvalidException e) { + log.error("IdInvalidException:" + e.getMessage()); + } catch (PermissionException e) { + log.error("PermissionException:" + e.getMessage()); + } catch (InconsistentException e) { + log.error("InconsistentException:" + e.getMessage()); + } catch (IdUsedException e) { + log.error("IdUsedException:" + e.getMessage()); + } catch (OverQuotaException e) { + log.error("OverQuotaException:" + e.getMessage()); + } catch (ServerOverloadException e) { + log.error("ServerOverloadException:" + e.getMessage()); + } catch (FileNotFoundException e) { + log.error("FileNotFoundException:" + e.getMessage()); + } catch (IOException e) { + log.error("IOException:" + e.getMessage()); + } + finally { + if (bufInputStream != null) { + try { + bufInputStream.close(); + } catch (IOException e) { + log.error(e.getMessage()); + } + } + if (fileInputStream != null) { + try { + fileInputStream.close(); + } catch (IOException e) { + log.error(e.getMessage()); + } + } + if (byteArrayOutputStream != null) { + try { + byteArrayOutputStream.close(); + } catch (IOException e) { + log.error(e.getMessage()); + } + } + } + + return contentResource; + } +} diff --git a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/AuthoringHelper.java b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/AuthoringHelper.java index 4b8e870dd96c..43b2ca0cc786 100755 --- a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/AuthoringHelper.java +++ b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/AuthoringHelper.java @@ -46,8 +46,8 @@ import org.xml.sax.SAXException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.shared.api.assessment.SecureDeliveryServiceAPI; import org.sakaiproject.tool.assessment.data.dao.assessment.AssessmentAccessControl; import org.sakaiproject.tool.assessment.data.dao.assessment.AssessmentFeedback; @@ -100,7 +100,7 @@ */ public class AuthoringHelper { - private static Log log = LogFactory.getLog(AuthoringHelper.class); + private static Logger log = LoggerFactory.getLogger(AuthoringHelper.class); // private static final AuthoringXml ax = new AuthoringXml(QTIVersion.VERSION_1_2); private AuthoringXml ax; @@ -396,7 +396,7 @@ public Document getItem(String itemId) } catch (Exception ex) { - log.error(ex); + log.error(ex.getMessage(), ex); return null; } } diff --git a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/AuthoringXml.java b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/AuthoringXml.java index bb0d21dcbe7c..6a4d279971b2 100755 --- a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/AuthoringXml.java +++ b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/AuthoringXml.java @@ -38,8 +38,8 @@ import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.jaxen.JaxenException; import org.jaxen.XPath; import org.jaxen.dom.DOMXPath; @@ -67,7 +67,7 @@ public class AuthoringXml { - private static Log log = LogFactory.getLog(AuthoringXml.class); + private static Logger log = LoggerFactory.getLogger(AuthoringXml.class); public static final String SETTINGS_FILE = "SAM.properties"; // paths diff --git a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/ExtractionHelper.java b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/ExtractionHelper.java index 3cbfd747733f..a84c076a9312 100755 --- a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/ExtractionHelper.java +++ b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/ExtractionHelper.java @@ -41,8 +41,8 @@ import javax.xml.parsers.ParserConfigurationException; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.content.api.ContentResource; import org.sakaiproject.entity.api.ResourceProperties; @@ -120,7 +120,7 @@ public class ExtractionHelper private static final String ITEM_TRANSFORM = "extractItem.xsl"; private static final String ITEM_EMI_TRANSFORM = "extractEMIItem.xsl"; public static final String REMOVE_NAMESPACE_TRANSFORM = "removeDefaultNamespaceFromQTI.xsl"; - private static Log log = LogFactory.getLog(ExtractionHelper.class); + private static Logger log = LoggerFactory.getLogger(ExtractionHelper.class); private int qtiVersion = QTIVersion.VERSION_1_2; private String overridePath = null; // override defaults and settings @@ -311,17 +311,17 @@ private Map map(String transformType, ASIBaseClass asi, boolean isRespondus) } catch (IOException ex) { - log.error(ex); + log.error(ex.getMessage(), ex); ex.printStackTrace(System.out); } catch (SAXException ex) { - log.error(ex); + log.error(ex.getMessage(), ex); ex.printStackTrace(System.out); } catch (ParserConfigurationException ex) { - log.error(ex); + log.error(ex.getMessage(), ex); ex.printStackTrace(System.out); } return map; @@ -361,7 +361,7 @@ public List getSectionXmlList(Assessment assessmentXml) } catch (DOMException ex) { - log.error(ex); + log.error(ex.getMessage(), ex); ex.printStackTrace(System.out); } } @@ -399,7 +399,7 @@ public List getItemXmlList(Section sectionXml) } catch (DOMException ex) { - log.error(ex); + log.error(ex.getMessage(), ex); ex.printStackTrace(System.out); } } diff --git a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/MetaDataList.java b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/MetaDataList.java index 8c2d78656c3f..4b24cc8ff5cc 100755 --- a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/MetaDataList.java +++ b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/MetaDataList.java @@ -31,8 +31,8 @@ import org.sakaiproject.tool.assessment.data.ifc.assessment.ItemDataIfc; import org.sakaiproject.tool.assessment.facade.AssessmentFacade; import org.sakaiproject.tool.assessment.facade.ItemFacade; -import org.apache.commons.logging.LogFactory; -import org.apache.commons.logging.Log; +import org.slf4j.LoggerFactory; +import org.slf4j.Logger; /** * Contract: use List of special "|" delimited "KEY|VALUE" Strings! @@ -40,7 +40,7 @@ */ public class MetaDataList { - private static Log log = LogFactory.getLog(ExtractionHelper.class); + private static Logger log = LoggerFactory.getLogger(ExtractionHelper.class); /** * list of editable settings diff --git a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/assessment/AssessmentHelper12Impl.java b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/assessment/AssessmentHelper12Impl.java index 8df9ef6bf12b..230090539c67 100755 --- a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/assessment/AssessmentHelper12Impl.java +++ b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/assessment/AssessmentHelper12Impl.java @@ -22,8 +22,8 @@ package org.sakaiproject.tool.assessment.qti.helper.assessment; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.qti.constants.QTIVersion; @@ -38,7 +38,7 @@ // Note assessment for QTI 1.2 and 2.0 are nearly identical public class AssessmentHelper12Impl extends AssessmentHelperBase { - private static Log log = LogFactory.getLog(AssessmentHelper12Impl.class); + private static Logger log = LoggerFactory.getLogger(AssessmentHelper12Impl.class); public AssessmentHelper12Impl() { diff --git a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/assessment/AssessmentHelper20Impl.java b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/assessment/AssessmentHelper20Impl.java index 2882cd9ca0f7..80077a3d8b09 100755 --- a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/assessment/AssessmentHelper20Impl.java +++ b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/assessment/AssessmentHelper20Impl.java @@ -22,8 +22,8 @@ package org.sakaiproject.tool.assessment.qti.helper.assessment; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.qti.constants.QTIVersion; @@ -38,7 +38,7 @@ // Note assessment for QTI 1.2 and 2.0 are nearly identical public class AssessmentHelper20Impl extends AssessmentHelperBase { - private static Log log = LogFactory.getLog(AssessmentHelper20Impl.class); + private static Logger log = LoggerFactory.getLogger(AssessmentHelper20Impl.class); public AssessmentHelper20Impl() { diff --git a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/assessment/AssessmentHelperBase.java b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/assessment/AssessmentHelperBase.java index f4c3c9e3203a..94726deb717b 100755 --- a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/assessment/AssessmentHelperBase.java +++ b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/assessment/AssessmentHelperBase.java @@ -33,8 +33,8 @@ import javax.xml.parsers.ParserConfigurationException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.dao.assessment.AttachmentData; import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentAccessControlIfc; import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentFeedbackIfc; @@ -59,7 +59,7 @@ public abstract class AssessmentHelperBase implements AssessmentHelperIfc { - private static Log log = LogFactory.getLog(AssessmentHelperBase.class); + private static Logger log = LoggerFactory.getLogger(AssessmentHelperBase.class); abstract protected int getQtiVersion(); diff --git a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/item/ItemHelper12Impl.java b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/item/ItemHelper12Impl.java index cdc3232cdee7..701a358ace25 100755 --- a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/item/ItemHelper12Impl.java +++ b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/item/ItemHelper12Impl.java @@ -32,8 +32,8 @@ import java.util.Set; import java.util.StringTokenizer; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -60,7 +60,7 @@ public class ItemHelper12Impl extends ItemHelperBase implements ItemHelperIfc { - private static Log log = LogFactory.getLog(ItemHelper12Impl.class); + private static Logger log = LoggerFactory.getLogger(ItemHelper12Impl.class); private static final String MATCH_XPATH = "item/presentation/flow/response_grp/render_choice"; private static final String NBSP = " "; diff --git a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/item/ItemHelper20Impl.java b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/item/ItemHelper20Impl.java index b78c597695cd..69554eecbdc1 100755 --- a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/item/ItemHelper20Impl.java +++ b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/item/ItemHelper20Impl.java @@ -29,8 +29,8 @@ import java.util.List; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -54,7 +54,7 @@ public class ItemHelper20Impl extends ItemHelperBase implements ItemHelperIfc { - private static Log log = LogFactory.getLog(ItemHelper20Impl.class); + private static Logger log = LoggerFactory.getLogger(ItemHelper20Impl.class); private AuthoringXml authoringXml; public ItemHelper20Impl() diff --git a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/item/ItemHelperBase.java b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/item/ItemHelperBase.java index a53e916f8fe8..6aa5d3ea4e01 100755 --- a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/item/ItemHelperBase.java +++ b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/item/ItemHelperBase.java @@ -29,8 +29,8 @@ import java.util.List; import javax.xml.parsers.ParserConfigurationException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.w3c.dom.CharacterData; import org.w3c.dom.DOMException; @@ -46,7 +46,7 @@ public abstract class ItemHelperBase implements ItemHelperIfc { - private static Log log = LogFactory.getLog(ItemHelperBase.class); + private static Logger log = LoggerFactory.getLogger(ItemHelperBase.class); protected static final long ITEM_AUDIO = TypeIfc.AUDIO_RECORDING.longValue(); protected static final long ITEM_ESSAY = TypeIfc.ESSAY_QUESTION.longValue(); diff --git a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/item/ItemTypeExtractionStrategy.java b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/item/ItemTypeExtractionStrategy.java index 95d6f29f79c4..03675b293d10 100755 --- a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/item/ItemTypeExtractionStrategy.java +++ b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/item/ItemTypeExtractionStrategy.java @@ -25,8 +25,8 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.facade.ItemFacade; import org.sakaiproject.tool.assessment.qti.constants.AuthoringConstantStrings; @@ -44,7 +44,7 @@ */ public class ItemTypeExtractionStrategy { - private static Log log = LogFactory.getLog(ItemTypeExtractionStrategy.class); + private static Logger log = LoggerFactory.getLogger(ItemTypeExtractionStrategy.class); private static final Long DEFAULT_TYPE = Long.valueOf(2); diff --git a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/section/SectionHelper12Impl.java b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/section/SectionHelper12Impl.java index c49291237626..fc0fd082ad65 100755 --- a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/section/SectionHelper12Impl.java +++ b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/section/SectionHelper12Impl.java @@ -23,8 +23,8 @@ package org.sakaiproject.tool.assessment.qti.helper.section; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.qti.constants.QTIVersion; @@ -39,7 +39,7 @@ // Note section for QTI 1.2 and 2.0 are nearly identical public class SectionHelper12Impl extends SectionHelperBase { - private static Log log = LogFactory.getLog(SectionHelper12Impl.class); + private static Logger log = LoggerFactory.getLogger(SectionHelper12Impl.class); public SectionHelper12Impl() { diff --git a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/section/SectionHelper20Impl.java b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/section/SectionHelper20Impl.java index b979004d79e0..50c6fa17f9e0 100755 --- a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/section/SectionHelper20Impl.java +++ b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/section/SectionHelper20Impl.java @@ -23,8 +23,8 @@ package org.sakaiproject.tool.assessment.qti.helper.section; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.qti.constants.QTIVersion; @@ -39,7 +39,7 @@ // Note sections for QTI 1.2 and 2.0 are nearly identical public class SectionHelper20Impl extends SectionHelperBase { - private static Log log = LogFactory.getLog(SectionHelper20Impl.class); + private static Logger log = LoggerFactory.getLogger(SectionHelper20Impl.class); public SectionHelper20Impl() { diff --git a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/section/SectionHelperBase.java b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/section/SectionHelperBase.java index 89ec57f35cb5..151889ac84af 100755 --- a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/section/SectionHelperBase.java +++ b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/section/SectionHelperBase.java @@ -27,8 +27,8 @@ import java.io.InputStream; import javax.xml.parsers.ParserConfigurationException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.w3c.dom.DOMException; import org.w3c.dom.Document; import org.xml.sax.SAXException; @@ -48,7 +48,7 @@ abstract public class SectionHelperBase implements SectionHelperIfc { - private static Log log = LogFactory.getLog(SectionHelperBase.class); + private static Logger log = LoggerFactory.getLogger(SectionHelperBase.class); private Document doc; diff --git a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/util/Iso8601DateFormat.java b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/util/Iso8601DateFormat.java index 0d120a4ee52a..5c983d1c8d1a 100755 --- a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/util/Iso8601DateFormat.java +++ b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/util/Iso8601DateFormat.java @@ -30,8 +30,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.qti.exception.Iso8601FormatException; @@ -44,7 +44,7 @@ public class Iso8601DateFormat { public static final String BASIC_FORMAT = "yyyyMMdd'T'HHmmssZ"; - private static Log log = LogFactory.getLog(Iso8601DateFormat.class); + private static Logger log = LoggerFactory.getLogger(Iso8601DateFormat.class); private static final String GMT = "GMT"; // 20031107T152420-0500 or diff --git a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/util/Iso8601TimeInterval.java b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/util/Iso8601TimeInterval.java index bc5fa34efd59..ab2c08cee149 100755 --- a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/util/Iso8601TimeInterval.java +++ b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/util/Iso8601TimeInterval.java @@ -26,8 +26,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.qti.exception.Iso8601FormatException; @@ -39,7 +39,7 @@ */ public class Iso8601TimeInterval { - private static Log log = LogFactory.getLog(Iso8601TimeInterval.class); + private static Logger log = LoggerFactory.getLogger(Iso8601TimeInterval.class); private static final long SECONDS = 1000L; private static final long MINUTES = 60L * SECONDS; private static final long HOURS = 60L * MINUTES; diff --git a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/util/URIResolver.java b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/util/URIResolver.java index 2f0e54281fef..0403008cc274 100755 --- a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/util/URIResolver.java +++ b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/util/URIResolver.java @@ -29,8 +29,8 @@ import javax.xml.transform.TransformerException; import javax.xml.transform.stream.StreamSource; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** @@ -41,7 +41,7 @@ */ public class URIResolver implements javax.xml.transform.URIResolver { - private static Log log = LogFactory.getLog(URIResolver.class); + private static Logger log = LoggerFactory.getLogger(URIResolver.class); public URIResolver() { @@ -62,7 +62,7 @@ public Source resolve(String href, String base) throws TransformerException } catch (URISyntaxException e) { - log.error(e); + log.error(e.getMessage(), e); throw new RuntimeException(e); } diff --git a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/util/XmlMapper.java b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/util/XmlMapper.java index 7031b8e2683d..b63ea73f4fba 100755 --- a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/util/XmlMapper.java +++ b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/util/XmlMapper.java @@ -27,8 +27,8 @@ import java.util.Map; import org.apache.commons.beanutils.BeanUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; @@ -47,7 +47,7 @@ */ public class XmlMapper { - private static Log log = LogFactory.getLog(XmlMapper.class); + private static Logger log = LoggerFactory.getLogger(XmlMapper.class); public static final String ATTRIBUTE_PREFIX = "attribute_"; @@ -103,7 +103,7 @@ static public void populateBeanFromDoc(Serializable bean, Document doc) } catch(Exception e) { - log.error(e); + log.error(e.getMessage(), e); throw new RuntimeException(e); } } diff --git a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/util/XmlStringBuffer.java b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/util/XmlStringBuffer.java index 45755a67b006..079d2166b5a2 100755 --- a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/util/XmlStringBuffer.java +++ b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/util/XmlStringBuffer.java @@ -42,8 +42,8 @@ import javax.xml.transform.stream.StreamResult; import org.apache.commons.collections.ReferenceMap; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.jaxen.JaxenException; import org.jaxen.XPath; import org.jaxen.dom.DOMXPath; @@ -73,7 +73,7 @@ public class XmlStringBuffer implements java.io.Serializable { - private static Log log = LogFactory.getLog(XmlStringBuffer.class); + private static Logger log = LoggerFactory.getLogger(XmlStringBuffer.class); /** * Explicitly setting serialVersionUID insures future versions can be diff --git a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/util/XmlUtil.java b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/util/XmlUtil.java index c0861ce57223..b972d504bc6d 100755 --- a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/util/XmlUtil.java +++ b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/util/XmlUtil.java @@ -46,8 +46,8 @@ import javax.xml.transform.dom.DOMSource; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; @@ -70,7 +70,7 @@ public final class XmlUtil { - private static Log log = LogFactory.getLog(XmlUtil.class); + private static Logger log = LoggerFactory.getLogger(XmlUtil.class); private static String[] M_goodTags = "a,abbr,acronym,address,b,big,blockquote,br,center,cite,code,dd,del,dir,div,dl,dt,em,font,hr,h1,h2,h3,h4,h5,h6,i,ins,kbd,li,marquee,menu,nobr,noembed,ol,p,pre,q,rt,ruby,rbc,rb,rtc,rp,s,samp,small,span,strike,strong,sub,sup,tt,u,ul,var,xmp,img,embed,object,table,tr,td,th,tbody,caption,thead,tfoot,colgroup,col,param".split(","); private static Pattern[] M_goodTagsPatterns; private static Pattern[] M_goodCloseTagsPatterns; @@ -629,7 +629,7 @@ public static String getDOMString(Node node) return domString; } - public static String processFormattedText(Log log, String value) { + public static String processFormattedText(Logger log, String value) { if (StringUtils.isEmpty(value)) { return value; } diff --git a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/services/qti/QTIService.java b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/services/qti/QTIService.java index 1eabc794db19..e665232c9997 100755 --- a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/services/qti/QTIService.java +++ b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/services/qti/QTIService.java @@ -23,8 +23,8 @@ import java.util.ArrayList; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.facade.AssessmentFacade; import org.sakaiproject.tool.assessment.facade.ItemFacade; import org.sakaiproject.tool.assessment.facade.QuestionPoolFacade; @@ -47,7 +47,7 @@ public class QTIService implements QTIServiceAPI { - private static Log log = LogFactory.getLog(QTIService.class); + private static Logger log = LoggerFactory.getLogger(QTIService.class); public QTIService() { } diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/business/entity/FileNamer.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/business/entity/FileNamer.java index 8b54492b372d..c2c9582ab832 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/business/entity/FileNamer.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/business/entity/FileNamer.java @@ -24,8 +24,8 @@ import java.util.Date; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.util.StringParseUtils; @@ -116,7 +116,7 @@ public static String make( */ public static void unitTest() { - Log log = LogFactory.getLog(RecordingData.class); + Logger log = LoggerFactory.getLogger(RecordingData.class); String s; s = make("Ed Smiley", "esmiley", "Intro to Wombats 101"); diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/business/entity/RecordingData.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/business/entity/RecordingData.java index d00f21f9886c..a0144a514b7c 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/business/entity/RecordingData.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/business/entity/RecordingData.java @@ -37,8 +37,8 @@ import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -388,7 +388,7 @@ public void setImageURL(String s) */ public Document getXMLDataModel() { - Log log = LogFactory.getLog(RecordingData.class); + Logger log = LoggerFactory.getLogger(RecordingData.class); Document document = null; DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); @@ -462,7 +462,7 @@ public Document getXMLDataModel() */ public static void unitTest() { - Log log = LogFactory.getLog(RecordingData.class); + Logger log = LoggerFactory.getLogger(RecordingData.class); RecordingData rd = new RecordingData( diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/business/entity/SortableDate.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/business/entity/SortableDate.java index 8ad5bf029605..be29fc5f4e2f 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/business/entity/SortableDate.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/business/entity/SortableDate.java @@ -25,8 +25,8 @@ import java.text.SimpleDateFormat; import java.util.Date; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** *

@@ -56,7 +56,7 @@ */ public class SortableDate { - private Log log = LogFactory.getLog(SortableDate.class); + private Logger log = LoggerFactory.getLogger(SortableDate.class); /** * standard date format string used in AAM diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/AgentFacade.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/AgentFacade.java index ccfa68d5bfed..3c0806b3765c 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/AgentFacade.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/AgentFacade.java @@ -25,8 +25,8 @@ import java.util.Collection; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.ifc.shared.AgentDataIfc; import org.sakaiproject.tool.assessment.integration.context.IntegrationContextFactory; import org.sakaiproject.tool.assessment.integration.helper.ifc.AgentHelper; @@ -50,7 +50,7 @@ public class AgentFacade implements Serializable, AgentDataIfc */ private static final long serialVersionUID = 1L; -private Log log = LogFactory.getLog(AgentFacade.class); +private Logger log = LoggerFactory.getLogger(AgentFacade.class); private static final AgentHelper helper = IntegrationContextFactory.getInstance().getAgentHelper(); diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/AssessmentBaseFacade.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/AssessmentBaseFacade.java index 9aee9552922b..efdbb4476ccc 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/AssessmentBaseFacade.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/AssessmentBaseFacade.java @@ -28,8 +28,8 @@ import java.util.Iterator; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.osid.assessment.Assessment; import org.osid.assessment.AssessmentException; import org.osid.shared.Type; @@ -45,7 +45,7 @@ public class AssessmentBaseFacade implements java.io.Serializable, AssessmentBaseIfc{ - private Log log = LogFactory.getLog(AssessmentBaseFacade.class); + private Logger log = LoggerFactory.getLogger(AssessmentBaseFacade.class); private AssessmentImpl assessmentImpl = new AssessmentImpl(); //<-- place holder protected org.osid.assessment.Assessment assessment = diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/AssessmentFacadeQueries.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/AssessmentFacadeQueries.java index 1d6719b0d3d0..64f352756192 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/AssessmentFacadeQueries.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/AssessmentFacadeQueries.java @@ -31,8 +31,8 @@ import java.util.Set; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.HibernateException; import org.hibernate.Query; import org.hibernate.Session; @@ -102,7 +102,7 @@ public class AssessmentFacadeQueries extends HibernateDaoSupport implements AssessmentFacadeQueriesAPI { - private Log log = LogFactory.getLog(AssessmentFacadeQueries.class); + private Logger log = LoggerFactory.getLogger(AssessmentFacadeQueries.class); // private ResourceBundle rb = // ResourceBundle.getBundle("org.sakaiproject.tool.assessment.bundle.Messages"); diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/AssessmentGradingFacadeQueries.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/AssessmentGradingFacadeQueries.java index 5df835e5de3a..bad1d6aea51e 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/AssessmentGradingFacadeQueries.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/AssessmentGradingFacadeQueries.java @@ -50,8 +50,8 @@ import java.util.TreeMap; import java.util.TreeSet; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.Criteria; import org.hibernate.HibernateException; import org.hibernate.Query; @@ -117,7 +117,7 @@ import org.sakaiproject.exception.ServerOverloadException; public class AssessmentGradingFacadeQueries extends HibernateDaoSupport implements AssessmentGradingFacadeQueriesAPI{ - private static final Log log = LogFactory.getLog(AssessmentGradingFacadeQueries.class); + private static final Logger log = LoggerFactory.getLogger(AssessmentGradingFacadeQueries.class); /** * Default empty Constructor @@ -291,7 +291,7 @@ public Object doInHibernate(Session session) throws HibernateException, SQLExcep return newlist; } } catch (RuntimeException e) { - log.warn( e ); + log.warn(e.getMessage(), e); return new ArrayList(); } } @@ -436,7 +436,7 @@ public Object doInHibernate(Session session) throws HibernateException, } return map; } catch (Exception e) { - log.warn( e ); + log.warn(e.getMessage(), e); return new HashMap(); } } @@ -493,7 +493,7 @@ public Object doInHibernate(Session session) throws HibernateException, SQLExcep } return map; } catch (Exception e) { - log.warn( e ); + log.warn(e.getMessage(), e); return new HashMap(); } } @@ -529,7 +529,7 @@ public HashMap getStudentGradingData(String assessmentGradingId, boolean loadGra } return map; } catch (Exception e) { - log.warn( e ); + log.warn(e.getMessage(), e); return new HashMap(); } } @@ -610,7 +610,7 @@ public Object doInHibernate(Session session) throws HibernateException, SQLExcep } return map; } catch (Exception e) { - log.warn( e ); + log.warn(e.getMessage(), e); return new HashMap(); } } @@ -879,28 +879,28 @@ public void removeMediaById(Long mediaId, Long itemGradingId){ try { session.close(); } catch (Exception e1) { - log.warn( e1 ); + log.warn(e1.getMessage(), e1); } } if (rs !=null){ try { rs.close(); } catch (Exception e1) { - log.warn( e1 ); + log.warn(e1.getMessage(), e1); } } if (statement !=null){ try { statement.close(); } catch (Exception e1) { - log.warn( e1 ); + log.warn(e1.getMessage(), e1); } } if (statement0 !=null){ try { statement0.close(); } catch (Exception e1) { - log.warn( e1 ); + log.warn(e1.getMessage(), e1); } } @@ -908,14 +908,14 @@ public void removeMediaById(Long mediaId, Long itemGradingId){ try { conn.close(); } catch (Exception e1) { - log.warn( e1 ); + log.warn(e1.getMessage(), e1); } } } if (mediaLocation != null){ File mediaFile = new File(mediaLocation); if (mediaFile.delete()) { - log.warn("problem removing file. mediaLocation = " + mediaLocation); + log.warn("problem removing file. mediaLocation = {}", mediaLocation); } } @@ -956,7 +956,7 @@ public Object doInHibernate(Session session) throws HibernateException, SQLExcep mediaData.setContentResource(getMediaContentResource(mediaData)); a.add(mediaData); } - log.debug("*** no. of media ="+a.size()); + log.debug("*** no. of media = {}", a.size()); return a; } @@ -978,12 +978,12 @@ public Object doInHibernate(Session session) throws HibernateException, SQLExcep mediaData.setContentResource(getMediaContentResource(mediaData)); a.add(mediaData); } - log.debug("*** no. of media ="+a.size()); + log.debug("*** no. of media = {}", a.size()); return a; } public HashMap getMediaItemGradingHash(final Long assessmentGradingId){ - log.debug("*** assessmentGradingId =" + assessmentGradingId); + log.debug("*** assessmentGradingId = {}", assessmentGradingId); HashMap map = new HashMap(); final HibernateCallback hcb = new HibernateCallback(){ @@ -1004,7 +1004,7 @@ public Object doInHibernate(Session session) throws HibernateException, SQLExcep // There might be duplicate. But we just overwrite it with the same itemGradingData map.put(itemGradingData.getPublishedItemId(), al); } - log.debug("*** no. of media =" + map.size()); + log.debug("*** no. of media = {}", map.size()); return map; } @@ -1017,7 +1017,7 @@ public ArrayList getMediaArray(ItemGradingData item){ mediaData.setContentResource(getMediaContentResource(mediaData)); a.add(mediaData); } - log.debug("*** no. of media ="+a.size()); + log.debug("*** no. of media = {}", a.size()); return a; } @@ -1071,7 +1071,7 @@ public Object doInHibernate(Session session) throws HibernateException, SQLExcep return a; } catch (Exception e) { - log.warn( e ); + log.warn(e.getMessage(), e); return new ArrayList(); } } @@ -1157,8 +1157,8 @@ public Object doInHibernate(Session session) throws HibernateException, SQLExcep public ItemGradingData getItemGradingData( final Long assessmentGradingId, final Long publishedItemId) { - log.debug("****assessmentGradingId="+assessmentGradingId); - log.debug("****publishedItemId="+publishedItemId); + log.debug("****assessmentGradingId={}", assessmentGradingId); + log.debug("****publishedItemId={}", publishedItemId); final HibernateCallback hcb = new HibernateCallback(){ public Object doInHibernate(Session session) throws HibernateException, SQLException { @@ -1345,7 +1345,7 @@ public void saveOrUpdateAssessmentGrading(AssessmentGradingData assessment) { retryCount = 0; } catch (Exception e) { - log.warn("problem inserting/updating assessmentGrading: "+e.getMessage()); + log.warn("problem inserting/updating assessmentGrading: {}", e.getMessage()); retryCount = persistenceHelper.retryDeadlock(e, retryCount); } } @@ -1361,7 +1361,7 @@ private byte[] getMediaStream(Long mediaId){ try{ session = getSessionFactory().openSession(); conn = session.connection(); - log.debug("****Connection="+conn); + log.debug("****Connection={}", conn); String query="select MEDIA from SAM_MEDIA_T where MEDIAID=?"; statement = conn.prepareStatement(query); statement.setLong(1, mediaId); @@ -1391,35 +1391,35 @@ private byte[] getMediaStream(Long mediaId){ try { session.close(); } catch (Exception e1) { - log.warn( e1 ); + log.warn(e1.getMessage(), e1); } } if (rs !=null){ try { rs.close(); } catch (Exception e1) { - log.warn( e1 ); + log.warn(e1.getMessage(), e1); } } if (statement !=null){ try { statement.close(); } catch (Exception e1) { - log.warn( e1 ); + log.warn(e1.getMessage(), e1); } } if (in !=null){ try { in.close(); } catch (Exception e1) { - log.warn( e1 ); + log.warn(e1.getMessage(), e1); } } if (conn !=null){ try { conn.close(); } catch (Exception e1) { - log.warn( e1 ); + log.warn(e1.getMessage(), e1); } } } @@ -1948,7 +1948,7 @@ public Object doInHibernate(Session session) throws HibernateException, SQLExcep Integer nextSequence; int count = 1; for (int i = 1; i < list.size(); i++) { - log.debug("i = " + i); + log.debug("i = {}", i); nextSequence = (Integer) list.get(i); if (sequence.equals(nextSequence)) { log.debug("equal"); @@ -1966,7 +1966,7 @@ public Object doInHibernate(Session session) throws HibernateException, SQLExcep return position; } catch (Exception e) { - log.warn( e ); + log.warn(e.getMessage(), e); position.add(0); position.add(0); return position; @@ -2082,7 +2082,7 @@ public Object doInHibernate(Session session) throws HibernateException, SQLExcep Iterator iter = typeIdList.iterator(); while(iter.hasNext()) { typeId = (Long) iter.next(); - log.debug("typeId = " + typeId); + log.debug("typeId = {}", typeId); } return typeId; } @@ -3162,7 +3162,7 @@ else if (aitemseq > bitemseq) */ private static class ResponsesComparator implements Comparator { boolean anonymous; - private static final Log log = LogFactory.getLog(ResponsesComparator.class); + private static final Logger log = LoggerFactory.getLogger(ResponsesComparator.class); public ResponsesComparator(boolean anony) { anonymous = anony; @@ -3718,7 +3718,7 @@ private GradingAttachmentData createGradingtAttachment(String resourceId, String attach.setLocation(assessmentFacadeQueries.getRelativePath(cr.getUrl(), protocol)); } } catch (PermissionException | IdUnusedException | TypeException pe) { - log.warn( pe ); + log.warn(pe.getMessage(), pe); } return attach; } @@ -3901,7 +3901,7 @@ private void saveItemGradingData(AssessmentGradingData assessmentGradingData, Lo itemGradingData.setPublishedItemId(publishedItemId); ItemService itemService = new ItemService(); Long itemTextId = itemService.getItemTextId(publishedItemId); - log.debug("itemTextId = " + itemTextId); + log.debug("itemTextId = {}", itemTextId); if(itemTextId != -1){ itemGradingData.setPublishedItemTextId(itemTextId); //we're in the DAO su we can use the DAO method directly diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/EventLogFacade.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/EventLogFacade.java index a2140e276bbb..d8ccd37529a2 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/EventLogFacade.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/EventLogFacade.java @@ -1,7 +1,7 @@ package org.sakaiproject.tool.assessment.facade; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.dao.assessment.EventLogData; @@ -9,7 +9,7 @@ public class EventLogFacade implements java.io.Serializable { private static final long serialVersionUID = 1L; - private Log log = LogFactory.getLog(EventLogFacade.class); + private Logger log = LoggerFactory.getLogger(EventLogFacade.class); private EventLogData data; @@ -27,4 +27,4 @@ public EventLogData getData() { public void setData(EventLogData data) { this.data = data; } -} \ No newline at end of file +} diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/EventLogFacadeQueries.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/EventLogFacadeQueries.java index 6bff576e948e..c2ed4e0ac20d 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/EventLogFacadeQueries.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/EventLogFacadeQueries.java @@ -6,8 +6,8 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.dao.assessment.EventLogData; import org.sakaiproject.tool.assessment.data.dao.assessment.PublishedAccessControl; import org.sakaiproject.tool.assessment.services.PersistenceService; @@ -24,8 +24,7 @@ public class EventLogFacadeQueries extends HibernateDaoSupport implements EventLogFacadeQueriesAPI { - private Log log = LogFactory - .getLog(EventLogFacadeQueries.class); + private static final Logger log = LoggerFactory.getLogger(EventLogFacadeQueries.class); public void saveOrUpdateEventLog(EventLogFacade eventLog){ diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/FavoriteColChoicesFacadeQueries.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/FavoriteColChoicesFacadeQueries.java index deeec5c8ace8..a87f158a41c3 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/FavoriteColChoicesFacadeQueries.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/FavoriteColChoicesFacadeQueries.java @@ -4,8 +4,8 @@ import java.util.Iterator; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.HibernateException; import org.hibernate.Query; import org.hibernate.Session; @@ -17,7 +17,7 @@ public class FavoriteColChoicesFacadeQueries extends HibernateDaoSupport implements FavoriteColChoicesFacadeQueriesAPI { - private Log log = LogFactory.getLog(FavoriteColChoicesFacadeQueries.class); + private Logger log = LoggerFactory.getLogger(FavoriteColChoicesFacadeQueries.class); public FavoriteColChoicesFacadeQueries () { } diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/GradebookFacade.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/GradebookFacade.java index 932cec0a2046..5447aed9a182 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/GradebookFacade.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/GradebookFacade.java @@ -22,8 +22,8 @@ package org.sakaiproject.tool.assessment.facade; import java.io.Serializable; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.integration.context.IntegrationContextFactory; import org.sakaiproject.tool.assessment.integration.helper.ifc.GradebookHelper; @@ -42,7 +42,7 @@ public class GradebookFacade implements Serializable * */ private static final long serialVersionUID = 1L; -private Log log = LogFactory.getLog(GradebookFacade.class); +private Logger log = LoggerFactory.getLogger(GradebookFacade.class); private static final GradebookHelper helper = IntegrationContextFactory.getInstance().getGradebookHelper(); private static final boolean integrated = diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/ItemFacade.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/ItemFacade.java index 6edfe226ab97..a96bc26c10f3 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/ItemFacade.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/ItemFacade.java @@ -30,8 +30,8 @@ import java.util.List; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.osid.assessment.AssessmentException; import org.osid.assessment.Item; import org.osid.shared.Type; @@ -56,7 +56,7 @@ * agreement. */ public class ItemFacade implements Serializable, ItemDataIfc, Comparable { - private Log log = LogFactory.getLog(ItemFacade.class); + private Logger log = LoggerFactory.getLogger(ItemFacade.class); private static final long serialVersionUID = 7526471155622776147L; protected org.osid.assessment.Item item; diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/ItemFacadeQueries.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/ItemFacadeQueries.java index 1c67e9631462..429c787af503 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/ItemFacadeQueries.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/ItemFacadeQueries.java @@ -29,8 +29,8 @@ import java.util.List; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.HibernateException; import org.hibernate.Query; import org.hibernate.Session; @@ -52,7 +52,7 @@ import org.springframework.orm.hibernate3.support.HibernateDaoSupport; public class ItemFacadeQueries extends HibernateDaoSupport implements ItemFacadeQueriesAPI { - private Log log = LogFactory.getLog(ItemFacadeQueries.class); + private Logger log = LoggerFactory.getLogger(ItemFacadeQueries.class); public ItemFacadeQueries() { } diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/PublishedAssessmentFacade.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/PublishedAssessmentFacade.java index b16ed787bd5a..418e1ba788b2 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/PublishedAssessmentFacade.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/PublishedAssessmentFacade.java @@ -30,8 +30,8 @@ import java.util.Map; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.dao.assessment.AssessmentData; import org.sakaiproject.tool.assessment.data.dao.assessment.PublishedMetaData; import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentAccessControlIfc; @@ -49,7 +49,7 @@ public class PublishedAssessmentFacade implements java.io.Serializable, PublishedAssessmentIfc, Cloneable { private static final long serialVersionUID = 7526471155622776147L; - private Log log = LogFactory.getLog(PublishedAssessmentFacade.class); + private Logger log = LoggerFactory.getLogger(PublishedAssessmentFacade.class); public static final Integer ACTIVE_STATUS = Integer.valueOf(1); public static final Integer INACTIVE_STATUS = Integer.valueOf(0); public static final Integer ANY_STATUS = Integer.valueOf(2); diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/PublishedAssessmentFacadeQueries.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/PublishedAssessmentFacadeQueries.java index fb231f21582c..c5e189b8c2cd 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/PublishedAssessmentFacadeQueries.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/PublishedAssessmentFacadeQueries.java @@ -36,8 +36,8 @@ import java.util.TreeMap; import java.util.Vector; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.HibernateException; import org.hibernate.Query; import org.hibernate.Session; @@ -120,8 +120,7 @@ public class PublishedAssessmentFacadeQueries extends HibernateDaoSupport implements PublishedAssessmentFacadeQueriesAPI { - private Log log = LogFactory - .getLog(PublishedAssessmentFacadeQueries.class); + private Logger log = LoggerFactory.getLogger(PublishedAssessmentFacadeQueries.class); public static final String STARTDATE = "assessmentAccessControl.startDate"; diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/PublishedItemFacadeQueries.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/PublishedItemFacadeQueries.java index d56a7073b5cd..548dffe6f221 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/PublishedItemFacadeQueries.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/PublishedItemFacadeQueries.java @@ -4,8 +4,8 @@ import java.util.HashSet; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.dao.assessment.PublishedItemData; import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentIfc; import org.sakaiproject.tool.assessment.data.ifc.assessment.ItemDataIfc; @@ -15,8 +15,7 @@ public class PublishedItemFacadeQueries extends HibernateDaoSupport implements PublishedItemFacadeQueriesAPI { - private Log log = LogFactory - .getLog(PublishedItemFacadeQueries.class); + private Logger log = LoggerFactory.getLogger(PublishedItemFacadeQueries.class); public IdImpl getItemId(String id) { return new IdImpl(id); diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/PublishedSectionFacade.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/PublishedSectionFacade.java index fd57106aff72..eeeccbade825 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/PublishedSectionFacade.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/PublishedSectionFacade.java @@ -1,8 +1,8 @@ -/********************************************************************************** - * $URL$ - * $Id$ - *********************************************************************************** - * +/********************************************************************************** + * $URL$ + * $Id$ + *********************************************************************************** + * * Copyright (c) 2007, 2008 The Sakai Foundation * * Licensed under the Educational Community License, Version 2.0 (the "License"); @@ -16,121 +16,121 @@ * 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.sakaiproject.tool.assessment.facade; -import java.io.Serializable; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.osid.assessment.AssessmentException; -import org.sakaiproject.tool.assessment.data.dao.assessment.PublishedAssessmentData; -import org.sakaiproject.tool.assessment.data.dao.assessment.PublishedSectionMetaData; -import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentIfc; -import org.sakaiproject.tool.assessment.data.ifc.assessment.ItemDataIfc; -import org.sakaiproject.tool.assessment.data.ifc.assessment.SectionDataIfc; -import org.sakaiproject.tool.assessment.data.ifc.assessment.SectionMetaDataIfc; -import org.sakaiproject.tool.assessment.services.PersistenceService; - -public class PublishedSectionFacade extends SectionFacade implements Serializable, Comparable { - - private static final long serialVersionUID = 5788637014806801101L; - private Log log = LogFactory.getLog(PublishedSectionFacade.class); - - /** - * This is a very important constructor. Please make sure that you have - * set all the properties (declared above as private) of SectionFacade using - * the "data" supplied. "data" is a org.osid.assessment.Section properties - * and I use it to store info about an section. - * @param data - */ - public PublishedSectionFacade(SectionDataIfc data){ - super(data); - } - - // the following method's signature has a one to one relationship to - // org.sakaiproject.tool.assessment.osid.section.SectionImpl - // which implements org.osid.assessment.Section - - /** - * Get the Id for this SectionFacade. - * @return org.osid.shared.Id - */ - org.osid.shared.Id getId(){ - try { - this.data = (SectionDataIfc) section.getData(); - } - catch (AssessmentException ex) { - throw new DataFacadeException(ex.getMessage()); - } - - PublishedSectionFacadeQueriesAPI publishedSectionFacadeQueries = PersistenceService.getInstance().getPublishedSectionFacadeQueries(); - return publishedSectionFacadeQueries.getId(this.data.getSectionId()); - } - - /** - * Add a Meta Data to SectionFacade - * @param label - * @param entry - */ - public void addSectionMetaData(String label, String entry) { - if (this.metaDataSet == null) { - setSectionMetaDataSet(new HashSet()); - this.metaDataMap = new HashMap(); - } - - if (this.metaDataMap.get(label)!=null){ - // just update - Iterator iter = this.metaDataSet.iterator(); - while (iter.hasNext()){ - SectionMetaDataIfc metadata = (SectionMetaDataIfc) iter.next(); - if (metadata.getLabel().equals(label)) - metadata.setEntry(entry); - } - } - else { - this.metaDataMap.put(label, entry); - this.data.getSectionMetaDataSet().add(new PublishedSectionMetaData((SectionDataIfc)this.data, label, entry)); - this.metaDataSet = this.data.getSectionMetaDataSet(); - } - } - - public Set getItemFacadeSet() throws DataFacadeException { - this.itemFacadeSet = new HashSet(); - try { - this.data = (SectionDataIfc) section.getData(); - Set set = this.data.getItemSet(); - Iterator iter = set.iterator(); - while (iter.hasNext()) { - PublishedItemFacade publishedItemFacade = new PublishedItemFacade((ItemDataIfc) iter - .next()); - this.itemFacadeSet.add(publishedItemFacade); - } - //this.sectionSet = data.getSectionSet(); - } catch (AssessmentException ex) { - throw new DataFacadeException(ex.getMessage()); - } - return this.itemFacadeSet; - } - - public AssessmentIfc getAssessment() throws DataFacadeException { - try { - this.data = (SectionDataIfc) section.getData(); - } - catch (AssessmentException ex) { - throw new DataFacadeException(ex.getMessage()); - } - return new PublishedAssessmentFacade(this.data.getAssessment()); - } - - public void setAssessment(AssessmentIfc assessment) { - this.assessment = (PublishedAssessmentFacade)assessment; - PublishedAssessmentData d = (PublishedAssessmentData) ((PublishedAssessmentFacade) this.assessment).getData(); - this.data.setAssessment(d); - } -} + * + **********************************************************************************/ + +package org.sakaiproject.tool.assessment.facade; +import java.io.Serializable; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.osid.assessment.AssessmentException; +import org.sakaiproject.tool.assessment.data.dao.assessment.PublishedAssessmentData; +import org.sakaiproject.tool.assessment.data.dao.assessment.PublishedSectionMetaData; +import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentIfc; +import org.sakaiproject.tool.assessment.data.ifc.assessment.ItemDataIfc; +import org.sakaiproject.tool.assessment.data.ifc.assessment.SectionDataIfc; +import org.sakaiproject.tool.assessment.data.ifc.assessment.SectionMetaDataIfc; +import org.sakaiproject.tool.assessment.services.PersistenceService; + +public class PublishedSectionFacade extends SectionFacade implements Serializable, Comparable { + + private static final long serialVersionUID = 5788637014806801101L; + private Logger log = LoggerFactory.getLogger(PublishedSectionFacade.class); + + /** + * This is a very important constructor. Please make sure that you have + * set all the properties (declared above as private) of SectionFacade using + * the "data" supplied. "data" is a org.osid.assessment.Section properties + * and I use it to store info about an section. + * @param data + */ + public PublishedSectionFacade(SectionDataIfc data){ + super(data); + } + + // the following method's signature has a one to one relationship to + // org.sakaiproject.tool.assessment.osid.section.SectionImpl + // which implements org.osid.assessment.Section + + /** + * Get the Id for this SectionFacade. + * @return org.osid.shared.Id + */ + org.osid.shared.Id getId(){ + try { + this.data = (SectionDataIfc) section.getData(); + } + catch (AssessmentException ex) { + throw new DataFacadeException(ex.getMessage()); + } + + PublishedSectionFacadeQueriesAPI publishedSectionFacadeQueries = PersistenceService.getInstance().getPublishedSectionFacadeQueries(); + return publishedSectionFacadeQueries.getId(this.data.getSectionId()); + } + + /** + * Add a Meta Data to SectionFacade + * @param label + * @param entry + */ + public void addSectionMetaData(String label, String entry) { + if (this.metaDataSet == null) { + setSectionMetaDataSet(new HashSet()); + this.metaDataMap = new HashMap(); + } + + if (this.metaDataMap.get(label)!=null){ + // just update + Iterator iter = this.metaDataSet.iterator(); + while (iter.hasNext()){ + SectionMetaDataIfc metadata = (SectionMetaDataIfc) iter.next(); + if (metadata.getLabel().equals(label)) + metadata.setEntry(entry); + } + } + else { + this.metaDataMap.put(label, entry); + this.data.getSectionMetaDataSet().add(new PublishedSectionMetaData((SectionDataIfc)this.data, label, entry)); + this.metaDataSet = this.data.getSectionMetaDataSet(); + } + } + + public Set getItemFacadeSet() throws DataFacadeException { + this.itemFacadeSet = new HashSet(); + try { + this.data = (SectionDataIfc) section.getData(); + Set set = this.data.getItemSet(); + Iterator iter = set.iterator(); + while (iter.hasNext()) { + PublishedItemFacade publishedItemFacade = new PublishedItemFacade((ItemDataIfc) iter + .next()); + this.itemFacadeSet.add(publishedItemFacade); + } + //this.sectionSet = data.getSectionSet(); + } catch (AssessmentException ex) { + throw new DataFacadeException(ex.getMessage()); + } + return this.itemFacadeSet; + } + + public AssessmentIfc getAssessment() throws DataFacadeException { + try { + this.data = (SectionDataIfc) section.getData(); + } + catch (AssessmentException ex) { + throw new DataFacadeException(ex.getMessage()); + } + return new PublishedAssessmentFacade(this.data.getAssessment()); + } + + public void setAssessment(AssessmentIfc assessment) { + this.assessment = (PublishedAssessmentFacade)assessment; + PublishedAssessmentData d = (PublishedAssessmentData) ((PublishedAssessmentFacade) this.assessment).getData(); + this.data.setAssessment(d); + } +} diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/PublishedSectionFacadeQueries.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/PublishedSectionFacadeQueries.java index 84113bbf3538..3b7013d94432 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/PublishedSectionFacadeQueries.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/PublishedSectionFacadeQueries.java @@ -1,13 +1,13 @@ package org.sakaiproject.tool.assessment.facade; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.osid.shared.impl.IdImpl; import org.springframework.orm.hibernate3.support.HibernateDaoSupport; public class PublishedSectionFacadeQueries extends HibernateDaoSupport implements PublishedSectionFacadeQueriesAPI { - private Log log = LogFactory.getLog(PublishedSectionFacadeQueries.class); + private Logger log = LoggerFactory.getLogger(PublishedSectionFacadeQueries.class); public IdImpl getId(String id) { return new IdImpl(id); diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/QuestionPoolFacade.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/QuestionPoolFacade.java index 8d7515d36116..ecc5ef51e40c 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/QuestionPoolFacade.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/QuestionPoolFacade.java @@ -29,8 +29,8 @@ import org.osid.shared.Id; import org.osid.shared.SharedException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.business.questionpool.QuestionPool; import org.sakaiproject.tool.assessment.business.questionpool.QuestionPoolException; @@ -48,7 +48,7 @@ public class QuestionPoolFacade implements java.io.Serializable, QuestionPoolDataIfc, Cloneable { - private Log log = LogFactory.getLog(QuestionPoolFacade.class); + private Logger log = LoggerFactory.getLogger(QuestionPoolFacade.class); private static final long serialVersionUID = 7526471155622776147L; public static final Long ACCESS_DENIED = Long.valueOf(30); diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/QuestionPoolFacadeQueries.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/QuestionPoolFacadeQueries.java index 907292d15dce..0be8b9aad36b 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/QuestionPoolFacadeQueries.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/QuestionPoolFacadeQueries.java @@ -37,8 +37,8 @@ import java.util.Set; import java.util.Vector; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.HibernateException; import org.hibernate.Query; import org.hibernate.SQLQuery; @@ -66,7 +66,7 @@ public class QuestionPoolFacadeQueries extends HibernateDaoSupport implements QuestionPoolFacadeQueriesAPI { - private Log log = LogFactory.getLog(QuestionPoolFacadeQueries.class); + private Logger log = LoggerFactory.getLogger(QuestionPoolFacadeQueries.class); // SAM-2049 private static final String VERSION_START = " - "; @@ -517,7 +517,7 @@ public QuestionPoolFacade getPool(Long poolId, String agent) { return getQuestionPool(qpp); } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); return null; } } diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/SectionFacade.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/SectionFacade.java index dc26d44b5943..2035126cd94e 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/SectionFacade.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/SectionFacade.java @@ -30,8 +30,8 @@ import java.util.Iterator; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.osid.assessment.AssessmentException; import org.osid.assessment.Section; import org.osid.shared.Type; @@ -49,7 +49,7 @@ import org.sakaiproject.tool.assessment.services.PersistenceService; public class SectionFacade implements Serializable, SectionDataIfc, Comparable { - private Log log = LogFactory.getLog(SectionFacade.class); + private Logger log = LoggerFactory.getLogger(SectionFacade.class); private static final long serialVersionUID = 7526471155622776147L; diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/SectionFacadeQueries.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/SectionFacadeQueries.java index f46028fdf81b..7bd6094dc9d7 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/SectionFacadeQueries.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/SectionFacadeQueries.java @@ -23,8 +23,8 @@ import java.sql.SQLException; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.HibernateException; import org.hibernate.Query; import org.hibernate.Session; @@ -36,7 +36,7 @@ import org.springframework.orm.hibernate3.support.HibernateDaoSupport; public class SectionFacadeQueries extends HibernateDaoSupport implements SectionFacadeQueriesAPI { - private Log log = LogFactory.getLog(SectionFacadeQueries.class); + private Logger log = LoggerFactory.getLogger(SectionFacadeQueries.class); public SectionFacadeQueries () { } diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/TypeFacadeQueries.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/TypeFacadeQueries.java index f2316ae1ef7b..a89a1ba3c2c7 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/TypeFacadeQueries.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/TypeFacadeQueries.java @@ -26,8 +26,8 @@ import java.util.HashMap; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.HibernateException; import org.hibernate.Query; import org.hibernate.Session; @@ -41,7 +41,7 @@ public class TypeFacadeQueries extends HibernateDaoSupport implements TypeFacadeQueriesAPI{ - private Log log = LogFactory.getLog(TypeFacadeQueries.class); + private Logger log = LoggerFactory.getLogger(TypeFacadeQueries.class); private HashMap typeFacadeMap; private List itemTypes; diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/authz/AuthorizationFacadeQueries.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/authz/AuthorizationFacadeQueries.java index 83c8bcb5f4eb..ceae46af7fce 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/authz/AuthorizationFacadeQueries.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/authz/AuthorizationFacadeQueries.java @@ -41,13 +41,13 @@ import org.sakaiproject.tool.assessment.facade.authz.QualifierFacade; import org.sakaiproject.tool.assessment.services.PersistenceService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class AuthorizationFacadeQueries extends HibernateDaoSupport implements AuthorizationFacadeQueriesAPI{ - private Log log = LogFactory.getLog(AuthorizationFacadeQueries.class); + private Logger log = LoggerFactory.getLogger(AuthorizationFacadeQueries.class); public AuthorizationFacadeQueries() { } diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/util/PagingUtilQueries.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/util/PagingUtilQueries.java index f9c0767a80e1..82362ef04eca 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/util/PagingUtilQueries.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/util/PagingUtilQueries.java @@ -25,8 +25,8 @@ import java.util.ArrayList; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.orm.hibernate3.HibernateCallback; import org.springframework.orm.hibernate3.support.HibernateDaoSupport; import org.hibernate.HibernateException; @@ -36,7 +36,7 @@ public class PagingUtilQueries extends HibernateDaoSupport implements PagingUtilQueriesAPI{ - private Log log = LogFactory.getLog(PagingUtilQueries.class); + private Logger log = LoggerFactory.getLogger(PagingUtilQueries.class); public PagingUtilQueries () { } diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/context/IntegrationContextFactory.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/context/IntegrationContextFactory.java index eb8964f758cf..c5d5418b68af 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/context/IntegrationContextFactory.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/context/IntegrationContextFactory.java @@ -21,8 +21,8 @@ package org.sakaiproject.tool.assessment.integration.context; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.integration.context.spring.FactoryUtil; import org.sakaiproject.tool.assessment.integration.helper.ifc.AgentHelper; @@ -49,7 +49,7 @@ public abstract class IntegrationContextFactory */ public static IntegrationContextFactory getInstance() { - Log log = LogFactory.getLog(IntegrationContextFactory.class); + Logger log = LoggerFactory.getLogger(IntegrationContextFactory.class); log.debug("IntegrationContextFactory.getInstance()"); if (instance==null) { @@ -69,7 +69,7 @@ public static IntegrationContextFactory getInstance() public static IntegrationContextFactory getTestInstance() { - Log log = LogFactory.getLog(IntegrationContextFactory.class); + Logger log = LoggerFactory.getLogger(IntegrationContextFactory.class); log.debug("IntegrationContextFactory.getTestInstance()"); if (instance==null) { diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/context/spring/FactoryUtil.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/context/spring/FactoryUtil.java index a2803d41d79c..8939c9fe923a 100755 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/context/spring/FactoryUtil.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/context/spring/FactoryUtil.java @@ -24,8 +24,8 @@ import java.io.File; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.xml.XmlBeanFactory; import org.springframework.core.io.ClassPathResource; @@ -40,7 +40,7 @@ */ public class FactoryUtil { - private Log log = LogFactory.getLog(FactoryUtil.class); + private Logger log = LoggerFactory.getLogger(FactoryUtil.class); private static boolean useLocator = false; // private static boolean useLocator = true; diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/context/spring/IntegrationContext.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/context/spring/IntegrationContext.java index bec6f3cc21ce..7b428fa2a5c8 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/context/spring/IntegrationContext.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/context/spring/IntegrationContext.java @@ -21,8 +21,8 @@ package org.sakaiproject.tool.assessment.integration.context.spring; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.integration.context.IntegrationContextFactory; import org.sakaiproject.tool.assessment.integration.helper.ifc.AgentHelper; @@ -41,7 +41,7 @@ */ public class IntegrationContext extends IntegrationContextFactory { - private Log log = LogFactory.getLog(IntegrationContext.class); + private Logger log = LoggerFactory.getLogger(IntegrationContext.class); private boolean integrated; private AgentHelper agentHelper; diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/AbstractSectionsImpl.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/AbstractSectionsImpl.java index 55a104f95742..02247da1b4d9 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/AbstractSectionsImpl.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/AbstractSectionsImpl.java @@ -22,8 +22,8 @@ package org.sakaiproject.tool.assessment.integration.helper.integrated; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.SectionAwareness; import org.sakaiproject.tool.assessment.services.PersistenceService; @@ -34,7 +34,7 @@ */ class AbstractSectionsImpl { - private static final Log log = LogFactory.getLog(AbstractSectionsImpl.class); + private static final Logger log = LoggerFactory.getLogger(AbstractSectionsImpl.class); private SectionAwareness sectionAwareness; diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/AgentHelperImpl.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/AgentHelperImpl.java index 81695be5d14d..d2bae8bf1bd7 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/AgentHelperImpl.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/AgentHelperImpl.java @@ -25,8 +25,8 @@ import java.util.HashMap; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroup; import org.sakaiproject.authz.api.GroupNotDefinedException; import org.sakaiproject.authz.api.Role; @@ -64,7 +64,7 @@ */ public class AgentHelperImpl implements AgentHelper { - private Log log = LogFactory.getLog(AgentHelperImpl.class); + private Logger log = LoggerFactory.getLogger(AgentHelperImpl.class); AgentImpl agent; private AuthzGroupService authzGroupService; diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/AssessmentGradeInfoProvider.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/AssessmentGradeInfoProvider.java index a339f72d4e52..694a9db768b1 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/AssessmentGradeInfoProvider.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/AssessmentGradeInfoProvider.java @@ -31,8 +31,8 @@ import java.util.Map; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.Member; import org.sakaiproject.exception.IdUnusedException; @@ -58,7 +58,7 @@ */ public class AssessmentGradeInfoProvider implements ExternalAssignmentProvider, ExternalAssignmentProviderCompat { - private Log log = LogFactory.getLog(AssessmentGradeInfoProvider.class); + private Logger log = LoggerFactory.getLogger(AssessmentGradeInfoProvider.class); private GradebookExternalAssessmentService geaService; private UserDirectoryService userDirectoryService; private SiteService siteService; diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/CalendarServiceHelperImpl.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/CalendarServiceHelperImpl.java index ddb68147906c..74f37babb92d 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/CalendarServiceHelperImpl.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/CalendarServiceHelperImpl.java @@ -8,8 +8,8 @@ import java.util.Map; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.calendar.api.Calendar; import org.sakaiproject.calendar.api.CalendarEvent; import org.sakaiproject.calendar.api.CalendarEventEdit; @@ -34,7 +34,7 @@ import org.sakaiproject.tool.cover.ToolManager; public class CalendarServiceHelperImpl implements CalendarServiceHelper { - private static final Log log = LogFactory.getLog(CalendarServiceHelperImpl.class); + private static final Logger log = LoggerFactory.getLogger(CalendarServiceHelperImpl.class); private CalendarService calendarService; private Boolean calendarExistsForSite = null; private Map calendarExistCache = new HashMap(); @@ -68,26 +68,15 @@ public void removeCalendarEvent(String siteId, String eventId){ try{ CalendarEvent calendarEvent = calendar.getEvent(eventId); calendar.removeEvent(calendar.getEditEvent(calendarEvent.getId(), CalendarService.EVENT_REMOVE_CALENDAR)); - }catch (PermissionException e) + }catch (PermissionException | InUseException | IdUnusedException e) { - log.warn(e); - } - catch (InUseException e) - { - log.warn(e); - } - catch (IdUnusedException e) - { - log.warn(e); + log.warn(e.getMessage(), e); } } - }catch (IdUnusedException e) - { - log.warn(e); - }catch (PermissionException e) + }catch (IdUnusedException | PermissionException e) { - log.warn(e); + log.warn(e.getMessage(), e); } } @@ -126,15 +115,10 @@ public String addCalendarEvent(String siteId, String title, String desc, long da calendar.commitEvent(edit); } } - } catch (IdUnusedException e) { - log.warn(e); - } catch (InUseException e) { - log.warn(e); - }catch (PermissionException e){ - log.warn(e); + } catch (IdUnusedException | InUseException | PermissionException e) { + log.warn(e.getMessage(), e); } - return eventId; } @@ -150,7 +134,7 @@ public void updateAllCalendarEvents(PublishedAssessmentFacade pub, String releas } }catch(Exception e){ //user could have manually removed the calendar event - log.warn(e); + log.warn(e.getMessage(), e); } //add any new calendar events @@ -209,7 +193,7 @@ private List getAuthorizedGroups(String releaseTo, String[] authorizedGro } } catch (IdUnusedException ex) { - // No site available + log.debug(ex.getMessage()); } } return authorizedGroups; diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/FacadeUtils.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/FacadeUtils.java index 5bc0cbd4b4c8..4bbeb666925a 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/FacadeUtils.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/FacadeUtils.java @@ -26,15 +26,15 @@ import java.text.Collator; import java.text.ParseException; import java.text.RuleBasedCollator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.coursemanagement.EnrollmentRecord; /** * borrowed gradebook's FacadeUtils class */ public class FacadeUtils { - private static final Log log = LogFactory.getLog(FacadeUtils.class); + private static final Logger log = LoggerFactory.getLogger(FacadeUtils.class); // Enforce noninstantiability. private FacadeUtils() { diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/GradebookHelperImpl.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/GradebookHelperImpl.java index 25e95a31bc1e..02268236e27f 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/GradebookHelperImpl.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/GradebookHelperImpl.java @@ -22,8 +22,8 @@ package org.sakaiproject.tool.assessment.integration.helper.integrated; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.api.Placement; import org.sakaiproject.tool.assessment.integration.helper.ifc.GradebookHelper; import org.sakaiproject.tool.cover.ToolManager; @@ -49,7 +49,7 @@ public class GradebookHelperImpl implements GradebookHelper { - private Log log = LogFactory.getLog(GradebookHelperImpl.class); + private Logger log = LoggerFactory.getLogger(GradebookHelperImpl.class); /** * Get current gradebook uid. @@ -67,7 +67,7 @@ public String getGradebookUId(String siteId) } catch (Exception ex) { - log.warn(ex); + log.warn(ex.getMessage(), ex); placement = null; } if (placement == null) diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/GradebookServiceHelperImpl.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/GradebookServiceHelperImpl.java index 6aff5450e046..7f832d99a325 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/GradebookServiceHelperImpl.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/GradebookServiceHelperImpl.java @@ -25,8 +25,8 @@ import java.util.Map; import org.apache.commons.lang.StringEscapeUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.math.util.MathUtils; import org.sakaiproject.exception.IdUnusedException; import org.sakaiproject.service.gradebook.shared.GradebookExternalAssessmentService; @@ -64,7 +64,7 @@ */ public class GradebookServiceHelperImpl implements GradebookServiceHelper { - private Log log = LogFactory.getLog(GradebookServiceHelperImpl.class); + private Logger log = LoggerFactory.getLogger(GradebookServiceHelperImpl.class); /** * Does a gradebook exist? diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/PublishingTargetHelperImpl.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/PublishingTargetHelperImpl.java index b994baa8c129..1abadabedda6 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/PublishingTargetHelperImpl.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/PublishingTargetHelperImpl.java @@ -23,8 +23,8 @@ import java.util.HashMap; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentAccessControlIfc; import org.sakaiproject.tool.assessment.facade.AgentFacade; @@ -50,7 +50,7 @@ public class PublishingTargetHelperImpl implements PublishingTargetHelper { - private Log log = LogFactory.getLog(PublishingTargetHelperImpl.class); + private Logger log = LoggerFactory.getLogger(PublishingTargetHelperImpl.class); //private org.sakaiproject.component.api.ComponentManager cm; diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/SectionAwareServiceHelperImpl.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/SectionAwareServiceHelperImpl.java index 027c0cc0b4b7..bc1e39fe715f 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/SectionAwareServiceHelperImpl.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/SectionAwareServiceHelperImpl.java @@ -31,8 +31,8 @@ import java.util.Map; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.exception.IdUnusedException; import org.sakaiproject.section.api.SectionAwareness; import org.sakaiproject.section.api.coursemanagement.CourseSection; @@ -50,7 +50,7 @@ * on the shared Section Awareness API. */ public class SectionAwareServiceHelperImpl extends AbstractSectionsImpl implements SectionAwareServiceHelper { - private static final Log log = LogFactory.getLog(SectionAwareServiceHelperImpl.class); + private static final Logger log = LoggerFactory.getLogger(SectionAwareServiceHelperImpl.class); public boolean isUserAbleToGrade(String siteid, String userUid) { return (getSectionAwareness().isSiteMemberInRole(siteid, userUid, Role.INSTRUCTOR) || getSectionAwareness().isSiteMemberInRole(siteid, userUid, Role.TA)); diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/ServerConfigurationServiceHelperImpl.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/ServerConfigurationServiceHelperImpl.java index 7b0f148fe5ee..80ef96b0afe0 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/ServerConfigurationServiceHelperImpl.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/integration/helper/integrated/ServerConfigurationServiceHelperImpl.java @@ -22,8 +22,8 @@ package org.sakaiproject.tool.assessment.integration.helper.integrated; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.tool.assessment.integration.helper.ifc.ServerConfigurationServiceHelper; /** @@ -31,7 +31,7 @@ * on the shared Section Awareness API. */ public class ServerConfigurationServiceHelperImpl implements ServerConfigurationServiceHelper { - private static final Log log = LogFactory.getLog(ServerConfigurationServiceHelperImpl.class); + private static final Logger log = LoggerFactory.getLogger(ServerConfigurationServiceHelperImpl.class); public String getString(String key, String defaultValue){ return (ServerConfigurationService.getString(key, defaultValue)); diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/osid/assessment/impl/SectionIteratorImpl.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/osid/assessment/impl/SectionIteratorImpl.java index 23fac8c0d305..3d87681e86ff 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/osid/assessment/impl/SectionIteratorImpl.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/osid/assessment/impl/SectionIteratorImpl.java @@ -25,15 +25,15 @@ import java.util.List; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.osid.assessment.AssessmentException; import org.osid.assessment.Section; public class SectionIteratorImpl implements org.osid.assessment.SectionIterator { - private Log log = LogFactory.getLog(SectionIteratorImpl.class); + private Logger log = LoggerFactory.getLogger(SectionIteratorImpl.class); private Iterator sectionIterator; private Iterator sectionIter; diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/AutoSubmitAssessmentsJob.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/AutoSubmitAssessmentsJob.java index 4b013922679a..01122eaf263f 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/AutoSubmitAssessmentsJob.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/AutoSubmitAssessmentsJob.java @@ -4,8 +4,8 @@ import java.util.Date; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.quartz.StatefulJob; @@ -20,7 +20,7 @@ public class AutoSubmitAssessmentsJob implements StatefulJob { - private static final Log LOG = LogFactory.getLog(AutoSubmitAssessmentsJob.class); + private static final Logger LOG = LoggerFactory.getLogger(AutoSubmitAssessmentsJob.class); protected String serverName = "unknown"; private AuthzGroupService authzGroupService; diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/GradingService.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/GradingService.java index 426765e3e6be..f0df3526aea2 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/GradingService.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/GradingService.java @@ -48,8 +48,8 @@ import java.util.regex.Pattern; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.math.complex.Complex; import org.apache.commons.math.complex.ComplexFormat; import org.apache.commons.math.util.MathUtils; @@ -120,7 +120,7 @@ public class GradingService final Pattern CALCQ_FORMULA_SPLIT_PATTERN = Pattern.compile("(" + OPEN_BRACKET + OPEN_BRACKET + CALCQ_VAR_FORM_NAME + CLOSE_BRACKET + CLOSE_BRACKET + ")"); final Pattern CALCQ_CALCULATION_PATTERN = Pattern.compile("\\[\\[([^\\[\\]]+?)\\]\\]?"); // non-greedy - private Log log = LogFactory.getLog(GradingService.class); + private Logger log = LoggerFactory.getLogger(GradingService.class); /** * Get all scores for a published assessment from the back end. @@ -134,7 +134,7 @@ public ArrayList getTotalScores(String publishedId, String which) getAssessmentGradingFacadeQueries().getTotalScores(publishedId, which)); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return results; } @@ -148,7 +148,7 @@ public ArrayList getTotalScores(String publishedId, String which, boolean getSub getAssessmentGradingFacadeQueries().getTotalScores(publishedId, which, getSubmittedOnly)); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return results; } @@ -163,7 +163,7 @@ public List getAllSubmissions(String publishedId) results = PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().getAllSubmissions(publishedId); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return results; } @@ -175,7 +175,7 @@ public List getAllAssessmentGradingData(Long publishedId) results = PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().getAllAssessmentGradingData(publishedId); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return results; } @@ -188,7 +188,7 @@ public ArrayList getHighestAssessmentGradingList(Long publishedId) new ArrayList(PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().getHighestAssessmentGradingList(publishedId)); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return results; } @@ -201,7 +201,7 @@ public List getHighestSubmittedOrGradedAssessmentGradingList(Long publishedId) new ArrayList(PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().getHighestSubmittedOrGradedAssessmentGradingList(publishedId)); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return results; } @@ -214,7 +214,7 @@ public ArrayList getLastAssessmentGradingList(Long publishedId) new ArrayList(PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().getLastAssessmentGradingList(publishedId)); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return results; } @@ -227,7 +227,7 @@ public List getLastSubmittedAssessmentGradingList(Long publishedId) PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().getLastSubmittedAssessmentGradingList(publishedId); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return results; } @@ -240,7 +240,7 @@ public List getLastSubmittedOrGradedAssessmentGradingList(Long publishedId) PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().getLastSubmittedOrGradedAssessmentGradingList(publishedId); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return results; } @@ -319,10 +319,10 @@ public void notifyDeleteToGradebook(ArrayList gdataList, PublishedAssessmentIfc notifyGradebook(l, pub); } catch (GradebookServiceException ge) { - ge.printStackTrace(); + log.error(ge.getMessage(), ge); throw ge; } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); throw new RuntimeException(e); } @@ -423,7 +423,7 @@ public HashMap getItemScores(Long publishedId, Long itemId, String which) getAssessmentGradingFacadeQueries() .getItemScores(publishedId, itemId, which); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); return new HashMap(); } } @@ -435,7 +435,7 @@ public HashMap getItemScores(Long publishedId, Long itemId, String which, boolea getAssessmentGradingFacadeQueries() .getItemScores(publishedId, itemId, which, loadItemGradingAttachment); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); return new HashMap(); } } @@ -447,7 +447,7 @@ public HashMap getItemScores(Long itemId, List scores, boolean loadItemGradingAt getAssessmentGradingFacadeQueries() .getItemScores(itemId, scores, loadItemGradingAttachment); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); return new HashMap(); } } @@ -462,7 +462,7 @@ public HashMap getLastItemGradingData(String publishedId, String agentId) getAssessmentGradingFacadeQueries() .getLastItemGradingData(Long.valueOf(publishedId), agentId); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); return new HashMap(); } } @@ -477,7 +477,7 @@ public HashMap getStudentGradingData(String assessmentGradingId) getAssessmentGradingFacadeQueries() .getStudentGradingData(assessmentGradingId); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); return new HashMap(); } } @@ -493,7 +493,7 @@ public HashMap getSubmitData(String publishedId, String agentId, Integer scoring return (HashMap) PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().getSubmitData(Long.valueOf(publishedId), agentId, scoringoption, gradingId); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); return new HashMap(); } } @@ -514,7 +514,7 @@ public int getSubmissionSizeOfPublishedAssessment(String publishedAssessmentId) .getSubmissionSizeOfPublishedAssessment(Long.valueOf( publishedAssessmentId)); } catch(Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); return 0; } } @@ -565,7 +565,7 @@ public ItemGradingData getLastItemGradingDataByAgent(String publishedItemId, Str return PersistenceService.getInstance().getAssessmentGradingFacadeQueries(). getLastItemGradingDataByAgent(Long.valueOf(publishedItemId), agentId); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); return null; } } @@ -576,7 +576,7 @@ public ItemGradingData getItemGradingData(String assessmentGradingId, String pub return PersistenceService.getInstance().getAssessmentGradingFacadeQueries(). getItemGradingData(Long.valueOf(assessmentGradingId), Long.valueOf(publishedItemId)); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); return null; } } @@ -592,7 +592,8 @@ public AssessmentGradingData load(String assessmentGradingId, boolean loadGradin } catch(Exception e) { - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } } @@ -603,7 +604,8 @@ public ItemGradingData getItemGrading(String itemGradingId) { } catch(Exception e) { - log.error(e); throw new Error(e); + log.error(e.getMessage(), e); + throw new Error(e); } } @@ -614,7 +616,8 @@ public AssessmentGradingData getLastAssessmentGradingByAgentId(String publishedA } catch(Exception e) { - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } } @@ -625,7 +628,8 @@ public AssessmentGradingData getLastSavedAssessmentGradingByAgentId(String publi } catch(Exception e) { - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } } @@ -644,7 +648,8 @@ public AssessmentGradingData getLastSubmittedAssessmentGradingByAgentId(String p } catch(Exception e) { - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } return assessmentGranding; @@ -656,7 +661,7 @@ public void saveItemGrading(ItemGradingData item) PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().saveItemGrading(item); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } } @@ -686,7 +691,7 @@ public void saveOrUpdateAssessmentGrading(AssessmentGradingData assessment) PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().saveOrUpdateAssessmentGrading(assessment); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } } @@ -704,13 +709,13 @@ public void saveOrUpdateAssessmentGradingOnly(AssessmentGradingData assessment) try { PersistenceService.getInstance().getAssessmentGradingFacadeQueries().saveOrUpdateAssessmentGrading(assessment); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } finally { // Restore the original itemGradingSet back assessment.setItemGradingSet(h); size = assessment.getItemGradingSet().size(); - log.debug("after persist to db: size = " + size); + log.debug("after persist to db: size = {}", size); } } @@ -721,7 +726,8 @@ public List getAssessmentGradingIds(String publishedItemId){ } catch(Exception e) { - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } } @@ -732,7 +738,8 @@ public AssessmentGradingData getHighestAssessmentGrading(String publishedAssessm } catch(Exception e) { - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } } @@ -750,7 +757,8 @@ public AssessmentGradingData getHighestSubmittedAssessmentGrading(String publish } catch(Exception e) { - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } return assessmentGrading; @@ -766,7 +774,8 @@ public Set getItemGradingSet(String assessmentGradingId){ getItemGradingSet(Long.valueOf(assessmentGradingId)); } catch(Exception e){ - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } } @@ -776,7 +785,8 @@ public HashMap getAssessmentGradingByItemGradingId(String publishedAssessmentId) getAssessmentGradingByItemGradingId(Long.valueOf(publishedAssessmentId)); } catch(Exception e){ - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } } @@ -812,10 +822,10 @@ public void updateItemScore(ItemGradingData gdata, double scoreDifference, Publi notifyGradebookByScoringType(adata, pub); } } catch (GradebookServiceException ge) { - ge.printStackTrace(); + log.error(ge.getMessage(), ge); throw ge; } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); throw new RuntimeException(e); } } @@ -911,7 +921,7 @@ public int compare(ItemGradingData o1, ItemGradingData o2) { //change algorithm based on each question (SAK-1930 & IM271559) -cwen HashMap totalItems = new HashMap(); - log.debug("****x2. "+(new Date()).getTime()); + log.debug("****x2. {}", (new Date()).getTime()); double autoScore = (double) 0; Long itemId = (long)0; int calcQuestionAnswerSequence = 1; // sequence of answers for CALCULATED_QUESTION @@ -932,7 +942,7 @@ public int compare(ItemGradingData o1, ItemGradingData o2) { ItemDataIfc item = (ItemDataIfc) publishedItemHash.get(itemId); if (item == null) { //this probably shouldn't happen - log.error("unable to retrive itemDataIfc for: " + publishedItemHash.get(itemId)); + log.error("unable to retrive itemDataIfc for: {}", publishedItemHash.get(itemId)); continue; } Iterator i = item.getItemMetaDataSet().iterator(); @@ -1015,7 +1025,7 @@ public int compare(ItemGradingData o1, ItemGradingData o2) { setIsLate(data, pub); } - log.debug("****x3. "+(new Date()).getTime()); + log.debug("****x3. {}", (new Date()).getTime()); List emiItemGradings = new ArrayList(); // the following procedure ensure total score awarded per question is no less than 0 @@ -1089,7 +1099,7 @@ public int compare(ItemGradingData o1, ItemGradingData o2) { } } - log.debug("****x3.1 "+(new Date()).getTime()); + log.debug("****x3.1 {}", (new Date()).getTime()); // Loop 1: this procedure ensure total score awarded per EMI item // is correct @@ -1129,7 +1139,7 @@ public int compare(ItemGradingData o1, ItemGradingData o2) { .get(itemGrading.getPublishedAnswerId()); if (score == null) { //its possible! SAM-2016 - log.warn("we can't find a score for answer: " + itemGrading.getPublishedAnswerId()); + log.warn("we can't find a score for answer: {}", itemGrading.getPublishedAnswerId()); continue; } itemGrading.setAutoScore(emiOrderedScoresMap @@ -1216,11 +1226,11 @@ public int compare(ItemGradingData o1, ItemGradingData o2) { } log.debug("****x6. "+(new Date()).getTime()); } catch (GradebookServiceException ge) { - ge.printStackTrace(); + log.error(ge.getMessage(), ge); throw ge; } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); throw new RuntimeException(e); } @@ -1232,12 +1242,12 @@ public int compare(ItemGradingData o1, ItemGradingData o2) { if (persistToDB) { data.setItemGradingSet(new HashSet()); saveOrUpdateAssessmentGrading(data); - log.debug("****x7. "+(new Date()).getTime()); + log.debug("****x7. {}", (new Date()).getTime()); if (!regrade) { notifyGradebookByScoringType(data, pub); } } - log.debug("****x8. "+(new Date()).getTime()); + log.debug("****x8. {}", (new Date()).getTime()); // I am not quite sure what the following code is doing... I modified this based on my assumption: // If this happens dring regrade, we don't want to clean these data up @@ -1542,7 +1552,7 @@ public void notifyGradebook(AssessmentGradingData data, PublishedAssessmentIfc p retryCount = 0; } catch (org.sakaiproject.service.gradebook.shared.AssessmentNotFoundException ante) { - log.warn("problem sending grades to gradebook: " + ante.getMessage()); + log.warn("problem sending grades to gradebook: {}", ante.getMessage()); if (AssessmentIfc.RETRACT_FOR_EDIT_STATUS.equals(pub.getStatus())) { retryCount = retry(retryCount, ante, pub, true); } @@ -1569,10 +1579,10 @@ public void notifyGradebook(AssessmentGradingData data, PublishedAssessmentIfc p gbsHelper.updateExternalAssessmentComment(publishedAssessmentId, agent, comment, g); } catch (Exception ex) { - log.warn("Error sending comments to gradebook: " + ex.getMessage()); + log.warn("Error sending comments to gradebook: {}", ex.getMessage()); } } else { - if(log.isDebugEnabled()) log.debug("Not updating the gradebook. toGradebook = " + toGradebook); + log.debug("Not updating the gradebook. toGradebook = {}", toGradebook); } } @@ -2250,7 +2260,7 @@ public void deleteAll(Collection c) PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().deleteAll(c); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } } @@ -2281,10 +2291,10 @@ public void updateAssessmentGradingScore(AssessmentGradingData adata, PublishedA notifyGradebookByScoringType(adata, pub); } } catch (GradebookServiceException ge) { - ge.printStackTrace(); + log.error(ge.getMessage(), ge); throw ge; } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); throw new RuntimeException(e); } } @@ -2295,7 +2305,7 @@ public void saveOrUpdateAll(Collection c) PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().saveOrUpdateAll(c); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } } @@ -2305,7 +2315,7 @@ public PublishedAssessmentIfc getPublishedAssessmentByAssessmentGradingId(String pub = PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().getPublishedAssessmentByAssessmentGradingId(Long.valueOf(id)); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return pub; } @@ -2316,7 +2326,7 @@ public PublishedAssessmentIfc getPublishedAssessmentByPublishedItemId(String pub pub = PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().getPublishedAssessmentByPublishedItemId(Long.valueOf(publishedItemId)); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return pub; } @@ -2327,7 +2337,7 @@ public ArrayList getLastItemGradingDataPosition(Long assessmentGradingId, String results = PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().getLastItemGradingDataPosition(assessmentGradingId, agentId); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return results; } @@ -2337,7 +2347,7 @@ public List getItemGradingIds(Long assessmentGradingId) { try { results = PersistenceService.getInstance().getAssessmentGradingFacadeQueries().getItemGradingIds(assessmentGradingId); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return results; } @@ -2348,7 +2358,7 @@ public List getPublishedItemIds(Long assessmentGradingId) { results = PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().getPublishedItemIds(assessmentGradingId); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return results; } @@ -2359,7 +2369,7 @@ public HashSet getItemSet(Long publishedAssessmentId, Long sectionId) { results = PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().getItemSet(publishedAssessmentId, sectionId); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return results; } @@ -2370,7 +2380,7 @@ public Long getTypeId(Long itemGradingId) { typeId = PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().getTypeId(itemGradingId); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return typeId; } @@ -2421,7 +2431,7 @@ public List getAllAssessmentGradingByAgentId(Long publishedAssessmentId, String results = PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().getAllAssessmentGradingByAgentId(publishedAssessmentId, agentIdString); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return results; } @@ -2439,7 +2449,7 @@ public HashMap getSiteSubmissionCountHash(String siteId) { results = PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().getSiteSubmissionCountHash(siteId); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return results; } @@ -2450,7 +2460,7 @@ public HashMap getSiteInProgressCountHash(final String siteId) { results = PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().getSiteInProgressCountHash(siteId); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return results; } @@ -2461,7 +2471,7 @@ public int getActualNumberRetake(Long publishedAssessmentId, String agentIdStrin actualNumberReatke = PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().getActualNumberRetake(publishedAssessmentId, agentIdString); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return actualNumberReatke; } @@ -2472,7 +2482,7 @@ public HashMap getActualNumberRetakeHash(String agentIdString) { actualNumberReatkeHash = PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().getActualNumberRetakeHash(agentIdString); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return actualNumberReatkeHash; } @@ -2483,7 +2493,7 @@ public HashMap getSiteActualNumberRetakeHash(String siteIdString) { numberRetakeHash = PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().getSiteActualNumberRetakeHash(siteIdString); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return numberRetakeHash; } @@ -2494,7 +2504,7 @@ public List getStudentGradingSummaryData(Long publishedAssessmentId, String agen results = PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().getStudentGradingSummaryData(publishedAssessmentId, agentIdString); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return results; } @@ -2506,7 +2516,7 @@ public int getNumberRetake(Long publishedAssessmentId, String agentIdString) { numberRetake = PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().getNumberRetake(publishedAssessmentId, agentIdString); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return numberRetake; } @@ -2517,7 +2527,7 @@ public HashMap getNumberRetakeHash(String agentIdString) { numberRetakeHash = PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().getNumberRetakeHash(agentIdString); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return numberRetakeHash; } @@ -2528,7 +2538,7 @@ public HashMap getSiteNumberRetakeHash(String siteIdString) { siteActualNumberRetakeList = PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().getSiteNumberRetakeHash(siteIdString); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return siteActualNumberRetakeList; } @@ -2537,7 +2547,7 @@ public void saveStudentGradingSummaryData(StudentGradingSummaryIfc studentGradin try { PersistenceService.getInstance().getAssessmentGradingFacadeQueries().saveStudentGradingSummaryData(studentGradingSummaryData); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } } @@ -2548,7 +2558,7 @@ public int getLateSubmissionsNumberByAgentId(Long publishedAssessmentId, String numberRetake = PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().getLateSubmissionsNumberByAgentId(publishedAssessmentId, agentIdString, dueDate); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return numberRetake; } @@ -2577,7 +2587,7 @@ public List getExportResponsesData(String publishedAssessmentId, boolean anonymo list = PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().getExportResponsesData(publishedAssessmentId, anonymous,audioMessage, fileUploadMessage, noSubmissionMessage, showPartAndTotalScoreSpreadsheetColumns, poolString, partString, questionString, textString, rationaleString, itemGradingCommentsString, useridMap, responseCommentString); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return list; } @@ -2587,7 +2597,7 @@ private void removeUnsubmittedAssessmentGradingData(AssessmentGradingData data){ PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().removeUnsubmittedAssessmentGradingData(data); } catch (Exception e) { - //e.printStackTrace(); + //log.error(e.getMessage(), e); log.error("Exception thrown from removeUnsubmittedAssessmentGradingData" + e.getMessage()); } } @@ -2598,7 +2608,7 @@ public boolean getHasGradingData(Long publishedAssessmentId) { hasGradingData = PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().getHasGradingData(publishedAssessmentId); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return hasGradingData; } @@ -3289,7 +3299,7 @@ public ArrayList getHasGradingDataAndHasSubmission(Long publishedAssessmentId) { al = PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().getHasGradingDataAndHasSubmission(publishedAssessmentId); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return al; } @@ -3300,7 +3310,7 @@ public String getFileName(Long itemGradingId, String agentId, String filename) { name = PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().getFilename(itemGradingId, agentId, filename); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return name; } @@ -3311,7 +3321,7 @@ public List getUpdatedAssessmentList(String agentId, String siteId) { list = PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().getUpdatedAssessmentList(agentId, siteId); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return list; } @@ -3322,7 +3332,7 @@ public List getSiteNeedResubmitList(String siteId) { list = PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().getSiteNeedResubmitList(siteId); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return list; } @@ -3332,7 +3342,7 @@ public void autoSubmitAssessments() { PersistenceService.getInstance(). getAssessmentGradingFacadeQueries().autoSubmitAssessments(); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } } @@ -3345,7 +3355,7 @@ public ItemGradingAttachment createItemGradingAttachment( getAssessmentGradingFacadeQueries().createItemGradingtAttachment(itemGrading, resourceId, filename, protocol); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return attachment; } @@ -3359,7 +3369,7 @@ public AssessmentGradingAttachment createAssessmentGradingAttachment( getAssessmentGradingFacadeQueries().createAssessmentGradingtAttachment(assessmentGrading, resourceId, filename, protocol); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return attachment; } diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/ItemService.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/ItemService.java index dabd337bcb85..cc3704d97212 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/ItemService.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/ItemService.java @@ -27,8 +27,8 @@ import java.util.Iterator; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.content.api.ContentResource; import org.sakaiproject.tool.assessment.data.dao.assessment.Answer; import org.sakaiproject.tool.assessment.data.dao.assessment.AnswerFeedback; @@ -51,7 +51,7 @@ */ public class ItemService { - private Log log = LogFactory.getLog(ItemService.class); + private Logger log = LoggerFactory.getLogger(ItemService.class); /** * Creates a new ItemService object. @@ -79,7 +79,8 @@ public ItemFacade getItem(Long itemId, String agentId) } catch(Exception e) { - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } return item; @@ -105,7 +106,8 @@ public void deleteItem(Long itemId, String agentId) } catch(Exception e) { - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } } @@ -130,7 +132,8 @@ public void deleteItemContent(Long itemId, String agentId) } catch(Exception e) { - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } } @@ -156,7 +159,8 @@ public void deleteItemMetaData(Long itemId, String label, String agentId) } catch(Exception e) { - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } } @@ -181,7 +185,8 @@ public void addItemMetaData(Long itemId, String label, String value, String agen } catch(Exception e) { - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } } @@ -199,7 +204,7 @@ public ItemFacade saveItem(ItemFacade item) } catch(Exception e) { - log.error(e); + log.error(e.getMessage(), e); return item; } @@ -217,7 +222,8 @@ public ItemFacade getItem(String itemId) { } catch(Exception e) { - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } } @@ -237,7 +243,7 @@ public Long getItemTextId(Long publishedItemId) { } catch(Exception e) { - log.error(e); + log.error(e.getMessage(), e); return -1l; } } @@ -384,7 +390,8 @@ public void deleteSet(Set s) } catch(Exception e) { - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } } @@ -399,7 +406,8 @@ public void saveFavoriteColumnChoices(FavoriteColChoices choices) } catch(Exception e) { - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } } } diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/PersistenceHelper.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/PersistenceHelper.java index 4ac31e35e7b9..0b32a1e0d090 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/PersistenceHelper.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/PersistenceHelper.java @@ -21,8 +21,8 @@ package org.sakaiproject.tool.assessment.services; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Utility methods for helping with persistence @@ -31,7 +31,7 @@ */ public class PersistenceHelper { - private Log log = LogFactory.getLog(PersistenceHelper.class); + private Logger log = LoggerFactory.getLogger(PersistenceHelper.class); private Integer deadlockInterval; // in ms diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/PersistenceService.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/PersistenceService.java index df7918d1b96a..eafc00623f58 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/PersistenceService.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/PersistenceService.java @@ -22,8 +22,8 @@ package org.sakaiproject.tool.assessment.services; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.section.api.SectionAwareness; import org.sakaiproject.tool.assessment.facade.AssessmentFacadeQueriesAPI; @@ -49,7 +49,7 @@ */ public class PersistenceService{ - private Log log = LogFactory.getLog(PersistenceService.class); + private Logger log = LoggerFactory.getLogger(PersistenceService.class); private QuestionPoolFacadeQueriesAPI questionPoolFacadeQueries; private TypeFacadeQueriesAPI typeFacadeQueries; private SectionFacadeQueriesAPI sectionFacadeQueries; diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/PublishedItemService.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/PublishedItemService.java index b6b486a459cc..1bb359ab21dc 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/PublishedItemService.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/PublishedItemService.java @@ -1,63 +1,63 @@ -package org.sakaiproject.tool.assessment.services; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.sakaiproject.tool.assessment.facade.ItemFacade; -import org.sakaiproject.tool.assessment.facade.PublishedItemFacade; - -public class PublishedItemService extends ItemService { - private Log log = LogFactory.getLog(PublishedItemService.class); - - public ItemFacade getItem(Long itemId, String agentId) { - PublishedItemFacade item = null; - try { - item = PersistenceService.getInstance() - .getPublishedItemFacadeQueries().getItem(itemId, agentId); - } catch (Exception e) { - log.error(e); - throw new RuntimeException(e); - } - - return item; - } - - public ItemFacade getItem(String itemId) { - PublishedItemFacade item = null; - try { - item = PersistenceService.getInstance() - .getPublishedItemFacadeQueries().getItem(itemId); - } catch (Exception e) { - log.error(e); - throw new RuntimeException(e); - } - - return item; - } - - public void deleteItemContent(Long itemId, String agentId) { - try { - PersistenceService.getInstance().getPublishedItemFacadeQueries() - .deleteItemContent(itemId, agentId); - } catch (Exception e) { - log.error(e); - throw new RuntimeException(e); - } - } - - /** - * Save a question item. - */ - public ItemFacade saveItem(PublishedItemFacade item) - { - try - { - return PersistenceService.getInstance().getPublishedItemFacadeQueries().saveItem(item); - } - catch(Exception e) - { - log.error(e); - - return item; - } - } +package org.sakaiproject.tool.assessment.services; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sakaiproject.tool.assessment.facade.ItemFacade; +import org.sakaiproject.tool.assessment.facade.PublishedItemFacade; + +public class PublishedItemService extends ItemService { + private Logger log = LoggerFactory.getLogger(PublishedItemService.class); + + public ItemFacade getItem(Long itemId, String agentId) { + PublishedItemFacade item = null; + try { + item = PersistenceService.getInstance() + .getPublishedItemFacadeQueries().getItem(itemId, agentId); + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new RuntimeException(e); + } + + return item; + } + + public ItemFacade getItem(String itemId) { + PublishedItemFacade item = null; + try { + item = PersistenceService.getInstance() + .getPublishedItemFacadeQueries().getItem(itemId); + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new RuntimeException(e); + } + + return item; + } + + public void deleteItemContent(Long itemId, String agentId) { + try { + PersistenceService.getInstance().getPublishedItemFacadeQueries() + .deleteItemContent(itemId, agentId); + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new RuntimeException(e); + } + } + + /** + * Save a question item. + */ + public ItemFacade saveItem(PublishedItemFacade item) + { + try + { + return PersistenceService.getInstance().getPublishedItemFacadeQueries().saveItem(item); + } + catch(Exception e) + { + log.error(e.getMessage(), e); + + return item; + } + } } diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/QuestionPoolService.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/QuestionPoolService.java index a4d52052f6c6..3c21c03183e0 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/QuestionPoolService.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/QuestionPoolService.java @@ -27,8 +27,8 @@ import java.util.List; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroupService; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.tool.assessment.data.dao.questionpool.QuestionPoolItemData; @@ -49,7 +49,7 @@ */ public class QuestionPoolService { - private Log log = LogFactory.getLog(QuestionPoolService.class); + private Logger log = LoggerFactory.getLogger(QuestionPoolService.class); /** * Creates a new QuestionPoolService object. @@ -104,7 +104,8 @@ public QuestionPoolFacade getPool(Long poolId, String agentId) } catch(Exception e) { - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } return pool; @@ -124,7 +125,8 @@ public List getPoolIdsByItem(String itemId) } catch(Exception e) { - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } return idList; @@ -147,7 +149,7 @@ public boolean hasItem(String itemId, Long poolId) } catch(Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return found; @@ -165,7 +167,8 @@ public List getPoolIdsByAgent(String agentId) } catch(Exception e) { - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } return idList; @@ -185,7 +188,8 @@ public List getSubPools(Long poolId) } catch(Exception e) { - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } return poolList; @@ -205,7 +209,8 @@ public int getSubPoolSize(Long poolId) } catch(Exception e) { - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } return poolSize; } @@ -224,7 +229,8 @@ public boolean hasSubPools(Long poolId) } catch(Exception e) { - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } return result; @@ -265,7 +271,7 @@ else if ("keyword".equals(orderBy)) { results = new ArrayList(PersistenceService.getInstance().getQuestionPoolFacadeQueries().getAllItemFacadesOrderByItemType(poolId, orderBy, ascending)); } } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return results; } @@ -282,7 +288,7 @@ public ArrayList getAllItems(Long poolId) new ArrayList(PersistenceService.getInstance(). getQuestionPoolFacadeQueries().getAllItemFacades(poolId)); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return results; } @@ -300,7 +306,8 @@ public void addItemToPool(Long itemId, Long poolId) } catch(Exception e) { - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } } @@ -316,7 +323,8 @@ public void moveItemToPool(Long itemId, Long sourceId, Long destId) } catch(Exception e) { - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } } @@ -335,8 +343,7 @@ public boolean isDescendantOf(Long poolA,Long poolB, String agentId) return false; }catch(Exception e){ - e.printStackTrace(); - log.error(e); + log.error(e.getMessage(), e); return false; } } @@ -365,7 +372,8 @@ public void movePool(String agentId, Long sourceId, Long destId) } catch(Exception e) { - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } } @@ -388,7 +396,8 @@ public void deletePool(Long poolId, String agentId, Tree tree) } catch(Exception e) { - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } } @@ -404,7 +413,8 @@ public void removeQuestionFromPool(Long questionId, Long poolId) } catch(Exception e) { - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } } @@ -427,7 +437,8 @@ public void copyPool(Tree tree, String agentId, Long sourceId, } catch(Exception e) { - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } } @@ -444,7 +455,8 @@ public void copyQuestion( } catch(Exception e) { - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } } @@ -461,7 +473,8 @@ public void copyQuestion( } catch(Exception e) { - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } } @@ -474,8 +487,7 @@ public String exportQuestion(osid.shared.Id questionId) try{ return "";//questionPoolService.exportQuestion(questionId); }catch(Exception e){ - log.debug("Exception in exportQuestion"); - log.error(e); + log.error("Exception in exportQuestion", e); return null; } } @@ -491,8 +503,7 @@ public QuestionPoolFacade savePool(QuestionPoolFacade pool) } catch(Exception e) { - log.error(e); - + log.error(e.getMessage(), e); return pool; } } @@ -554,7 +565,7 @@ public void addQuestionPoolAccess(Tree tree, String user, Long questionPoolId, L PersistenceService.getInstance(). getQuestionPoolFacadeQueries().addQuestionPoolAccess(tree, user, questionPoolId, accessTypeId); } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); } } @@ -563,7 +574,7 @@ public void removeQuestionPoolAccess(Tree tree, String user, Long questionPoolId PersistenceService.getInstance(). getQuestionPoolFacadeQueries().removeQuestionPoolAccess(tree, user, questionPoolId, accessTypeId); } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); } } @@ -574,7 +585,7 @@ public List getAgentsWithAccess(Long questionPoolId) { agents = PersistenceService.getInstance(). getQuestionPoolFacadeQueries().getAgentsWithAccess(questionPoolId); } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); } return agents; @@ -603,7 +614,7 @@ public List getAgentsWithoutAccess(Long questionPoolId, String real agents.removeAll(agentsWithAccess); } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); } return agents; @@ -614,7 +625,7 @@ public void transferPoolsOwnership(String ownerId, List poolIds) { try { PersistenceService.getInstance().getQuestionPoolFacadeQueries().transferPoolsOwnership(ownerId, poolIds); } catch (Exception ex) { - log.error(ex); + log.error(ex.getMessage(), ex); throw new RuntimeException(ex); } } diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/SectionService.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/SectionService.java index 6e5955f5429d..4c04997871c7 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/SectionService.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/SectionService.java @@ -22,8 +22,8 @@ package org.sakaiproject.tool.assessment.services; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.facade.SectionFacade; @@ -33,7 +33,7 @@ */ public class SectionService { - private Log log = LogFactory.getLog(SectionService.class); + private Logger log = LoggerFactory.getLogger(SectionService.class); /** * Creates a new SectionService object. @@ -55,7 +55,8 @@ public SectionFacade getSection(Long secId, String agentId) } catch(Exception e) { - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } return section; diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/assessment/AssessmentEntityProducer.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/assessment/AssessmentEntityProducer.java index debbd8c88f58..6db21c9efbb1 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/assessment/AssessmentEntityProducer.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/assessment/AssessmentEntityProducer.java @@ -16,8 +16,8 @@ import java.util.Stack; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.SecurityAdvisor; import org.sakaiproject.authz.cover.SecurityService; import org.sakaiproject.content.api.ContentResource; @@ -54,7 +54,7 @@ public class AssessmentEntityProducer implements EntityTransferrer, private static final int QTI_VERSION = 1; private static final String ARCHIVED_ELEMENT = "assessment"; - private Log log = LogFactory.getLog(AssessmentEntityProducer.class); + private Logger log = LoggerFactory.getLogger(AssessmentEntityProducer.class); private QTIServiceAPI qtiService; public void init() { @@ -368,4 +368,4 @@ public void updateEntityReferences(String toContext, Map transve } } } -} \ No newline at end of file +} diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/assessment/AssessmentService.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/assessment/AssessmentService.java index 9c35555f55ca..cc09fe4f6fb1 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/assessment/AssessmentService.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/assessment/AssessmentService.java @@ -34,8 +34,8 @@ import java.util.Map; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.SecurityAdvisor; import org.sakaiproject.authz.api.SecurityAdvisor.SecurityAdvice; import org.sakaiproject.authz.cover.SecurityService; @@ -91,7 +91,7 @@ * @author Rachel Gollub */ public class AssessmentService { - private Log log = LogFactory.getLog(AssessmentService.class); + private Logger log = LoggerFactory.getLogger(AssessmentService.class); public static final int UPDATE_SUCCESS = 0; public static final int UPDATE_ERROR_DRAW_SIZE_TOO_LARGE = 1; @@ -109,7 +109,7 @@ public AssessmentTemplateFacade getAssessmentTemplate( .getAssessmentFacadeQueries().getAssessmentTemplate( new Long(assessmentTemplateId)); } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); throw new RuntimeException(e); } } @@ -120,7 +120,7 @@ public AssessmentFacade getAssessment(String assessmentId) { .getAssessmentFacadeQueries().getAssessment( Long.valueOf(assessmentId)); } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); throw new RuntimeException(e); } } @@ -130,7 +130,7 @@ public AssessmentIfc getAssessment(Long assessmentId) { return PersistenceService.getInstance() .getAssessmentFacadeQueries().getAssessment(assessmentId); } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); throw new RuntimeException(e); } } @@ -141,7 +141,7 @@ public AssessmentFacade getBasicInfoOfAnAssessment(String assessmentId) { .getAssessmentFacadeQueries().getBasicInfoOfAnAssessment( new Long(assessmentId)); } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); throw new RuntimeException(e); } } @@ -150,7 +150,7 @@ public AssessmentFacade getBasicInfoOfAnAssessmentFromSectionId(Long sectionId) try { return PersistenceService.getInstance().getAssessmentFacadeQueries().getBasicInfoOfAnAssessmentFromSectionId(sectionId); } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); throw new RuntimeException(e); } } @@ -160,7 +160,7 @@ public ArrayList getAllAssessmentTemplates() { return PersistenceService.getInstance() .getAssessmentFacadeQueries().getAllAssessmentTemplates(); } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); throw new RuntimeException(e); } } @@ -171,7 +171,7 @@ public ArrayList getAllActiveAssessmentTemplates() { .getAssessmentFacadeQueries() .getAllActiveAssessmentTemplates(); } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); throw new RuntimeException(e); } } @@ -182,7 +182,7 @@ public ArrayList getTitleOfAllActiveAssessmentTemplates() { .getAssessmentFacadeQueries() .getTitleOfAllActiveAssessmentTemplates(); } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); throw new RuntimeException(e); } } @@ -250,7 +250,7 @@ public ArrayList getAllAssessments(int pageSize, int pageNumber, .getAllAssessments(orderBy); } } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); throw new RuntimeException(e); } } @@ -281,7 +281,7 @@ public AssessmentFacade createAssessment(String title, String description, assessment = queries.createAssessment(title, description, typeIdLong, templateIdLong, siteId); } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); throw new Exception(e); } return assessment; @@ -344,7 +344,7 @@ public SectionFacade addSection(String assessmentId) { .getInstance().getAssessmentFacadeQueries(); section = queries.addSection(assessmentIdLong); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return section; } @@ -356,7 +356,7 @@ public void removeSection(String sectionId) { .getInstance().getAssessmentFacadeQueries(); queries.removeSection(sectionIdLong); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } } @@ -367,7 +367,7 @@ public SectionFacade getSection(String sectionId) { .getAssessmentFacadeQueries().getSection( new Long(sectionId)); } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); throw new RuntimeException(e); } } @@ -377,7 +377,7 @@ public void saveOrUpdateSection(SectionFacade section) { PersistenceService.getInstance().getAssessmentFacadeQueries() .saveOrUpdateSection(section); } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); throw new RuntimeException(e); } } @@ -602,7 +602,7 @@ public AssessmentFacade createAssessmentWithoutDefaultSection(String title, assessment = queries.createAssessmentWithoutDefaultSection(title, description, typeIdLong, templateIdLong, siteId); } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); throw new Exception(e); } return assessment; @@ -645,7 +645,7 @@ public ItemAttachmentIfc createItemAttachment(ItemDataIfc item, attachment = queries.createItemAttachment(item, resourceId, filename, protocol, isEditPendingAssessmentFlow); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return attachment; } @@ -670,7 +670,7 @@ public ItemTextAttachmentIfc createItemTextAttachment(ItemTextIfc itemText, attachment = queries.createItemTextAttachment(itemText, resourceId, filename, protocol, isEditPendingAssessmentFlow); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return attachment; } @@ -686,7 +686,7 @@ public void updateAssessmentLastModifiedInfo( PersistenceService.getInstance().getAssessmentFacadeQueries() .updateAssessmentLastModifiedInfo((AssessmentFacade) assessment); } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); throw new RuntimeException(e); } } @@ -700,7 +700,7 @@ public SectionAttachmentIfc createSectionAttachment(SectionDataIfc section, attachment = queries.createSectionAttachment(section, resourceId, filename, protocol); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return attachment; } @@ -720,7 +720,7 @@ public AssessmentAttachmentIfc createAssessmentAttachment( attachment = queries.createAssessmentAttachment(assessment, resourceId, filename, protocol); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return attachment; } @@ -739,7 +739,7 @@ public AttachmentData createEmailAttachment(String resourceId, attachment = queries.createEmailAttachment(resourceId, filename, protocol); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return attachment; } @@ -982,7 +982,7 @@ else if (INVALID_CHARS_IN_RESOURCE_ID.indexOf(c) >= 0 || ESCAPE_CHARS_IN_RESOURC } catch (Exception e) { - Log log = LogFactory.getLog(AssessmentService.class); + Logger log = LoggerFactory.getLogger(AssessmentService.class); log.warn("escapeResourceName: ", e); return id; } @@ -1018,7 +1018,7 @@ public void copyAssessment(String assessmentId, String apepndCopyTitle) { PersistenceService.getInstance().getAssessmentFacadeQueries() .copyAssessment(assessmentId, apepndCopyTitle); } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); throw new RuntimeException(e); } } @@ -1028,7 +1028,7 @@ public List getAllActiveAssessmentsbyAgent(String fromContext) { return PersistenceService.getInstance().getAssessmentFacadeQueries() .getAllActiveAssessmentsByAgent(fromContext); } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); throw new RuntimeException(e); } @@ -1059,7 +1059,7 @@ public List getFavoriteColChoicesbyAgent(String fromContext) { return PersistenceService.getInstance().getFavoriteColChoicesFacadeQueries() .getFavoriteColChoicesByAgent(fromContext); } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); throw new RuntimeException(e); } diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/assessment/EventLogService.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/assessment/EventLogService.java index 1df6786881ab..0f88e31c858e 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/assessment/EventLogService.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/assessment/EventLogService.java @@ -2,14 +2,14 @@ import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.dao.assessment.EventLogData; import org.sakaiproject.tool.assessment.facade.EventLogFacade; import org.sakaiproject.tool.assessment.services.PersistenceService; public class EventLogService{ - private Log log = LogFactory.getLog(EventLogService.class); + private Logger log = LoggerFactory.getLogger(EventLogService.class); public EventLogService() { } @@ -35,4 +35,4 @@ public List getEventLogData(Long assessmentGradingId) { public List getTitlesFromEventLogBySite(String siteId) { return PersistenceService.getInstance().getEventLogFacadeQueries().getTitlesFromEventLogBySite(siteId); } -} \ No newline at end of file +} diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/assessment/PublishedAssessmentService.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/assessment/PublishedAssessmentService.java index 81eb874752d0..83f86942025a 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/assessment/PublishedAssessmentService.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/assessment/PublishedAssessmentService.java @@ -30,8 +30,8 @@ import java.util.Map; import java.util.TreeMap; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.dao.assessment.AssessmentAccessControl; import org.sakaiproject.tool.assessment.data.dao.assessment.PublishedAssessmentData; import org.sakaiproject.tool.assessment.data.dao.assessment.PublishedAttachmentData; @@ -62,7 +62,7 @@ * @author Rachel Gollub */ public class PublishedAssessmentService extends AssessmentService{ - private Log log = LogFactory.getLog(PublishedAssessmentService.class); + private Logger log = LoggerFactory.getLogger(PublishedAssessmentService.class); /** * Creates a new QuestionPoolService object. @@ -179,7 +179,7 @@ public ArrayList getAllPublishedAssessments( } } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); throw new RuntimeException(e); } } @@ -195,7 +195,7 @@ public PublishedAssessmentFacade getPublishedAssessment(String assessmentId) { getPublishedAssessment(Long.valueOf(assessmentId)); } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); throw new RuntimeException(e); } } @@ -209,7 +209,7 @@ public PublishedAssessmentFacade getPublishedAssessmentQuick(String assessmentId return PersistenceService.getInstance().getPublishedAssessmentFacadeQueries() .getPublishedAssessmentQuick(Long.valueOf(assessmentId)); } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); throw new RuntimeException(e); } } @@ -221,7 +221,7 @@ public PublishedAssessmentFacade getPublishedAssessment(String assessmentId, boo getPublishedAssessment(Long.valueOf(assessmentId), withGroupsInfo); } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); throw new RuntimeException(e); } } @@ -231,7 +231,7 @@ public AssessmentIfc getAssessment(Long assessmentId) { return PersistenceService.getInstance() .getPublishedAssessmentFacadeQueries().getPublishedAssessment(assessmentId); } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); throw new RuntimeException(e); } } @@ -243,7 +243,7 @@ public Long getPublishedAssessmentId(String assessmentId) { getPublishedAssessmentId(new Long(assessmentId)); } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); throw new RuntimeException(e); } } @@ -263,7 +263,7 @@ public PublishedAssessmentFacade publishPreviewAssessment(AssessmentFacade publishPreviewAssessment(assessment); } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); throw new RuntimeException(e); } } @@ -279,7 +279,7 @@ public void saveAssessment(PublishedAssessmentFacade assessment) { saveOrUpdate(assessment); } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); } } @@ -312,7 +312,7 @@ public PublishedAssessmentFacade getSettingsOfPublishedAssessment(String getSettingsOfPublishedAssessment(new Long(assessmentId)); } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); throw new RuntimeException(e); } } @@ -324,7 +324,7 @@ public PublishedItemData loadPublishedItem(String itemId) { loadPublishedItem(new Long(itemId)); } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); throw new RuntimeException(e); } } @@ -336,7 +336,7 @@ public PublishedItemText loadPublishedItemText(String itemTextId) { loadPublishedItemText(new Long(itemTextId)); } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); throw new RuntimeException(e); } } @@ -722,7 +722,7 @@ public AssessmentAttachmentIfc createAssessmentAttachment( attachment = queries.createAssessmentAttachment(assessment, resourceId, filename, protocol); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return attachment; } @@ -741,7 +741,7 @@ public SectionAttachmentIfc createSectionAttachment(SectionDataIfc section, attachment = queries.createSectionAttachment(section, resourceId, filename, protocol); } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return attachment; } diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/gradebook/GradebookServiceHelper.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/gradebook/GradebookServiceHelper.java index 86a32c6c790f..8e004b6e88d7 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/gradebook/GradebookServiceHelper.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/gradebook/GradebookServiceHelper.java @@ -21,8 +21,8 @@ package org.sakaiproject.tool.assessment.services.gradebook; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.dao.assessment.PublishedAssessmentData; import org.sakaiproject.tool.assessment.data.dao.grading.AssessmentGradingData; @@ -33,7 +33,7 @@ */ public class GradebookServiceHelper { - private Log log = LogFactory.getLog(GradebookServiceHelper.class); + private Logger log = LoggerFactory.getLogger(GradebookServiceHelper.class); public static boolean addToGradebook(PublishedAssessmentData publishedAssessment) throws Exception { return false; diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/shared/MediaService.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/shared/MediaService.java index e295d23dd676..c75249379a01 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/shared/MediaService.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/shared/MediaService.java @@ -22,8 +22,8 @@ package org.sakaiproject.tool.assessment.services.shared; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.services.PersistenceService; @@ -35,7 +35,7 @@ */ public class MediaService { - private Log log = LogFactory.getLog(MediaService.class); + private Logger log = LoggerFactory.getLogger(MediaService.class); /** * Creates a new QuestionPoolService object. diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/shared/TypeService.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/shared/TypeService.java index 5736ac454862..ff783d9ee5cd 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/shared/TypeService.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/shared/TypeService.java @@ -24,8 +24,8 @@ import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.facade.TypeFacade; import org.sakaiproject.tool.assessment.services.PersistenceService; @@ -38,7 +38,7 @@ */ public class TypeService { - private Log log = LogFactory.getLog(TypeService.class); + private Logger log = LoggerFactory.getLogger(TypeService.class); /** * Creates a new QuestionPoolService object. @@ -54,7 +54,8 @@ public TypeFacade getTypeById(String typeId) } catch(Exception e) { - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } } @@ -66,7 +67,8 @@ public List getFacadeListByAuthorityDomain(String authority, String domain) } catch(Exception e) { - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } } @@ -78,7 +80,8 @@ public List getListByAuthorityDomain(String authority, String domain) } catch(Exception e) { - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } } @@ -89,7 +92,8 @@ public List getFacadeItemTypes() { } catch(Exception e) { - log.error(e); throw new RuntimeException(e); + log.error(e.getMessage(), e); + throw new RuntimeException(e); } } } diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/assessment/AssessmentServiceImpl.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/assessment/AssessmentServiceImpl.java index 180483cdc813..b9181df13fd9 100755 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/assessment/AssessmentServiceImpl.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/assessment/AssessmentServiceImpl.java @@ -23,8 +23,8 @@ import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.dao.assessment.AssessmentTemplateData; import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentIfc; @@ -43,7 +43,7 @@ */ public class AssessmentServiceImpl implements AssessmentServiceAPI { - private Log log = LogFactory.getLog(AssessmentServiceImpl.class); + private Logger log = LoggerFactory.getLogger(AssessmentServiceImpl.class); /** * Get assessment template from id string. diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/assessment/ItemServiceImpl.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/assessment/ItemServiceImpl.java index 804b9cf53617..8169dd0a09a7 100755 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/assessment/ItemServiceImpl.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/assessment/ItemServiceImpl.java @@ -24,8 +24,8 @@ import java.util.HashMap; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.ifc.assessment.ItemDataIfc; import org.sakaiproject.tool.assessment.facade.ItemFacade; @@ -44,7 +44,7 @@ public class ItemServiceImpl implements ItemServiceAPI { - private Log log = LogFactory.getLog(ItemServiceImpl.class); + private Logger log = LoggerFactory.getLogger(ItemServiceImpl.class); /** * Get a particular item. diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/assessment/PublishedAssessmentServiceImpl.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/assessment/PublishedAssessmentServiceImpl.java index ed4615059acb..8c689dc37e34 100755 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/assessment/PublishedAssessmentServiceImpl.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/assessment/PublishedAssessmentServiceImpl.java @@ -24,8 +24,8 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentIfc; import org.sakaiproject.tool.assessment.data.ifc.assessment.ItemDataIfc; @@ -56,7 +56,7 @@ */ public class PublishedAssessmentServiceImpl implements PublishedAssessmentServiceAPI { - private Log log = LogFactory.getLog(PublishedAssessmentServiceImpl.class); + private Logger log = LoggerFactory.getLogger(PublishedAssessmentServiceImpl.class); /** * Get list of all active published assessments with basic info populated. diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/assessment/SectionServiceImpl.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/assessment/SectionServiceImpl.java index ee5f72a61521..1f69312d39a0 100755 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/assessment/SectionServiceImpl.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/assessment/SectionServiceImpl.java @@ -21,8 +21,8 @@ package org.sakaiproject.tool.assessment.shared.impl.assessment; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.ifc.assessment.SectionDataIfc; import org.sakaiproject.tool.assessment.facade.SectionFacade; @@ -37,7 +37,7 @@ */ public class SectionServiceImpl implements SectionServiceAPI { - private Log log = LogFactory.getLog(SectionServiceImpl.class); + private Logger log = LoggerFactory.getLogger(SectionServiceImpl.class); public SectionServiceImpl() { } diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/assessment/SecureDeliveryServiceImpl.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/assessment/SecureDeliveryServiceImpl.java index 6052c8e66974..5006c147e6a5 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/assessment/SecureDeliveryServiceImpl.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/assessment/SecureDeliveryServiceImpl.java @@ -11,8 +11,8 @@ import javax.servlet.http.HttpServletRequest; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.tool.assessment.data.ifc.assessment.PublishedAssessmentIfc; import org.sakaiproject.tool.assessment.data.ifc.assessment.RegisteredSecureDeliveryModuleIfc; @@ -29,7 +29,7 @@ */ public class SecureDeliveryServiceImpl implements SecureDeliveryServiceAPI { - private Log log = LogFactory.getLog( SecureDeliveryServiceImpl.class ); + private Logger log = LoggerFactory.getLogger( SecureDeliveryServiceImpl.class ); /* * Implementation of the SecureDeliveryModuleIfc interface with name,id ordering, except for id=NONE_ID diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/common/MediaServiceImpl.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/common/MediaServiceImpl.java index a2a3221fe7a9..936044fe8e3c 100755 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/common/MediaServiceImpl.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/common/MediaServiceImpl.java @@ -22,8 +22,8 @@ package org.sakaiproject.tool.assessment.shared.impl.common; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.services.shared.MediaService; import org.sakaiproject.tool.assessment.services.CommonServiceException; @@ -36,7 +36,7 @@ */ public class MediaServiceImpl implements MediaServiceAPI { - private Log log = LogFactory.getLog(MediaServiceImpl.class); + private Logger log = LoggerFactory.getLogger(MediaServiceImpl.class); public void remove(String mediaId) { diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/common/TypeServiceImpl.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/common/TypeServiceImpl.java index 1fc7ee3f97bc..94fd24a3cccb 100755 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/common/TypeServiceImpl.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/common/TypeServiceImpl.java @@ -24,8 +24,8 @@ import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.ifc.shared.TypeIfc; import org.sakaiproject.tool.assessment.services.shared.TypeService; @@ -39,7 +39,7 @@ */ public class TypeServiceImpl implements TypeServiceAPI { - private Log log = LogFactory.getLog(TypeServiceImpl.class); + private Logger log = LoggerFactory.getLogger(TypeServiceImpl.class); /** * Get type for id diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/grading/GradebookServiceImpl.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/grading/GradebookServiceImpl.java index 0bb7166ef857..dcdbdcd5a016 100755 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/grading/GradebookServiceImpl.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/grading/GradebookServiceImpl.java @@ -41,7 +41,7 @@ */ public class GradebookServiceImpl implements GradebookServiceAPI { - //private Log log = LogFactory.getLog(GradebookServiceImpl.class); + //private Logger log = LoggerFactory.getLogger(GradebookServiceImpl.class); public boolean isAssignmentDefined(String assessmentTitle) diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/grading/GradingServiceImpl.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/grading/GradingServiceImpl.java index 5710f214323e..c9790140eb24 100755 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/grading/GradingServiceImpl.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/grading/GradingServiceImpl.java @@ -26,8 +26,8 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.assessment.data.dao.grading.AssessmentGradingData; import org.sakaiproject.tool.assessment.data.dao.grading.ItemGradingData; import org.sakaiproject.tool.assessment.data.dao.grading.MediaData; @@ -44,7 +44,7 @@ public class GradingServiceImpl implements GradingServiceAPI { - private Log log = LogFactory.getLog(GradingServiceImpl.class); + private Logger log = LoggerFactory.getLogger(GradingServiceImpl.class); /** * Get all scores for a published assessment from the back end. diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/questionpool/QuestionPoolServiceImpl.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/questionpool/QuestionPoolServiceImpl.java index e40202268aa3..f20138a2e670 100755 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/questionpool/QuestionPoolServiceImpl.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/questionpool/QuestionPoolServiceImpl.java @@ -30,8 +30,8 @@ import java.util.Iterator; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.osid.shared.SharedException; import org.sakaiproject.tool.assessment.data.ifc.questionpool.QuestionPoolDataIfc; @@ -66,7 +66,7 @@ public class QuestionPoolServiceImpl implements QuestionPoolServiceAPI { - private Log log = LogFactory.getLog(QuestionPoolServiceImpl.class); + private Logger log = LoggerFactory.getLogger(QuestionPoolServiceImpl.class); /** * Creates a new QuestionPoolServiceImpl object. diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/util/MediaContentConverter.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/util/MediaContentConverter.java index 939644489ddc..5902f8f443d3 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/util/MediaContentConverter.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/util/MediaContentConverter.java @@ -20,8 +20,8 @@ import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.tool.assessment.data.dao.grading.MediaData; @@ -47,7 +47,7 @@ public class MediaContentConverter { private int recordsNotMarked = 0; private int recordsInError = 0; - Log log = LogFactory.getLog(MediaContentConverter.class); + Logger log = LoggerFactory.getLogger(MediaContentConverter.class); public void init() { boolean convertMedia = ServerConfigurationService.getBoolean(CONVERT_MEDIA_PROP, false); diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/util/MimeType.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/util/MimeType.java index 00ffaa189a81..060bb8c38aed 100755 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/util/MimeType.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/util/MimeType.java @@ -23,8 +23,8 @@ package org.sakaiproject.tool.assessment.util; import java.util.HashMap; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * In memory mime type lookup utility class. @@ -45,7 +45,7 @@ public class MimeType { */ public static void main(String[] args) { - Log log = LogFactory.getLog(MimeType.class); + Logger log = LoggerFactory.getLogger(MimeType.class); log.info("mime for BMP= " + get("BMP")); log.info("mime for .zip= " + get(".zip")); log.info("mime for .HTM= " + get (".HTM")); diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/util/TextFormat.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/util/TextFormat.java index 0dc6d8c10b0e..0862b42b71a8 100755 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/util/TextFormat.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/util/TextFormat.java @@ -28,8 +28,8 @@ import java.util.Iterator; import java.util.Vector; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** *

Copyright: Copyright (c) 2003-5

@@ -40,7 +40,7 @@ */ public class TextFormat { - private Log log = LogFactory.getLog(TextFormat.class); + private Logger log = LoggerFactory.getLogger(TextFormat.class); private static final String HTML; private static final String SMART; private static final String PLAIN; @@ -317,7 +317,7 @@ public int minimum(ArrayList a) return min; } - public static String convertPlaintextToFormattedTextNoHighUnicode(Log log, String value) { + public static String convertPlaintextToFormattedTextNoHighUnicode(Logger log, String value) { if (value == null) return ""; try @@ -374,7 +374,7 @@ public static String convertPlaintextToFormattedTextNoHighUnicode(Log log, Strin } catch (Exception e) { - log.warn("convertPlaintextToFormattedTextNoHighUnicode: ", e); + log.warn("convertPlaintextToFormattedTextNoHighUnicode: {}", e.getMessage()); return ""; } diff --git a/samigo/samlite-impl/src/java/org/sakaiproject/tool/assessment/samlite/impl/SamLiteServiceImpl.java b/samigo/samlite-impl/src/java/org/sakaiproject/tool/assessment/samlite/impl/SamLiteServiceImpl.java index f1281bfc92ce..a357797a3bfa 100644 --- a/samigo/samlite-impl/src/java/org/sakaiproject/tool/assessment/samlite/impl/SamLiteServiceImpl.java +++ b/samigo/samlite-impl/src/java/org/sakaiproject/tool/assessment/samlite/impl/SamLiteServiceImpl.java @@ -14,8 +14,8 @@ import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.xmlbeans.XmlOptions; import org.imsglobal.xsd.imsQtiasiv1P2.AssessfeedbackType; import org.imsglobal.xsd.imsQtiasiv1P2.AssessmentType; @@ -64,7 +64,7 @@ import org.sakaiproject.util.ResourceLoader; public class SamLiteServiceImpl implements SamLiteService { - private static Log log = LogFactory.getLog(SamLiteServiceImpl.class); + private static Logger log = LoggerFactory.getLogger(SamLiteServiceImpl.class); public static final String DEFAULT_CHARSET = "UTF-8"; private static ResourceLoader rb = new ResourceLoader("org.sakaiproject.tool.assessment.bundle.SamLitePatternMessages"); diff --git a/search/elasticsearch/impl/src/java/org/sakaiproject/search/elasticsearch/ElasticSearchIndexBuilder.java b/search/elasticsearch/impl/src/java/org/sakaiproject/search/elasticsearch/ElasticSearchIndexBuilder.java index 0a55cb481a17..62f2c2537149 100644 --- a/search/elasticsearch/impl/src/java/org/sakaiproject/search/elasticsearch/ElasticSearchIndexBuilder.java +++ b/search/elasticsearch/impl/src/java/org/sakaiproject/search/elasticsearch/ElasticSearchIndexBuilder.java @@ -23,8 +23,8 @@ import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.elasticsearch.action.admin.indices.create.CreateIndexRequest; import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest; @@ -78,7 +78,7 @@ public class ElasticSearchIndexBuilder implements SearchIndexBuilder { - private static Log log = LogFactory.getLog(ElasticSearchIndexBuilder.class); + private static Logger log = LoggerFactory.getLogger(ElasticSearchIndexBuilder.class); public static final String SEARCH_TOOL_ID = "sakai.search"; private final static SecurityAdvisor allowAllAdvisor; diff --git a/search/elasticsearch/impl/src/java/org/sakaiproject/search/elasticsearch/ElasticSearchList.java b/search/elasticsearch/impl/src/java/org/sakaiproject/search/elasticsearch/ElasticSearchList.java index 10b42a54c3b0..f80296e731ce 100644 --- a/search/elasticsearch/impl/src/java/org/sakaiproject/search/elasticsearch/ElasticSearchList.java +++ b/search/elasticsearch/impl/src/java/org/sakaiproject/search/elasticsearch/ElasticSearchList.java @@ -1,8 +1,8 @@ package org.sakaiproject.search.elasticsearch; import com.google.common.collect.ForwardingList; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.facet.terms.InternalTermsFacet; @@ -19,7 +19,7 @@ * To change this template use File | Settings | File Templates. */ public class ElasticSearchList extends ForwardingList implements SearchList { - private static final Log log = LogFactory.getLog(ElasticSearchList.class); + private static final Logger log = LoggerFactory.getLogger(ElasticSearchList.class); private final List results; private final SearchResponse response; private final SearchItemFilter filter; @@ -82,4 +82,4 @@ public int getStart() { protected List delegate() { return Collections.unmodifiableList(results); } -} \ No newline at end of file +} diff --git a/search/elasticsearch/impl/src/java/org/sakaiproject/search/elasticsearch/ElasticSearchResult.java b/search/elasticsearch/impl/src/java/org/sakaiproject/search/elasticsearch/ElasticSearchResult.java index bdbace05942e..0c7da024600a 100644 --- a/search/elasticsearch/impl/src/java/org/sakaiproject/search/elasticsearch/ElasticSearchResult.java +++ b/search/elasticsearch/impl/src/java/org/sakaiproject/search/elasticsearch/ElasticSearchResult.java @@ -2,8 +2,8 @@ import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang.StringEscapeUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.core.StopAnalyzer; import org.apache.lucene.analysis.TokenStream; @@ -31,7 +31,7 @@ * To change this template use File | Settings | File Templates. */ public class ElasticSearchResult implements SearchResult { - private static final Log log = LogFactory.getLog(ElasticSearchResult.class); + private static final Logger log = LoggerFactory.getLogger(ElasticSearchResult.class); private int index; private SearchHit hit; private String newUrl; diff --git a/search/elasticsearch/impl/src/java/org/sakaiproject/search/elasticsearch/ElasticSearchService.java b/search/elasticsearch/impl/src/java/org/sakaiproject/search/elasticsearch/ElasticSearchService.java index 06db20abfefa..7b85f6a8b91b 100644 --- a/search/elasticsearch/impl/src/java/org/sakaiproject/search/elasticsearch/ElasticSearchService.java +++ b/search/elasticsearch/impl/src/java/org/sakaiproject/search/elasticsearch/ElasticSearchService.java @@ -1,8 +1,8 @@ package org.sakaiproject.search.elasticsearch; import org.apache.commons.lang.StringEscapeUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.elasticsearch.action.admin.cluster.node.info.NodeInfo; import org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest; import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse; @@ -72,7 +72,7 @@ *

*/ public class ElasticSearchService implements SearchService { - private static final Log log = LogFactory.getLog(ElasticSearchService.class); + private static final Logger log = LoggerFactory.getLogger(ElasticSearchService.class); /* constant config */ public static final String CONFIG_PROPERTY_PREFIX = "elasticsearch."; diff --git a/search/elasticsearch/impl/src/java/org/sakaiproject/search/elasticsearch/RebuildSiteTask.java b/search/elasticsearch/impl/src/java/org/sakaiproject/search/elasticsearch/RebuildSiteTask.java index a7ad746fb475..281fc797c7a5 100644 --- a/search/elasticsearch/impl/src/java/org/sakaiproject/search/elasticsearch/RebuildSiteTask.java +++ b/search/elasticsearch/impl/src/java/org/sakaiproject/search/elasticsearch/RebuildSiteTask.java @@ -1,7 +1,7 @@ package org.sakaiproject.search.elasticsearch; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.search.api.EntityContentProducer; import java.util.Iterator; @@ -10,7 +10,7 @@ public class RebuildSiteTask extends TimerTask { private final ElasticSearchIndexBuilder elasticSearchIndexBuilder; private final String siteId; - private static Log log = LogFactory.getLog(RebuildSiteTask.class); + private static Logger log = LoggerFactory.getLogger(RebuildSiteTask.class); public RebuildSiteTask(ElasticSearchIndexBuilder elasticSearchIndexBuilder, String siteId) { this.elasticSearchIndexBuilder = elasticSearchIndexBuilder; @@ -52,4 +52,4 @@ public void run() { } -} \ No newline at end of file +} diff --git a/search/elasticsearch/impl/src/java/org/sakaiproject/search/elasticsearch/filter/impl/SearchSecurityFilter.java b/search/elasticsearch/impl/src/java/org/sakaiproject/search/elasticsearch/filter/impl/SearchSecurityFilter.java index ef5bfc030851..f96dd4005985 100644 --- a/search/elasticsearch/impl/src/java/org/sakaiproject/search/elasticsearch/filter/impl/SearchSecurityFilter.java +++ b/search/elasticsearch/impl/src/java/org/sakaiproject/search/elasticsearch/filter/impl/SearchSecurityFilter.java @@ -21,8 +21,8 @@ package org.sakaiproject.search.elasticsearch.filter.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ComponentManager; import org.sakaiproject.entity.api.EntityManager; import org.sakaiproject.search.api.EntityContentProducer; @@ -43,8 +43,7 @@ public class SearchSecurityFilter implements SearchItemFilter { - private static final Log log = LogFactory - .getLog(SearchSecurityFilter.class); + private static final Logger log = LoggerFactory.getLogger(SearchSecurityFilter.class); private SearchIndexBuilder searchIndexBuilder = null; diff --git a/search/search-impl/impl/src/java/org/sakaiproject/search/adapter/SearchIndexBuilderAdapter.java b/search/search-impl/impl/src/java/org/sakaiproject/search/adapter/SearchIndexBuilderAdapter.java index 978c6fe9cef4..2a8cb9e3f0d2 100644 --- a/search/search-impl/impl/src/java/org/sakaiproject/search/adapter/SearchIndexBuilderAdapter.java +++ b/search/search-impl/impl/src/java/org/sakaiproject/search/adapter/SearchIndexBuilderAdapter.java @@ -1,7 +1,7 @@ package org.sakaiproject.search.adapter; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.event.api.Event; @@ -19,7 +19,7 @@ * @author Colin Hebert */ public class SearchIndexBuilderAdapter implements SearchIndexBuilder { - private static Log log = LogFactory.getLog(SearchIndexBuilderAdapter.class); + private static Logger log = LoggerFactory.getLogger(SearchIndexBuilderAdapter.class); private static final String SEARCH_BUILDER_IMPL_PROPERTY = "search.indexbuilder.impl"; /** * Defaults to the elastic search implementation if nothing was provided. diff --git a/search/search-impl/impl/src/java/org/sakaiproject/search/adapter/SearchServiceAdapter.java b/search/search-impl/impl/src/java/org/sakaiproject/search/adapter/SearchServiceAdapter.java index 0af68e2908f3..df85b60da258 100644 --- a/search/search-impl/impl/src/java/org/sakaiproject/search/adapter/SearchServiceAdapter.java +++ b/search/search-impl/impl/src/java/org/sakaiproject/search/adapter/SearchServiceAdapter.java @@ -1,7 +1,7 @@ package org.sakaiproject.search.adapter; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.search.api.*; @@ -19,7 +19,7 @@ * @author Colin Hebert */ public class SearchServiceAdapter implements SearchService { - private static Log log = LogFactory.getLog(SearchServiceAdapter.class); + private static Logger log = LoggerFactory.getLogger(SearchServiceAdapter.class); private static final String SEARCH_IMPL_PROPERTY = "search.service.impl"; /** * Defaults to the elastic search implementation if nothing was provided. diff --git a/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/BaseContentDigester.java b/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/BaseContentDigester.java index 736826dd3616..720c03084027 100644 --- a/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/BaseContentDigester.java +++ b/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/BaseContentDigester.java @@ -22,8 +22,8 @@ import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @author ieb @@ -31,7 +31,7 @@ public abstract class BaseContentDigester implements ContentDigester { - private static Log log = LogFactory.getLog(BaseContentDigester.class); + private static Logger log = LoggerFactory.getLogger(BaseContentDigester.class); private ContentHostingContentProducer contentProducer = null; diff --git a/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/ContentHostingContentProducer.java b/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/ContentHostingContentProducer.java index c256b5000ac8..74a84d538100 100644 --- a/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/ContentHostingContentProducer.java +++ b/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/ContentHostingContentProducer.java @@ -29,8 +29,8 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.content.api.ContentHostingService; import org.sakaiproject.content.api.ContentResource; @@ -52,7 +52,7 @@ public class ContentHostingContentProducer implements EntityContentProducer, StoredDigestContentProducer { - private static Log log = LogFactory.getLog(ContentHostingContentProducer.class); + private static Logger log = LoggerFactory.getLogger(ContentHostingContentProducer.class); /** * resolved dep @@ -682,17 +682,9 @@ public Map getCustomProperties(String ref) } return cp; } - catch (PermissionException e) + catch (PermissionException | IdUnusedException | TypeException e) { - log.debug(e); - } - catch (IdUnusedException e) - { - log.debug(e); - } - catch (TypeException e) - { - log.debug(e); + log.debug(e.getMessage()); } return null; } diff --git a/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/DefaultContentDigester.java b/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/DefaultContentDigester.java index 22b5812bbacc..ee36b35acbfd 100644 --- a/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/DefaultContentDigester.java +++ b/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/DefaultContentDigester.java @@ -25,8 +25,8 @@ import java.io.StringReader; import java.util.Properties; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.content.api.ContentResource; import org.sakaiproject.entity.api.ResourceProperties; import org.sakaiproject.search.api.SearchUtils; @@ -36,8 +36,7 @@ */ public class DefaultContentDigester implements ContentDigester { - private static final Log log = LogFactory - .getLog(DefaultContentDigester.class); + private static final Logger log = LoggerFactory.getLogger(DefaultContentDigester.class); private int maxDigestSize = 1024 * 1024 * 20; private Properties binaryTypes = null; @@ -74,7 +73,7 @@ public String getContent(ContentResource contentResource) } catch (Exception e) { - log.debug(e); + log.debug(e.getMessage()); } } return sb.toString(); diff --git a/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/DefaultFullContentDigester.java b/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/DefaultFullContentDigester.java index 75a67e126c4e..808ecf7d789b 100644 --- a/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/DefaultFullContentDigester.java +++ b/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/DefaultFullContentDigester.java @@ -26,8 +26,8 @@ import java.io.InputStreamReader; import java.io.Reader; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.content.api.ContentResource; import org.sakaiproject.search.api.SearchUtils; @@ -36,8 +36,7 @@ */ public class DefaultFullContentDigester extends DefaultContentDigester { - private static final Log log = LogFactory - .getLog(DefaultFullContentDigester.class); + private static final Logger log = LoggerFactory.getLogger(DefaultFullContentDigester.class); private int maxDigestSize = 1024 * 1024 * 5; // 5M @@ -149,12 +148,12 @@ public void close() throws IOException try { this.in.close(); } catch ( Exception ex ) { - log.debug(ex); + log.debug(ex.getMessage()); } try { inputStream.close(); } catch ( Exception ex ) { - log.debug(ex); + log.debug(ex.getMessage()); } inputStream = null; } diff --git a/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/HtmlContentDigester.java b/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/HtmlContentDigester.java index 40864a135334..ec0a8194d146 100644 --- a/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/HtmlContentDigester.java +++ b/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/HtmlContentDigester.java @@ -28,8 +28,8 @@ import java.io.UnsupportedEncodingException; import java.util.Iterator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.content.api.ContentResource; import org.sakaiproject.exception.ServerOverloadException; import org.sakaiproject.search.api.SearchUtils; @@ -42,7 +42,7 @@ */ public class HtmlContentDigester extends BaseContentDigester { - private static Log log = LogFactory.getLog(HtmlContentDigester.class); + private static Logger log = LoggerFactory.getLogger(HtmlContentDigester.class); private boolean useDirectParser = true; @@ -124,7 +124,7 @@ public String getContent(ContentResource contentResource) } catch (IOException e) { - log.debug(e); + log.debug(e.getMessage()); } } if (contentStream != null) @@ -135,7 +135,7 @@ public String getContent(ContentResource contentResource) } catch (IOException e) { - log.debug(e); + log.debug(e.getMessage()); } } } diff --git a/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/PDFContentDigester.java b/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/PDFContentDigester.java index 16e80283846b..04248f95f781 100644 --- a/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/PDFContentDigester.java +++ b/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/PDFContentDigester.java @@ -27,8 +27,8 @@ import java.io.Reader; import java.io.StringReader; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.pdfbox.pdfparser.PDFParser; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.util.PDFTextStripper; @@ -41,7 +41,7 @@ */ public class PDFContentDigester extends BaseContentDigester { - private static Log log = LogFactory.getLog(PDFContentDigester.class); + private static Logger log = LoggerFactory.getLogger(PDFContentDigester.class); public String getContent(ContentResource contentResource) { @@ -85,7 +85,7 @@ public String getContent(ContentResource contentResource) pddoc.close(); } catch (IOException e) { - log.debug(e); + log.debug(e.getMessage()); } } @@ -97,7 +97,7 @@ public String getContent(ContentResource contentResource) } catch (IOException e) { - log.debug(e); + log.debug(e.getMessage()); } } } diff --git a/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/PPTContentDigester.java b/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/PPTContentDigester.java index a53a29b76d6f..4faffbda2fd0 100644 --- a/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/PPTContentDigester.java +++ b/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/PPTContentDigester.java @@ -26,8 +26,8 @@ import java.io.Reader; import java.io.StringReader; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.poi.poifs.eventfilesystem.POIFSReader; import org.apache.poi.poifs.eventfilesystem.POIFSReaderEvent; import org.apache.poi.poifs.eventfilesystem.POIFSReaderListener; @@ -41,7 +41,7 @@ */ public class PPTContentDigester extends BaseContentDigester { - private static Log log = LogFactory.getLog(PPTContentDigester.class); + private static Logger log = LoggerFactory.getLogger(PPTContentDigester.class); static { @@ -94,7 +94,7 @@ public void processPOIFSReaderEvent(POIFSReaderEvent event) } catch (Exception e) { - log.debug(e); + log.debug(e.getMessage()); } } }; @@ -122,7 +122,7 @@ public void processPOIFSReaderEvent(POIFSReaderEvent event) } catch (IOException e) { - log.debug(e); + log.debug(e.getMessage()); } } } diff --git a/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/PoiContentDigester.java b/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/PoiContentDigester.java index aa68435cd939..2e8d0381ad6e 100644 --- a/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/PoiContentDigester.java +++ b/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/PoiContentDigester.java @@ -25,8 +25,8 @@ import java.io.Reader; import java.io.StringReader; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.poi.POITextExtractor; import org.apache.poi.extractor.ExtractorFactory; import org.sakaiproject.content.api.ContentResource; @@ -36,7 +36,7 @@ */ public class PoiContentDigester extends BaseContentDigester { - private static Log log = LogFactory.getLog(PoiContentDigester.class); + private static Logger log = LoggerFactory.getLogger(PoiContentDigester.class); static { @@ -87,7 +87,7 @@ public String getContent(ContentResource contentResource) } catch (IOException e) { - log.debug(e); + log.debug(e.getMessage()); } } } diff --git a/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/SanslanContentDigester.java b/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/SanslanContentDigester.java index bcaf96df3903..693859b2bf0e 100644 --- a/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/SanslanContentDigester.java +++ b/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/SanslanContentDigester.java @@ -26,8 +26,8 @@ import java.io.Reader; import java.io.StringReader; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.sanselan.ImageReadException; import org.apache.sanselan.Sanselan; import org.apache.sanselan.common.IImageMetadata; @@ -41,7 +41,7 @@ import org.sakaiproject.exception.ServerOverloadException; public class SanslanContentDigester extends BaseContentDigester { - private static Log log = LogFactory.getLog(TikaContentDigester.class); + private static Logger log = LoggerFactory.getLogger(TikaContentDigester.class); public String getContent(ContentResource contentResource) { log.debug("digesting: " + contentResource.getId()); diff --git a/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/TikaContentDigester.java b/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/TikaContentDigester.java index 88fa9f1ec249..c34eb5834bcd 100644 --- a/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/TikaContentDigester.java +++ b/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/TikaContentDigester.java @@ -25,8 +25,8 @@ import java.io.Reader; import java.io.StringReader; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.content.api.ContentResource; import org.xml.sax.ContentHandler; import org.apache.tika.metadata.Metadata; @@ -40,7 +40,7 @@ */ public class TikaContentDigester extends BaseContentDigester { - private static Log log = LogFactory.getLog(TikaContentDigester.class); + private static Logger log = LoggerFactory.getLogger(TikaContentDigester.class); /* * (non-Javadoc) @@ -85,7 +85,7 @@ public String getContent(ContentResource contentResource) } catch (IOException e) { - log.debug(e); + log.debug(e.getMessage()); } } } diff --git a/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/XLContentDigester.java b/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/XLContentDigester.java index 4a9c00245b1d..bec8af9884e7 100644 --- a/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/XLContentDigester.java +++ b/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/contenthosting/XLContentDigester.java @@ -28,8 +28,8 @@ import java.io.Writer; import java.util.Iterator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; @@ -44,7 +44,7 @@ */ public class XLContentDigester extends BaseContentDigester { - private static Log log = LogFactory.getLog(XLContentDigester.class); + private static Logger log = LoggerFactory.getLogger(XLContentDigester.class); static { System.setProperty("org.apache.poi.util.POILogger", "org.apache.poi.util.NullLogger"); @@ -118,7 +118,7 @@ public void loadContent(Writer writer, ContentResource contentResource) } catch (IOException e) { - log.debug(e); + log.debug(e.getMessage()); } } } diff --git a/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/site/SiteContentProducer.java b/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/site/SiteContentProducer.java index fe4ddfde5245..a634e36e236b 100644 --- a/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/site/SiteContentProducer.java +++ b/search/search-impl/impl/src/java/org/sakaiproject/search/component/adapter/site/SiteContentProducer.java @@ -29,8 +29,8 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.entity.api.Entity; import org.sakaiproject.entity.api.EntityManager; @@ -54,7 +54,7 @@ public class SiteContentProducer implements EntityContentProducer { - private static final Log log = LogFactory.getLog(SiteContentProducer.class); + private static final Logger log = LoggerFactory.getLogger(SiteContentProducer.class); private EntityManager entityManager; @@ -198,7 +198,7 @@ public boolean canRead(String reference) } catch (Exception ex) { - log.debug(ex); + log.debug(ex.getMessage()); } } return false; @@ -217,7 +217,7 @@ private Reference getReference(String reference) } catch (Exception ex) { - log.debug(ex); + log.debug(ex.getMessage()); } return null; } @@ -230,7 +230,7 @@ private EntityProducer getProducer(Reference ref) } catch (Exception ex) { - log.debug(ex); + log.debug(ex.getMessage()); } return null; } diff --git a/search/search-impl/impl/src/java/org/sakaiproject/search/entitybroker/SearchProviderImpl.java b/search/search-impl/impl/src/java/org/sakaiproject/search/entitybroker/SearchProviderImpl.java index 8a9c2077f1d0..0c7e3368a014 100644 --- a/search/search-impl/impl/src/java/org/sakaiproject/search/entitybroker/SearchProviderImpl.java +++ b/search/search-impl/impl/src/java/org/sakaiproject/search/entitybroker/SearchProviderImpl.java @@ -26,8 +26,8 @@ import java.util.Iterator; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.entitybroker.entityprovider.extension.QuerySearch; import org.sakaiproject.entitybroker.entityprovider.extension.SearchContent; import org.sakaiproject.entitybroker.entityprovider.extension.SearchProvider; @@ -54,7 +54,7 @@ */ public class SearchProviderImpl implements SearchProvider, EntityContentProducer { - private static final Log log = LogFactory.getLog(SearchProviderImpl.class); + private static final Logger log = LoggerFactory.getLogger(SearchProviderImpl.class); private SearchService searchService; private SearchIndexBuilder searchIndexBuilder; diff --git a/search/search-tool/tool/src/java/org/sakaiproject/search/tool/ControllerServlet.java b/search/search-tool/tool/src/java/org/sakaiproject/search/tool/ControllerServlet.java index 6c780e655c70..6b5c52de30c6 100644 --- a/search/search-tool/tool/src/java/org/sakaiproject/search/tool/ControllerServlet.java +++ b/search/search-tool/tool/src/java/org/sakaiproject/search/tool/ControllerServlet.java @@ -31,8 +31,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.search.tool.api.SearchBeanFactory; import org.sakaiproject.tool.api.SessionManager; import org.sakaiproject.tool.api.Tool; @@ -45,7 +45,7 @@ */ public class ControllerServlet extends HttpServlet { - public static final Log log = LogFactory.getLog(ControllerServlet.class); + public static final Logger log = LoggerFactory.getLogger(ControllerServlet.class); /** * Required for serialization... also to stop eclipse from giving me a diff --git a/search/search-tool/tool/src/java/org/sakaiproject/search/tool/ControllerServlet2.java b/search/search-tool/tool/src/java/org/sakaiproject/search/tool/ControllerServlet2.java index 4407abdecb7d..84f8948d3dad 100644 --- a/search/search-tool/tool/src/java/org/sakaiproject/search/tool/ControllerServlet2.java +++ b/search/search-tool/tool/src/java/org/sakaiproject/search/tool/ControllerServlet2.java @@ -35,8 +35,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.velocity.VelocityContext; import org.apache.velocity.app.VelocityEngine; import org.sakaiproject.component.api.ServerConfigurationService; @@ -57,7 +57,7 @@ */ public class ControllerServlet2 extends HttpServlet { - private static final Log log = LogFactory.getLog(ControllerServlet2.class); + private static final Logger log = LoggerFactory.getLogger(ControllerServlet2.class); private static final String MACROS = "/WEB-INF/vm/macros.vm"; @@ -273,7 +273,7 @@ public void execute(HttpServletRequest request, HttpServletResponse response) } catch (PermissionException e1) { - log.debug(e1); + log.debug(e1.getMessage()); } try { SearchAdminBean searchAdminBean = searchBeanFactory.newSearchAdminBean(request); @@ -285,7 +285,7 @@ public void execute(HttpServletRequest request, HttpServletResponse response) } catch (PermissionException e1) { - log.debug(e1); + log.debug(e1.getMessage()); } try { @@ -293,7 +293,7 @@ public void execute(HttpServletRequest request, HttpServletResponse response) } catch (PermissionException e1) { - log.debug(e1); + log.debug(e1.getMessage()); } try { @@ -301,7 +301,7 @@ public void execute(HttpServletRequest request, HttpServletResponse response) } catch (PermissionException e1) { - log.debug(e1); + log.debug(e1.getMessage()); } try { diff --git a/search/search-tool/tool/src/java/org/sakaiproject/search/tool/RestSearchServlet.java b/search/search-tool/tool/src/java/org/sakaiproject/search/tool/RestSearchServlet.java index 0b3b54da9255..4dd5aebba115 100644 --- a/search/search-tool/tool/src/java/org/sakaiproject/search/tool/RestSearchServlet.java +++ b/search/search-tool/tool/src/java/org/sakaiproject/search/tool/RestSearchServlet.java @@ -29,8 +29,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ComponentManager; import org.sakaiproject.search.api.SearchService; @@ -42,7 +42,7 @@ public class RestSearchServlet extends HttpServlet { - private static final Log log = LogFactory.getLog(RestSearchServlet.class); + private static final Logger log = LoggerFactory.getLogger(RestSearchServlet.class); public static final String REQUEST_PARAM_CTX = "ctx"; public static final String REQUEST_PARAM_SCOPE = "scope"; public static final String REQUEST_PARAMETER_Q = "q"; diff --git a/search/search-tool/tool/src/java/org/sakaiproject/search/tool/SearchBeanFactoryImpl.java b/search/search-tool/tool/src/java/org/sakaiproject/search/tool/SearchBeanFactoryImpl.java index 00e860a4ba49..63386f6498cf 100644 --- a/search/search-tool/tool/src/java/org/sakaiproject/search/tool/SearchBeanFactoryImpl.java +++ b/search/search-tool/tool/src/java/org/sakaiproject/search/tool/SearchBeanFactoryImpl.java @@ -24,8 +24,8 @@ import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.SecurityService; import org.sakaiproject.component.api.ComponentManager; import org.sakaiproject.component.api.ServerConfigurationService; @@ -48,7 +48,7 @@ public class SearchBeanFactoryImpl implements SearchBeanFactory { - private static Log log = LogFactory.getLog(SearchBeanFactoryImpl.class); + private static Logger log = LoggerFactory.getLogger(SearchBeanFactoryImpl.class); private SearchService searchService; diff --git a/search/search-tool/tool/src/java/org/sakaiproject/search/tool/SearchBeanImpl.java b/search/search-tool/tool/src/java/org/sakaiproject/search/tool/SearchBeanImpl.java index d35c6583dee3..eb99db98b5c4 100644 --- a/search/search-tool/tool/src/java/org/sakaiproject/search/tool/SearchBeanImpl.java +++ b/search/search-tool/tool/src/java/org/sakaiproject/search/tool/SearchBeanImpl.java @@ -39,8 +39,8 @@ import javax.servlet.http.HttpServletRequest; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.SecurityService; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.exception.IdUnusedException; @@ -71,7 +71,7 @@ public class SearchBeanImpl implements SearchBean public static final String SEARCH_SITE_IDS = "search_site_ids"; - private static final Log log = LogFactory.getLog(SearchBeanImpl.class); + private static final Logger log = LoggerFactory.getLogger(SearchBeanImpl.class); /** * The searhc string parameter name @@ -226,7 +226,7 @@ public SearchBeanImpl(HttpServletRequest request, SearchService searchService, } catch (Exception ex) { - log.debug(ex); + log.debug(ex.getMessage()); } currentSite = this.siteService.getSite(this.siteId); @@ -238,7 +238,7 @@ public SearchBeanImpl(HttpServletRequest request, SearchService searchService, {} catch (IllegalArgumentException iae) { - log.debug(iae); + log.debug(iae.getMessage()); log.warn("Invalid Scope Supplied: "+ request.getParameter(SEARCH_SCOPE)); } @@ -775,7 +775,7 @@ public String getUrl() } catch (Exception ex) { - log.debug(ex); + log.debug(ex.getMessage()); } return pages; } diff --git a/search/search-util/src/java/org/sakaiproject/search/util/FileUtils.java b/search/search-util/src/java/org/sakaiproject/search/util/FileUtils.java index 07dd9f20837e..c7b2dc42253c 100644 --- a/search/search-util/src/java/org/sakaiproject/search/util/FileUtils.java +++ b/search/search-util/src/java/org/sakaiproject/search/util/FileUtils.java @@ -35,8 +35,8 @@ import java.util.zip.ZipInputStream; import java.util.zip.ZipOutputStream; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @author ieb @@ -67,7 +67,7 @@ public interface RecurseAction } - private static final Log log = LogFactory.getLog(FileUtils.class); + private static final Logger log = LoggerFactory.getLogger(FileUtils.class); /** * delete all files under this file and including this file diff --git a/search/search-util/src/java/org/sakaiproject/search/util/HTMLParser.java b/search/search-util/src/java/org/sakaiproject/search/util/HTMLParser.java index 9976f9a3d788..191a5cb70a75 100644 --- a/search/search-util/src/java/org/sakaiproject/search/util/HTMLParser.java +++ b/search/search-util/src/java/org/sakaiproject/search/util/HTMLParser.java @@ -27,15 +27,15 @@ import java.util.Iterator; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @author ieb */ public class HTMLParser implements Iterator { - private static Log log = LogFactory.getLog(HTMLParser.class); + private static Logger log = LoggerFactory.getLogger(HTMLParser.class); private static final char[][] IGNORE_TAGS = new char[][] { "script".toCharArray(), "head".toCharArray(), "style".toCharArray() }; diff --git a/search/search-util/src/test/org/sakaiproject/search/util/test/FileUtilsTest.java b/search/search-util/src/test/org/sakaiproject/search/util/test/FileUtilsTest.java index 5964fd5ee77c..bc132f7f6a15 100644 --- a/search/search-util/src/test/org/sakaiproject/search/util/test/FileUtilsTest.java +++ b/search/search-util/src/test/org/sakaiproject/search/util/test/FileUtilsTest.java @@ -30,8 +30,8 @@ import junit.framework.TestCase; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.search.util.FileUtils; /** @@ -41,7 +41,7 @@ public class FileUtilsTest extends TestCase { - private static final Log log = LogFactory.getLog(FileUtilsTest.class); + private static final Logger log = LoggerFactory.getLogger(FileUtilsTest.class); private File testSpace; /** diff --git a/sections/sections-app-util/src/java/org/sakaiproject/tool/section/decorator/EnrollmentDecorator.java b/sections/sections-app-util/src/java/org/sakaiproject/tool/section/decorator/EnrollmentDecorator.java index 006939a2ec53..1f0a67ffdb60 100644 --- a/sections/sections-app-util/src/java/org/sakaiproject/tool/section/decorator/EnrollmentDecorator.java +++ b/sections/sections-app-util/src/java/org/sakaiproject/tool/section/decorator/EnrollmentDecorator.java @@ -24,8 +24,8 @@ import java.util.Comparator; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.coursemanagement.CourseSection; import org.sakaiproject.section.api.coursemanagement.EnrollmentRecord; import org.sakaiproject.section.api.coursemanagement.User; @@ -38,7 +38,7 @@ */ public class EnrollmentDecorator implements Serializable { private static final long serialVersionUID = 1L; - private static final Log log = LogFactory.getLog(EnrollmentDecorator.class); + private static final Logger log = LoggerFactory.getLogger(EnrollmentDecorator.class); protected EnrollmentRecord enrollment; diff --git a/sections/sections-app-util/src/java/org/sakaiproject/tool/section/decorator/SectionDecorator.java b/sections/sections-app-util/src/java/org/sakaiproject/tool/section/decorator/SectionDecorator.java index 1d8f349e4653..2bf4447b27a0 100644 --- a/sections/sections-app-util/src/java/org/sakaiproject/tool/section/decorator/SectionDecorator.java +++ b/sections/sections-app-util/src/java/org/sakaiproject/tool/section/decorator/SectionDecorator.java @@ -35,8 +35,8 @@ import java.util.Set; import java.util.HashSet; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.coursemanagement.Course; import org.sakaiproject.section.api.coursemanagement.CourseSection; import org.sakaiproject.section.api.coursemanagement.Meeting; @@ -54,7 +54,7 @@ */ public class SectionDecorator implements RowGroupable,Serializable, Comparable{ private static final long serialVersionUID = 1L; - private static final Log log = LogFactory.getLog(SectionDecorator.class); + private static final Logger log = LoggerFactory.getLogger(SectionDecorator.class); public static final int NAME_TRUNCATION_LENGTH = 20; public static final int LOCATION_TRUNCATION_LENGTH = 15; diff --git a/sections/sections-app-util/src/java/org/sakaiproject/tool/section/decorator/StudentSectionDecorator.java b/sections/sections-app-util/src/java/org/sakaiproject/tool/section/decorator/StudentSectionDecorator.java index 4eb14fbd8b4a..488876a7f826 100644 --- a/sections/sections-app-util/src/java/org/sakaiproject/tool/section/decorator/StudentSectionDecorator.java +++ b/sections/sections-app-util/src/java/org/sakaiproject/tool/section/decorator/StudentSectionDecorator.java @@ -23,8 +23,8 @@ import java.io.Serializable; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.coursemanagement.CourseSection; import org.sakaiproject.tool.section.jsf.JsfUtil; @@ -38,7 +38,7 @@ public class StudentSectionDecorator extends SectionDecorator implements Serializable { private static final long serialVersionUID = 1L; - private static final Log log = LogFactory.getLog(StudentSectionDecorator.class); + private static final Logger log = LoggerFactory.getLogger(StudentSectionDecorator.class); protected boolean full; protected boolean joinable; diff --git a/sections/sections-app-util/src/java/org/sakaiproject/tool/section/jsf/HtmlSortHeaderRenderer.java b/sections/sections-app-util/src/java/org/sakaiproject/tool/section/jsf/HtmlSortHeaderRenderer.java index 94039ea35921..68a665e96883 100644 --- a/sections/sections-app-util/src/java/org/sakaiproject/tool/section/jsf/HtmlSortHeaderRenderer.java +++ b/sections/sections-app-util/src/java/org/sakaiproject/tool/section/jsf/HtmlSortHeaderRenderer.java @@ -52,8 +52,8 @@ import javax.faces.context.ResponseWriter; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.myfaces.component.UserRoleUtils; import org.apache.myfaces.component.html.ext.HtmlDataTable; import org.apache.myfaces.custom.sortheader.HtmlCommandSortHeader; @@ -68,8 +68,7 @@ * @author
Josh Holtzman */ public class HtmlSortHeaderRenderer extends HtmlLinkRendererBase { - private static final Log log = LogFactory - .getLog(HtmlSortHeaderRenderer.class); + private static final Logger log = LoggerFactory.getLogger(HtmlSortHeaderRenderer.class); public final static String CURRENT_SORT_STYLE = "currentSort"; public final static String NOT_CURRENT_SORT_STYLE = "notCurrentSort"; diff --git a/sections/sections-app-util/src/java/org/sakaiproject/tool/section/jsf/JsfUtil.java b/sections/sections-app-util/src/java/org/sakaiproject/tool/section/jsf/JsfUtil.java index aed0bad0812b..beb7fea499e4 100644 --- a/sections/sections-app-util/src/java/org/sakaiproject/tool/section/jsf/JsfUtil.java +++ b/sections/sections-app-util/src/java/org/sakaiproject/tool/section/jsf/JsfUtil.java @@ -34,8 +34,8 @@ import javax.faces.model.SelectItem; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.jsf.util.ConversionUtil; import org.sakaiproject.tool.section.jsf.MessagingBean; @@ -49,7 +49,7 @@ * */ public class JsfUtil { - private static final Log log = LogFactory.getLog(JsfUtil.class); + private static final Logger log = LoggerFactory.getLogger(JsfUtil.class); /** * As part of the crutch for JSF's inability to do validation on relative diff --git a/sections/sections-app-util/src/java/org/sakaiproject/tool/section/jsf/RowGroupDataTableRenderer.java b/sections/sections-app-util/src/java/org/sakaiproject/tool/section/jsf/RowGroupDataTableRenderer.java index 3f6afb1f4b45..15127cc13fc6 100644 --- a/sections/sections-app-util/src/java/org/sakaiproject/tool/section/jsf/RowGroupDataTableRenderer.java +++ b/sections/sections-app-util/src/java/org/sakaiproject/tool/section/jsf/RowGroupDataTableRenderer.java @@ -1,135 +1,135 @@ -package org.sakaiproject.tool.section.jsf; - - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.myfaces.shared_tomahawk.renderkit.JSFAttr; -import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRendererUtils; -import org.apache.myfaces.shared_tomahawk.renderkit.html.HTML; -import org.apache.myfaces.renderkit.html.ext.HtmlTableRenderer; - -import javax.faces.component.UIComponent; -import javax.faces.component.UIData; -import javax.faces.context.FacesContext; -import javax.faces.context.ResponseWriter; -import java.util.List; -import java.io.IOException; - -public class RowGroupDataTableRenderer extends HtmlTableRenderer { - private static final Log log = LogFactory.getLog(RowGroupDataTableRenderer.class); - - public static final String SECTION_STYLE_CLASS = "groupRow"; - public static final String CATEGORY_HEADER_STYLE_CLASS = "categoryHeader"; - public static final String FIRST_CATEGORY_HEADER_STYLE_CLASS = "firstCategoryHeader"; - - public void encodeInnerHtml(FacesContext facesContext, UIComponent component)throws IOException { - - UIData uiData = (UIData) component; - ResponseWriter writer = facesContext.getResponseWriter(); - - Styles styles = getStyles(uiData); - - int first = uiData.getFirst(); - int rows = uiData.getRows(); - int rowCount = uiData.getRowCount(); - if (rows <= 0) - { - rows = rowCount - first; - } - int last = first + rows; - if (last > rowCount) - last = rowCount; - - for (int i = first; i < last; i++) - { - uiData.setRowIndex(i); - if (!uiData.isRowAvailable()) - { - log.warn("Row is not available. Rowindex = " + i); - return; - } - - int columns = component.getChildCount(); - renderCategoryRow(i, columns, uiData, writer, i==first); - - beforeRow(facesContext, uiData); - HtmlRendererUtils.writePrettyLineSeparator(facesContext); - renderRowStart(facesContext, writer, uiData, styles, i); - - List children = component.getChildren(); - for (int j = 0, size = component.getChildCount(); j < size; j++) - { - UIComponent child = (UIComponent) children.get(j); - if(child.isRendered()) - { - encodeColumnChild(facesContext, writer, uiData, child, styles, j); - } - } - renderRowEnd(facesContext, writer, uiData); - - afterRow(facesContext, uiData); - } - } - - private void renderCategoryRow(int rowNumber, int columns, UIData uiData, ResponseWriter writer, boolean firstCategory) throws IOException { - FacesContext facesContext = FacesContext.getCurrentInstance(); - - // Cast the uiData into our custom component - RowGroupDataTable rowGroupDataTable; - try { - rowGroupDataTable = (RowGroupDataTable)uiData; - } catch (ClassCastException cce) { - log.warn(cce); - return; - } - - // Get the current section - RowGroupable rowGroupable; - List list = (List)uiData.getValue(); - try { - rowGroupable = (RowGroupable)list.get(rowNumber); - } catch (IndexOutOfBoundsException ioobe) { - log.warn(ioobe); - return; - } - - // For Daisy's CM Home tool - if (rowNumber == 0){ - // reset rowGroupDataTable.category - rowGroupDataTable.category = null; - } - - // Is this section different from the previous RowGroup? - if( ! rowGroupable.getRowGroupId().equals(rowGroupDataTable.category)) { - // Update the SectionTable's current RowGroup - rowGroupDataTable.category = rowGroupable.getRowGroupId(); - - // Render a table row for the RowGroup header - beforeRow(facesContext, uiData); - HtmlRendererUtils.writePrettyLineSeparator(facesContext); - - writer.startElement(HTML.TR_ELEM, uiData); - if(firstCategory) { - writer.writeAttribute(HTML.CLASS_ATTR, FIRST_CATEGORY_HEADER_STYLE_CLASS, null); - } else { - writer.writeAttribute(HTML.CLASS_ATTR, CATEGORY_HEADER_STYLE_CLASS, null); - } - - Object rowId = uiData.getAttributes().get(JSFAttr.ROW_ID); - - if (rowId != null) { - writer.writeAttribute(HTML.ID_ATTR, rowId.toString(), null); - } - - // Render a single colspanned cell displaying the current RowGroup - writer.startElement(HTML.TD_ELEM, uiData); - writer.writeAttribute(HTML.COLSPAN_ATTR, columns, null); - writer.write(JsfUtil.getLocalizedMessage("section_table_category_header", new String[] {rowGroupable.getRowGroupTitle()})); - writer.endElement(HTML.TD_ELEM); - - renderRowEnd(facesContext, writer, uiData); - afterRow(facesContext, uiData); - } - } - -} +package org.sakaiproject.tool.section.jsf; + + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.apache.myfaces.shared_tomahawk.renderkit.JSFAttr; +import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRendererUtils; +import org.apache.myfaces.shared_tomahawk.renderkit.html.HTML; +import org.apache.myfaces.renderkit.html.ext.HtmlTableRenderer; + +import javax.faces.component.UIComponent; +import javax.faces.component.UIData; +import javax.faces.context.FacesContext; +import javax.faces.context.ResponseWriter; +import java.util.List; +import java.io.IOException; + +public class RowGroupDataTableRenderer extends HtmlTableRenderer { + private static final Logger log = LoggerFactory.getLogger(RowGroupDataTableRenderer.class); + + public static final String SECTION_STYLE_CLASS = "groupRow"; + public static final String CATEGORY_HEADER_STYLE_CLASS = "categoryHeader"; + public static final String FIRST_CATEGORY_HEADER_STYLE_CLASS = "firstCategoryHeader"; + + public void encodeInnerHtml(FacesContext facesContext, UIComponent component)throws IOException { + + UIData uiData = (UIData) component; + ResponseWriter writer = facesContext.getResponseWriter(); + + Styles styles = getStyles(uiData); + + int first = uiData.getFirst(); + int rows = uiData.getRows(); + int rowCount = uiData.getRowCount(); + if (rows <= 0) + { + rows = rowCount - first; + } + int last = first + rows; + if (last > rowCount) + last = rowCount; + + for (int i = first; i < last; i++) + { + uiData.setRowIndex(i); + if (!uiData.isRowAvailable()) + { + log.warn("Row is not available. Rowindex = " + i); + return; + } + + int columns = component.getChildCount(); + renderCategoryRow(i, columns, uiData, writer, i==first); + + beforeRow(facesContext, uiData); + HtmlRendererUtils.writePrettyLineSeparator(facesContext); + renderRowStart(facesContext, writer, uiData, styles, i); + + List children = component.getChildren(); + for (int j = 0, size = component.getChildCount(); j < size; j++) + { + UIComponent child = (UIComponent) children.get(j); + if(child.isRendered()) + { + encodeColumnChild(facesContext, writer, uiData, child, styles, j); + } + } + renderRowEnd(facesContext, writer, uiData); + + afterRow(facesContext, uiData); + } + } + + private void renderCategoryRow(int rowNumber, int columns, UIData uiData, ResponseWriter writer, boolean firstCategory) throws IOException { + FacesContext facesContext = FacesContext.getCurrentInstance(); + + // Cast the uiData into our custom component + RowGroupDataTable rowGroupDataTable; + try { + rowGroupDataTable = (RowGroupDataTable)uiData; + } catch (ClassCastException cce) { + log.warn(cce.getMessage()); + return; + } + + // Get the current section + RowGroupable rowGroupable; + List list = (List)uiData.getValue(); + try { + rowGroupable = (RowGroupable)list.get(rowNumber); + } catch (IndexOutOfBoundsException ioobe) { + log.warn(ioobe.getMessage()); + return; + } + + // For Daisy's CM Home tool + if (rowNumber == 0){ + // reset rowGroupDataTable.category + rowGroupDataTable.category = null; + } + + // Is this section different from the previous RowGroup? + if( ! rowGroupable.getRowGroupId().equals(rowGroupDataTable.category)) { + // Update the SectionTable's current RowGroup + rowGroupDataTable.category = rowGroupable.getRowGroupId(); + + // Render a table row for the RowGroup header + beforeRow(facesContext, uiData); + HtmlRendererUtils.writePrettyLineSeparator(facesContext); + + writer.startElement(HTML.TR_ELEM, uiData); + if(firstCategory) { + writer.writeAttribute(HTML.CLASS_ATTR, FIRST_CATEGORY_HEADER_STYLE_CLASS, null); + } else { + writer.writeAttribute(HTML.CLASS_ATTR, CATEGORY_HEADER_STYLE_CLASS, null); + } + + Object rowId = uiData.getAttributes().get(JSFAttr.ROW_ID); + + if (rowId != null) { + writer.writeAttribute(HTML.ID_ATTR, rowId.toString(), null); + } + + // Render a single colspanned cell displaying the current RowGroup + writer.startElement(HTML.TD_ELEM, uiData); + writer.writeAttribute(HTML.COLSPAN_ATTR, columns, null); + writer.write(JsfUtil.getLocalizedMessage("section_table_category_header", new String[] {rowGroupable.getRowGroupTitle()})); + writer.endElement(HTML.TD_ELEM); + + renderRowEnd(facesContext, writer, uiData); + afterRow(facesContext, uiData); + } + } + +} diff --git a/sections/sections-app/src/java/org/sakaiproject/tool/section/EntryServlet.java b/sections/sections-app/src/java/org/sakaiproject/tool/section/EntryServlet.java index bd41f9c4c909..aa6dd6c32094 100644 --- a/sections/sections-app/src/java/org/sakaiproject/tool/section/EntryServlet.java +++ b/sections/sections-app/src/java/org/sakaiproject/tool/section/EntryServlet.java @@ -8,8 +8,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.facade.manager.Authn; import org.sakaiproject.section.api.facade.manager.Authz; import org.sakaiproject.section.api.facade.manager.Context; @@ -19,7 +19,7 @@ public class EntryServlet extends HttpServlet { private static final long serialVersionUID = 1L; - private static final Log log = LogFactory.getLog(EntryServlet.class); + private static final Logger log = LoggerFactory.getLogger(EntryServlet.class); public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, java.io.IOException { diff --git a/sections/sections-app/src/java/org/sakaiproject/tool/section/facade/sakai/AuthnSakaiImpl.java b/sections/sections-app/src/java/org/sakaiproject/tool/section/facade/sakai/AuthnSakaiImpl.java index 5d36ab7496fd..ec4cdf209f46 100644 --- a/sections/sections-app/src/java/org/sakaiproject/tool/section/facade/sakai/AuthnSakaiImpl.java +++ b/sections/sections-app/src/java/org/sakaiproject/tool/section/facade/sakai/AuthnSakaiImpl.java @@ -20,8 +20,8 @@ **********************************************************************************/ package org.sakaiproject.tool.section.facade.sakai; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.facade.manager.Authn; import org.sakaiproject.tool.api.Session; import org.sakaiproject.tool.cover.SessionManager; @@ -32,7 +32,7 @@ * @author Josh Holtzman */ public class AuthnSakaiImpl implements Authn { - private static final Log log = LogFactory.getLog(AuthnSakaiImpl.class); + private static final Logger log = LoggerFactory.getLogger(AuthnSakaiImpl.class); /** * @see org.sakaiproject.section.api.facade.managers.Authn#getUserUid() diff --git a/sections/sections-app/src/java/org/sakaiproject/tool/section/facade/sakai/AuthzSakaiImpl.java b/sections/sections-app/src/java/org/sakaiproject/tool/section/facade/sakai/AuthzSakaiImpl.java index de0d256ff978..dae9032ecc41 100644 --- a/sections/sections-app/src/java/org/sakaiproject/tool/section/facade/sakai/AuthzSakaiImpl.java +++ b/sections/sections-app/src/java/org/sakaiproject/tool/section/facade/sakai/AuthzSakaiImpl.java @@ -20,8 +20,8 @@ **********************************************************************************/ package org.sakaiproject.tool.section.facade.sakai; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.SectionAwareness; import org.sakaiproject.section.api.facade.manager.Authz; import org.sakaiproject.authz.api.AuthzGroupService; @@ -42,7 +42,7 @@ public class AuthzSakaiImpl implements Authz { private static final String SITE_UPDATE = "site.upd"; private static final String SITE_UPDATE_GROUP_MEMBERSHIP = "site.upd.grp.mbrshp"; - private static final Log log = LogFactory.getLog(AuthzSakaiImpl.class); + private static final Logger log = LoggerFactory.getLogger(AuthzSakaiImpl.class); private AuthzGroupService authzGroupService; diff --git a/sections/sections-app/src/java/org/sakaiproject/tool/section/facade/sakai/ContextSakaiImpl.java b/sections/sections-app/src/java/org/sakaiproject/tool/section/facade/sakai/ContextSakaiImpl.java index a56397983e80..147ebd81757c 100644 --- a/sections/sections-app/src/java/org/sakaiproject/tool/section/facade/sakai/ContextSakaiImpl.java +++ b/sections/sections-app/src/java/org/sakaiproject/tool/section/facade/sakai/ContextSakaiImpl.java @@ -20,8 +20,8 @@ **********************************************************************************/ package org.sakaiproject.tool.section.facade.sakai; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.facade.manager.Context; import org.sakaiproject.exception.IdUnusedException; import org.sakaiproject.site.cover.SiteService; @@ -35,7 +35,7 @@ * */ public class ContextSakaiImpl implements Context { - private static final Log log = LogFactory.getLog(ContextSakaiImpl.class); + private static final Logger log = LoggerFactory.getLogger(ContextSakaiImpl.class); /** * @inheritDoc diff --git a/sections/sections-app/src/java/org/sakaiproject/tool/section/filter/AuthnFilter.java b/sections/sections-app/src/java/org/sakaiproject/tool/section/filter/AuthnFilter.java index c3b12e3b607c..bf604b459408 100644 --- a/sections/sections-app/src/java/org/sakaiproject/tool/section/filter/AuthnFilter.java +++ b/sections/sections-app/src/java/org/sakaiproject/tool/section/filter/AuthnFilter.java @@ -32,8 +32,8 @@ import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.facade.manager.Authn; import org.springframework.web.context.support.WebApplicationContextUtils; @@ -41,7 +41,7 @@ * An authentication filter for standalone use in demos and UI tests. */ public class AuthnFilter implements Filter { - private static Log log = LogFactory.getLog(AuthnFilter.class); + private static Logger log = LoggerFactory.getLogger(AuthnFilter.class); private String authnRedirect; private String authnBean; diff --git a/sections/sections-app/src/java/org/sakaiproject/tool/section/filter/RoleFilter.java b/sections/sections-app/src/java/org/sakaiproject/tool/section/filter/RoleFilter.java index 551d6ba82203..824bdd405ca7 100644 --- a/sections/sections-app/src/java/org/sakaiproject/tool/section/filter/RoleFilter.java +++ b/sections/sections-app/src/java/org/sakaiproject/tool/section/filter/RoleFilter.java @@ -31,8 +31,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.facade.manager.Authn; import org.sakaiproject.section.api.facade.manager.Authz; import org.sakaiproject.section.api.facade.manager.Context; @@ -49,7 +49,7 @@ * */ public class RoleFilter implements Filter { - private static Log logger = LogFactory.getLog(RoleFilter.class); + private static Logger logger = LoggerFactory.getLogger(RoleFilter.class); private String authnBeanName; private String authzBeanName; diff --git a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/DivMessageRenderer.java b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/DivMessageRenderer.java index 4201e932b79c..b0e4f5e5c16e 100644 --- a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/DivMessageRenderer.java +++ b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/DivMessageRenderer.java @@ -28,8 +28,8 @@ import javax.faces.component.UIMessage; import javax.faces.context.FacesContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Put the message in a "div" instead of a "span", allowing for much more @@ -37,7 +37,7 @@ */ public class DivMessageRenderer extends DivMessageRendererBase { - private static final Log logger = LogFactory.getLog(DivMessageRenderer.class); + private static final Logger logger = LoggerFactory.getLogger(DivMessageRenderer.class); public void encodeEnd(FacesContext context, UIComponent component) throws IOException { // Note our complete disregard for class cast and null exceptions.... diff --git a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/DivMessageRendererBase.java b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/DivMessageRendererBase.java index d04bf4839c62..49542fe52a3d 100644 --- a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/DivMessageRendererBase.java +++ b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/DivMessageRendererBase.java @@ -30,8 +30,8 @@ import javax.faces.context.ResponseWriter; import javax.faces.render.Renderer; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Base class for custom message renderers. @@ -40,7 +40,7 @@ * */ public abstract class DivMessageRendererBase extends Renderer { - private static final Log logger = LogFactory.getLog(DivMessageRendererBase.class); + private static final Logger logger = LoggerFactory.getLogger(DivMessageRendererBase.class); public static String INNER_TAG = "div"; diff --git a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/DivMessagesRenderer.java b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/DivMessagesRenderer.java index da69b67da04e..9a4dcf88dd66 100644 --- a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/DivMessagesRenderer.java +++ b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/DivMessagesRenderer.java @@ -31,8 +31,8 @@ import javax.faces.component.UIMessages; import javax.faces.context.FacesContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Work around JSF 1.1's inadequate Messages renderer, which has the following problems: @@ -72,7 +72,7 @@ * */ public class DivMessagesRenderer extends DivMessageRendererBase { - private static final Log logger = LogFactory.getLog(DivMessagesRenderer.class); + private static final Logger logger = LoggerFactory.getLogger(DivMessagesRenderer.class); diff --git a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/JsfTool.java b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/JsfTool.java index f986dec7ee0e..4bac20e8275f 100644 --- a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/JsfTool.java +++ b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/JsfTool.java @@ -20,8 +20,8 @@ **********************************************************************************/ package org.sakaiproject.tool.section.jsf; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.facade.manager.Authn; import org.sakaiproject.section.api.facade.manager.Authz; import org.sakaiproject.section.api.facade.manager.Context; @@ -38,7 +38,7 @@ public class JsfTool extends org.sakaiproject.jsf.util.JsfTool { private static final long serialVersionUID = 1L; - private static final Log log = LogFactory.getLog(JsfTool.class); + private static final Logger log = LoggerFactory.getLogger(JsfTool.class); /** * @inheritDoc diff --git a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/AddSectionsBean.java b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/AddSectionsBean.java index 4634bc6c3337..d3e4883aa186 100644 --- a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/AddSectionsBean.java +++ b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/AddSectionsBean.java @@ -35,8 +35,8 @@ import javax.faces.model.SelectItem; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.component.api.ComponentManager; import org.sakaiproject.section.api.coursemanagement.Course; @@ -52,7 +52,7 @@ */ public class AddSectionsBean extends CourseDependentBean implements SectionEditor, Serializable { private static final long serialVersionUID = 1L; - private static final Log log = LogFactory.getLog(AddSectionsBean.class); + private static final Logger log = LoggerFactory.getLogger(AddSectionsBean.class); private Integer numToAdd; private String category; diff --git a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/CourseDependentBean.java b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/CourseDependentBean.java index d13006a4b215..9155a000b80f 100644 --- a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/CourseDependentBean.java +++ b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/CourseDependentBean.java @@ -29,8 +29,8 @@ import javax.faces.context.FacesContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.jsf.util.LocaleUtil; import org.sakaiproject.section.api.SectionManager; import org.sakaiproject.section.api.SectionManager.ExternalIntegrationConfig; @@ -48,7 +48,7 @@ public class CourseDependentBean extends InitializableBean implements Serializable { private static final long serialVersionUID = 1L; - private static final Log log = LogFactory.getLog(CourseDependentBean.class); + private static final Logger log = LoggerFactory.getLogger(CourseDependentBean.class); private transient CourseBean courseBean; diff --git a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/EditManagersBean.java b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/EditManagersBean.java index b816331768b4..7772d205296b 100644 --- a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/EditManagersBean.java +++ b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/EditManagersBean.java @@ -33,8 +33,8 @@ import javax.faces.model.SelectItem; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.coursemanagement.CourseSection; import org.sakaiproject.section.api.coursemanagement.ParticipationRecord; import org.sakaiproject.section.api.coursemanagement.User; @@ -53,7 +53,7 @@ public class EditManagersBean extends CourseDependentBean implements Serializabl private static final long serialVersionUID = 1L; - private static final Log log = LogFactory.getLog(EditManagersBean.class); + private static final Logger log = LoggerFactory.getLogger(EditManagersBean.class); // For the right-side list box protected List selectedUsers; diff --git a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/EditSectionBean.java b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/EditSectionBean.java index d9e8e9285e74..e8408dccc271 100644 --- a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/EditSectionBean.java +++ b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/EditSectionBean.java @@ -31,8 +31,8 @@ import javax.faces.event.ActionEvent; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.coursemanagement.CourseSection; import org.sakaiproject.tool.section.jsf.JsfUtil; @@ -45,7 +45,7 @@ public class EditSectionBean extends AddSectionsBean implements SectionEditor, Serializable { private static final long serialVersionUID = 1L; - private static final Log log = LogFactory.getLog(EditSectionBean.class); + private static final Logger log = LoggerFactory.getLogger(EditSectionBean.class); private String sectionUuid; private LocalSectionModel section; diff --git a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/EditStudentSectionsBean.java b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/EditStudentSectionsBean.java index 54cfcfed05a2..a9b9e34effda 100644 --- a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/EditStudentSectionsBean.java +++ b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/EditStudentSectionsBean.java @@ -34,8 +34,8 @@ import javax.faces.event.ActionEvent; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.coursemanagement.CourseSection; import org.sakaiproject.section.api.coursemanagement.EnrollmentRecord; import org.sakaiproject.section.api.coursemanagement.ParticipationRecord; @@ -54,7 +54,7 @@ */ public class EditStudentSectionsBean extends FilteredSectionListingBean implements Serializable { private static final long serialVersionUID = 1L; - private static final Log log = LogFactory.getLog(EditStudentSectionsBean.class); + private static final Logger log = LoggerFactory.getLogger(EditStudentSectionsBean.class); protected static final String UNASSIGNED = "unassigned"; diff --git a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/EditStudentsBean.java b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/EditStudentsBean.java index 097c207c8ebc..e68905764aca 100644 --- a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/EditStudentsBean.java +++ b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/EditStudentsBean.java @@ -31,8 +31,8 @@ import javax.faces.model.SelectItem; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.coursemanagement.CourseSection; import org.sakaiproject.section.api.coursemanagement.ParticipationRecord; import org.sakaiproject.section.api.coursemanagement.User; @@ -51,7 +51,7 @@ public class EditStudentsBean extends EditManagersBean implements Serializable { private static final long serialVersionUID = 1L; - private static final Log log = LogFactory.getLog(EditStudentsBean.class); + private static final Logger log = LoggerFactory.getLogger(EditStudentsBean.class); // For the "View" selectbox diff --git a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/FilteredSectionListingBean.java b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/FilteredSectionListingBean.java index 6c62419431a7..ac0f0b880fe3 100644 --- a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/FilteredSectionListingBean.java +++ b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/FilteredSectionListingBean.java @@ -31,8 +31,8 @@ import javax.faces.model.SelectItem; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.coursemanagement.CourseSection; import org.sakaiproject.section.api.coursemanagement.ParticipationRecord; import org.sakaiproject.tool.section.decorator.SectionDecorator; @@ -40,7 +40,7 @@ public abstract class FilteredSectionListingBean extends CourseDependentBean implements Serializable { private static final long serialVersionUID = 1L; - private static final Log log = LogFactory.getLog(FilteredSectionListingBean.class); + private static final Logger log = LoggerFactory.getLogger(FilteredSectionListingBean.class); public enum FilterState {NONE, COMPACT, SPLIT, SINGLE}; diff --git a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/InitializableBean.java b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/InitializableBean.java index 928982574fdd..f76863cabc76 100644 --- a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/InitializableBean.java +++ b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/InitializableBean.java @@ -20,8 +20,8 @@ **********************************************************************************/ package org.sakaiproject.tool.section.jsf.backingbean; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.jsf.model.PhaseAware; /** @@ -31,7 +31,7 @@ * */ public abstract class InitializableBean implements PhaseAware { - private static final Log logger = LogFactory.getLog(InitializableBean.class); + private static final Logger logger = LoggerFactory.getLogger(InitializableBean.class); private transient boolean notValidated; diff --git a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/LocalMeetingModel.java b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/LocalMeetingModel.java index 89498f6978bc..4a9f526f3fe7 100644 --- a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/LocalMeetingModel.java +++ b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/LocalMeetingModel.java @@ -27,13 +27,13 @@ import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.coursemanagement.Meeting; import org.sakaiproject.tool.section.jsf.JsfUtil; public class LocalMeetingModel implements Meeting, Serializable { - private static final Log log = LogFactory.getLog(LocalMeetingModel.class); + private static final Logger log = LoggerFactory.getLogger(LocalMeetingModel.class); private static final long serialVersionUID = 1L; public LocalMeetingModel() { diff --git a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/LocalSectionModel.java b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/LocalSectionModel.java index ae7d6e75955a..7272544e96d4 100644 --- a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/LocalSectionModel.java +++ b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/LocalSectionModel.java @@ -26,14 +26,14 @@ import java.util.List; import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.coursemanagement.Course; import org.sakaiproject.section.api.coursemanagement.CourseSection; import org.sakaiproject.section.api.coursemanagement.Meeting; public class LocalSectionModel implements CourseSection, Serializable { - private static final Log log = LogFactory.getLog(LocalSectionModel.class); + private static final Logger log = LoggerFactory.getLogger(LocalSectionModel.class); private static final long serialVersionUID = 1L; private Course course; diff --git a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/NavMenuBean.java b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/NavMenuBean.java index 554e0c81ce51..47b4099adc97 100644 --- a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/NavMenuBean.java +++ b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/NavMenuBean.java @@ -20,8 +20,8 @@ **********************************************************************************/ package org.sakaiproject.tool.section.jsf.backingbean; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.SectionManager; import org.sakaiproject.section.api.SectionManager.ExternalIntegrationConfig; @@ -33,7 +33,7 @@ * */ public class NavMenuBean extends CourseDependentBean { - private static final Log log = LogFactory.getLog(NavMenuBean.class); + private static final Logger log = LoggerFactory.getLogger(NavMenuBean.class); private static final long serialVersionUID = 1L; private boolean sectionTaManagementEnabled; diff --git a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/OptionsBean.java b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/OptionsBean.java index 781cf47b149f..103fb79024b9 100644 --- a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/OptionsBean.java +++ b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/OptionsBean.java @@ -23,8 +23,8 @@ import java.io.Serializable; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.SectionManager; import org.sakaiproject.section.api.SectionManager.ExternalIntegrationConfig; import org.sakaiproject.tool.section.jsf.JsfUtil; @@ -45,7 +45,7 @@ public class OptionsBean extends CourseDependentBean implements Serializable { private static final String EXTERNAL = "external"; private static final String INTERNAL = "internal"; - private static final Log log = LogFactory.getLog(OptionsBean.class); + private static final Logger log = LoggerFactory.getLogger(OptionsBean.class); private boolean selfRegister; private boolean selfSwitch; diff --git a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/OverviewBean.java b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/OverviewBean.java index 8e0daa82c224..1568fd99e73e 100644 --- a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/OverviewBean.java +++ b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/OverviewBean.java @@ -28,8 +28,8 @@ import java.util.List; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.SectionManager.ExternalIntegrationConfig; import org.sakaiproject.tool.section.decorator.SectionDecorator; import org.sakaiproject.tool.section.jsf.JsfUtil; @@ -43,7 +43,7 @@ public class OverviewBean extends FilteredSectionListingBean implements Serializable { private static final long serialVersionUID = 1L; - private static final Log log = LogFactory.getLog(OverviewBean.class); + private static final Logger log = LoggerFactory.getLogger(OverviewBean.class); private String instructions; private boolean externallyManaged; diff --git a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/RosterBean.java b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/RosterBean.java index 4aa9b5553474..5ece3f78495a 100644 --- a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/RosterBean.java +++ b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/RosterBean.java @@ -43,8 +43,8 @@ import javax.faces.model.SelectItem; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.myfaces.custom.sortheader.HtmlCommandSortHeader; import org.sakaiproject.jsf.spreadsheet.SpreadsheetDataFileWriterXls; import org.sakaiproject.jsf.spreadsheet.SpreadsheetUtil; @@ -65,7 +65,7 @@ public class RosterBean extends CourseDependentBean implements Serializable { private static final long serialVersionUID = 1L; - private static final Log log = LogFactory.getLog(RosterBean.class); + private static final Logger log = LoggerFactory.getLogger(RosterBean.class); private static final String CAT_COLUMN_PREFIX = "cat"; private String searchText; diff --git a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/StudentViewBean.java b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/StudentViewBean.java index 2edd5d62b4a0..d6fe1c8cabf1 100644 --- a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/StudentViewBean.java +++ b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/StudentViewBean.java @@ -35,8 +35,8 @@ import javax.faces.application.ViewHandler; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.coursemanagement.CourseSection; import org.sakaiproject.section.api.coursemanagement.EnrollmentRecord; import org.sakaiproject.section.api.exception.RoleConfigurationException; @@ -56,7 +56,7 @@ public class StudentViewBean extends EditStudentSectionsBean implements Serializ private static final long serialVersionUID = 1L; - private static final Log log = LogFactory.getLog(StudentViewBean.class); + private static final Logger log = LoggerFactory.getLogger(StudentViewBean.class); private boolean externallyManaged; private boolean joinAllowed; diff --git a/sections/sections-app/src/test/org/sakaiproject/test/section/AuthzTest.java b/sections/sections-app/src/test/org/sakaiproject/test/section/AuthzTest.java index adfa2f3f8512..481c147ebecf 100644 --- a/sections/sections-app/src/test/org/sakaiproject/test/section/AuthzTest.java +++ b/sections/sections-app/src/test/org/sakaiproject/test/section/AuthzTest.java @@ -24,8 +24,8 @@ import junit.framework.Assert; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.CourseManager; import org.sakaiproject.section.api.SectionManager; import org.sakaiproject.section.api.coursemanagement.Course; @@ -45,7 +45,7 @@ * */ public class AuthzTest extends SectionsTestBase{ - private static final Log log = LogFactory.getLog(AuthzTest.class); + private static final Logger log = LoggerFactory.getLogger(AuthzTest.class); private Authz authz; private Context context; diff --git a/sections/sections-app/src/test/org/sakaiproject/test/section/CourseManagerTest.java b/sections/sections-app/src/test/org/sakaiproject/test/section/CourseManagerTest.java index df58b4a8f815..a2e14c39d6b3 100644 --- a/sections/sections-app/src/test/org/sakaiproject/test/section/CourseManagerTest.java +++ b/sections/sections-app/src/test/org/sakaiproject/test/section/CourseManagerTest.java @@ -26,8 +26,8 @@ import junit.framework.Assert; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.CourseManager; import org.sakaiproject.section.api.SectionManager; import org.sakaiproject.section.api.coursemanagement.Course; @@ -38,7 +38,7 @@ import org.sakaiproject.component.section.support.UserManager; public class CourseManagerTest extends SectionsTestBase { - private static final Log log = LogFactory.getLog(CourseManagerTest.class); + private static final Logger log = LoggerFactory.getLogger(CourseManagerTest.class); private CourseManager courseManager; private SectionManager sectionManager; diff --git a/sections/sections-app/src/test/org/sakaiproject/test/section/SectionAwarenessTest.java b/sections/sections-app/src/test/org/sakaiproject/test/section/SectionAwarenessTest.java index 0af1c83e948c..c8f7badfb91e 100644 --- a/sections/sections-app/src/test/org/sakaiproject/test/section/SectionAwarenessTest.java +++ b/sections/sections-app/src/test/org/sakaiproject/test/section/SectionAwarenessTest.java @@ -25,8 +25,8 @@ import junit.framework.Assert; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.CourseManager; import org.sakaiproject.section.api.SectionAwareness; import org.sakaiproject.section.api.SectionManager; @@ -47,7 +47,7 @@ * */ public class SectionAwarenessTest extends SectionsTestBase{ - private static final Log log = LogFactory.getLog(SectionAwarenessTest.class); + private static final Logger log = LoggerFactory.getLogger(SectionAwarenessTest.class); private Context context; private SectionManager secMgr; diff --git a/sections/sections-app/src/test/org/sakaiproject/test/section/SectionManagerTest.java b/sections/sections-app/src/test/org/sakaiproject/test/section/SectionManagerTest.java index 4d33effd54fb..5502c84f5d52 100644 --- a/sections/sections-app/src/test/org/sakaiproject/test/section/SectionManagerTest.java +++ b/sections/sections-app/src/test/org/sakaiproject/test/section/SectionManagerTest.java @@ -28,8 +28,8 @@ import junit.framework.Assert; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.CourseManager; import org.sakaiproject.section.api.SectionManager; import org.sakaiproject.section.api.coursemanagement.Course; @@ -53,7 +53,7 @@ * */ public class SectionManagerTest extends SectionsTestBase{ - private static final Log log = LogFactory.getLog(SectionManagerTest.class); + private static final Logger log = LoggerFactory.getLogger(SectionManagerTest.class); private AuthnTestImpl authn; private Context context; diff --git a/sections/sections-app/src/test/org/sakaiproject/test/section/TimeConversionTest.java b/sections/sections-app/src/test/org/sakaiproject/test/section/TimeConversionTest.java index 41842d003e40..a0d370b66118 100644 --- a/sections/sections-app/src/test/org/sakaiproject/test/section/TimeConversionTest.java +++ b/sections/sections-app/src/test/org/sakaiproject/test/section/TimeConversionTest.java @@ -22,15 +22,15 @@ import java.sql.Time; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.section.jsf.JsfUtil; import junit.framework.Assert; import junit.framework.TestCase; public class TimeConversionTest extends TestCase { - private static final Log log = LogFactory.getLog(TimeConversionTest.class); + private static final Logger log = LoggerFactory.getLogger(TimeConversionTest.class); private class TimeObject { TimeObject(String startTime, boolean startTimeAm, String endTime, boolean endTimeAm) { diff --git a/sections/sections-app/src/test/org/sakaiproject/test/section/dataload/DataLoadTest.java b/sections/sections-app/src/test/org/sakaiproject/test/section/dataload/DataLoadTest.java index 94dba4def46d..0ffaa44bba80 100644 --- a/sections/sections-app/src/test/org/sakaiproject/test/section/dataload/DataLoadTest.java +++ b/sections/sections-app/src/test/org/sakaiproject/test/section/dataload/DataLoadTest.java @@ -26,8 +26,8 @@ import java.util.Iterator; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.CourseManager; import org.sakaiproject.section.api.SectionManager; import org.sakaiproject.section.api.coursemanagement.Course; @@ -39,7 +39,7 @@ import org.sakaiproject.test.section.SectionsTestBase; public class DataLoadTest extends SectionsTestBase { - private static Log log = LogFactory.getLog(DataLoadTest.class); + private static Logger log = LoggerFactory.getLogger(DataLoadTest.class); public DataLoadTest() { // Don't roll these tests back, since they are intended to load data diff --git a/sections/sections-app/src/test/org/sakaiproject/test/section/dataload/GradebookDataLoader.java b/sections/sections-app/src/test/org/sakaiproject/test/section/dataload/GradebookDataLoader.java index 8f9a28b7e739..2e9f16a91fd9 100644 --- a/sections/sections-app/src/test/org/sakaiproject/test/section/dataload/GradebookDataLoader.java +++ b/sections/sections-app/src/test/org/sakaiproject/test/section/dataload/GradebookDataLoader.java @@ -24,8 +24,8 @@ import java.util.Iterator; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.section.api.CourseManager; import org.sakaiproject.section.api.SectionManager; import org.sakaiproject.section.api.coursemanagement.Course; @@ -34,7 +34,7 @@ import org.sakaiproject.test.section.SectionsTestBase; public class GradebookDataLoader extends SectionsTestBase { - private static Log log = LogFactory.getLog(GradebookDataLoader.class); + private static Logger log = LoggerFactory.getLogger(GradebookDataLoader.class); public static final String[] SITE_UIDS = { "QA_1", diff --git a/shortenedurl/impl/src/java/org/sakaiproject/shortenedurl/impl/BaseShortenedUrlService.java b/shortenedurl/impl/src/java/org/sakaiproject/shortenedurl/impl/BaseShortenedUrlService.java index d3a0535096c7..b35d1574fcc8 100644 --- a/shortenedurl/impl/src/java/org/sakaiproject/shortenedurl/impl/BaseShortenedUrlService.java +++ b/shortenedurl/impl/src/java/org/sakaiproject/shortenedurl/impl/BaseShortenedUrlService.java @@ -1,7 +1,7 @@ package org.sakaiproject.shortenedurl.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.shortenedurl.api.ShortenedUrlService; @@ -14,7 +14,7 @@ */ public class BaseShortenedUrlService implements ShortenedUrlService { - private static Log log = LogFactory.getLog(BaseShortenedUrlService.class.getName()); + private static Logger log = LoggerFactory.getLogger(BaseShortenedUrlService.class.getName()); private ShortenedUrlService service; /** diff --git a/shortenedurl/impl/src/java/org/sakaiproject/shortenedurl/impl/BitlyUrlService.java b/shortenedurl/impl/src/java/org/sakaiproject/shortenedurl/impl/BitlyUrlService.java index 7e1b25251dc3..a02b36b4d1f3 100644 --- a/shortenedurl/impl/src/java/org/sakaiproject/shortenedurl/impl/BitlyUrlService.java +++ b/shortenedurl/impl/src/java/org/sakaiproject/shortenedurl/impl/BitlyUrlService.java @@ -10,8 +10,8 @@ import java.util.Map; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; @@ -33,7 +33,7 @@ */ public class BitlyUrlService implements ShortenedUrlService { - private static Log log = LogFactory.getLog(BitlyUrlService.class); + private static Logger log = LoggerFactory.getLogger(BitlyUrlService.class); private String login; private String apiKey; private final String BITLY_API_URL = "http://api.bit.ly/v3/shorten"; diff --git a/shortenedurl/impl/src/java/org/sakaiproject/shortenedurl/impl/NoOpUrlService.java b/shortenedurl/impl/src/java/org/sakaiproject/shortenedurl/impl/NoOpUrlService.java index 1dff6601d2a8..156747e7c610 100644 --- a/shortenedurl/impl/src/java/org/sakaiproject/shortenedurl/impl/NoOpUrlService.java +++ b/shortenedurl/impl/src/java/org/sakaiproject/shortenedurl/impl/NoOpUrlService.java @@ -1,7 +1,7 @@ package org.sakaiproject.shortenedurl.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.shortenedurl.api.ShortenedUrlService; /** @@ -12,7 +12,7 @@ */ public class NoOpUrlService implements ShortenedUrlService { - private static Log log = LogFactory.getLog(NoOpUrlService.class); + private static Logger log = LoggerFactory.getLogger(NoOpUrlService.class); public String shorten(String url) { log.info("NoOpUrlService returning original url"); diff --git a/shortenedurl/impl/src/java/org/sakaiproject/shortenedurl/impl/RandomisedUrlService.java b/shortenedurl/impl/src/java/org/sakaiproject/shortenedurl/impl/RandomisedUrlService.java index 797fa2390b3a..b6988fded11a 100755 --- a/shortenedurl/impl/src/java/org/sakaiproject/shortenedurl/impl/RandomisedUrlService.java +++ b/shortenedurl/impl/src/java/org/sakaiproject/shortenedurl/impl/RandomisedUrlService.java @@ -29,8 +29,8 @@ import org.apache.commons.lang.RandomStringUtils; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.Hibernate; import org.hibernate.HibernateException; import org.hibernate.Query; @@ -57,7 +57,7 @@ */ public class RandomisedUrlService extends HibernateDaoSupport implements ShortenedUrlService { - private static Log log = LogFactory.getLog(RandomisedUrlService.class); + private static Logger log = LoggerFactory.getLogger(RandomisedUrlService.class); //Hibernate stored queries private static final String QUERY_GET_URL = "getUrl"; diff --git a/signup/api/src/java/org/sakaiproject/signup/logic/messages/SignupEventTrackingInfo.java b/signup/api/src/java/org/sakaiproject/signup/logic/messages/SignupEventTrackingInfo.java index 12083a9db06b..e37125a28c51 100644 --- a/signup/api/src/java/org/sakaiproject/signup/logic/messages/SignupEventTrackingInfo.java +++ b/signup/api/src/java/org/sakaiproject/signup/logic/messages/SignupEventTrackingInfo.java @@ -1,122 +1,122 @@ -/* -* Licensed to The Apereo Foundation under one or more contributor license -* agreements. See the NOTICE file distributed with this work for -* additional information regarding copyright ownership. -* -* The Apereo Foundation licenses this file to you 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: -* -* http://opensource.org/licenses/ecl2.txt -* -* 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.sakaiproject.signup.logic.messages; - -import java.util.List; - -import org.sakaiproject.signup.logic.SignupTrackingItem; -import org.sakaiproject.signup.model.SignupAttendee; -import org.sakaiproject.signup.model.SignupMeeting; -import org.sakaiproject.signup.model.SignupTimeslot; - -/** - *

- * This interface provides the necessary access methods to retrieve all related - * information caused by an user action inside the Signup tool - *

- */ -public interface SignupEventTrackingInfo { - - /** - * get a list of SignupTrackingItem objects which contains all related - * information caused by an user action inside the Signup tool - * - * @return a list of SignupTrackingItem object - */ - public List getAttendeeTransferInfos(); - - /** - * add a new/updated user action information triggered by an user - * - * @param attendee - * an SignupAttendee object - * @param timeslot - * an SignupTimeslot object - * @param messageType - * a message type which defines what type of an action caused by - * the an user - * @param isInitiator - * boolean value - */ - public void addOrUpdateAttendeeAllocationInfo(SignupAttendee attendee, SignupTimeslot timeslot, String messageType, - boolean isInitiator); - - /** - * add a new/updated user action information triggered by an user - * - * @param attendee - * an SignupAttendee object - * @param timeslot - * an SignupTimeslot object - * @param messageType - * a message type which defines what type of an action caused by - * the an user - * @param isInitiator - * boolean value - * @param replacedAttendee - * an SignupAttendee object - */ - public void addOrUpdateAttendeeAllocationInfo(SignupAttendee attendee, SignupTimeslot timeslot, String messageType, - boolean isInitiator, SignupAttendee replacedAttendee); - - /** - * get the SignupMeeting object - * - * @return the SignupMeeting object - */ - public SignupMeeting getMeeting(); - - /** - * get the Initiator's SignupTrackingItem object - * - * @return the Initiator's SignupTrackingItem object - */ - public SignupTrackingItem getInitiatorAllocationInfo(); - - /** - * set the SignupMeeting object - * - * @param meeting - * a SignupMeeting object - */ - public void setMeeting(SignupMeeting meeting); - - /** - * get the Transfer Log Info for all users. It's for Log purpose - * - * @return a string value. - */ - public String getAllAttendeeTransferLogInfo(); - - /** - * set the attendeeComment object - * - * @param attendeeComment - * an AttendeeComment object - */ - public void setAttendeeComment(AttendeeComment attendeeComment); - - /** - * get the AttendeeComment object - * - * @return the AttendeeComment object - */ - public AttendeeComment getAttendeeComment(); -} \ No newline at end of file +/* +* Licensed to The Apereo Foundation under one or more contributor license +* agreements. See the NOTICE file distributed with this work for +* additional information regarding copyright ownership. +* +* The Apereo Foundation licenses this file to you 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: +* +* http://opensource.org/licenses/ecl2.txt +* +* 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.sakaiproject.signup.logic.messages; + +import java.util.List; + +import org.sakaiproject.signup.logic.SignupTrackingItem; +import org.sakaiproject.signup.model.SignupAttendee; +import org.sakaiproject.signup.model.SignupMeeting; +import org.sakaiproject.signup.model.SignupTimeslot; + +/** + *

+ * This interface provides the necessary access methods to retrieve all related + * information caused by an user action inside the Signup tool + *

+ */ +public interface SignupEventTrackingInfo { + + /** + * get a list of SignupTrackingItem objects which contains all related + * information caused by an user action inside the Signup tool + * + * @return a list of SignupTrackingItem object + */ + public List getAttendeeTransferInfos(); + + /** + * add a new/updated user action information triggered by an user + * + * @param attendee + * an SignupAttendee object + * @param timeslot + * an SignupTimeslot object + * @param messageType + * a message type which defines what type of an action caused by + * the an user + * @param isInitiator + * boolean value + */ + public void addOrUpdateAttendeeAllocationInfo(SignupAttendee attendee, SignupTimeslot timeslot, String messageType, + boolean isInitiator); + + /** + * add a new/updated user action information triggered by an user + * + * @param attendee + * an SignupAttendee object + * @param timeslot + * an SignupTimeslot object + * @param messageType + * a message type which defines what type of an action caused by + * the an user + * @param isInitiator + * boolean value + * @param replacedAttendee + * an SignupAttendee object + */ + public void addOrUpdateAttendeeAllocationInfo(SignupAttendee attendee, SignupTimeslot timeslot, String messageType, + boolean isInitiator, SignupAttendee replacedAttendee); + + /** + * get the SignupMeeting object + * + * @return the SignupMeeting object + */ + public SignupMeeting getMeeting(); + + /** + * get the Initiator's SignupTrackingItem object + * + * @return the Initiator's SignupTrackingItem object + */ + public SignupTrackingItem getInitiatorAllocationInfo(); + + /** + * set the SignupMeeting object + * + * @param meeting + * a SignupMeeting object + */ + public void setMeeting(SignupMeeting meeting); + + /** + * get the Transfer Logger Info for all users. It's for Logger purpose + * + * @return a string value. + */ + public String getAllAttendeeTransferLogInfo(); + + /** + * set the attendeeComment object + * + * @param attendeeComment + * an AttendeeComment object + */ + public void setAttendeeComment(AttendeeComment attendeeComment); + + /** + * get the AttendeeComment object + * + * @return the AttendeeComment object + */ + public AttendeeComment getAttendeeComment(); +} diff --git a/signup/api/src/java/org/sakaiproject/signup/model/SignupAttachment.java b/signup/api/src/java/org/sakaiproject/signup/model/SignupAttachment.java index 1fa9fa5f87d3..900bbbe1eb64 100644 --- a/signup/api/src/java/org/sakaiproject/signup/model/SignupAttachment.java +++ b/signup/api/src/java/org/sakaiproject/signup/model/SignupAttachment.java @@ -23,12 +23,12 @@ import java.net.URLEncoder; import java.util.Date; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class SignupAttachment { - private static Log log = LogFactory.getLog(SignupAttachment.class); + private static Logger log = LoggerFactory.getLogger(SignupAttachment.class); private String resourceId; private String filename; diff --git a/signup/impl/src/java/org/sakaiproject/signup/dao/SignupMeetingDaoImpl.java b/signup/impl/src/java/org/sakaiproject/signup/dao/SignupMeetingDaoImpl.java index e6b430a62448..f09e032caffa 100644 --- a/signup/impl/src/java/org/sakaiproject/signup/dao/SignupMeetingDaoImpl.java +++ b/signup/impl/src/java/org/sakaiproject/signup/dao/SignupMeetingDaoImpl.java @@ -1,340 +1,340 @@ -/* -* Licensed to The Apereo Foundation under one or more contributor license -* agreements. See the NOTICE file distributed with this work for -* additional information regarding copyright ownership. -* -* The Apereo Foundation licenses this file to you 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: -* -* http://opensource.org/licenses/ecl2.txt -* -* 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.sakaiproject.signup.dao; - -import java.util.Date; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.hibernate.Criteria; -import org.hibernate.criterion.DetachedCriteria; -import org.hibernate.criterion.Order; -import org.hibernate.criterion.Projections; -import org.hibernate.criterion.Restrictions; -import org.sakaiproject.genericdao.hibernate.HibernateGeneralGenericDao; -import org.sakaiproject.signup.model.SignupMeeting; -import org.sakaiproject.signup.model.SignupTimeslot; -import org.springframework.dao.DataAccessException; - -/** - *

- * SignupMeetingServiceImpl is an implementation of SignupMeetingDao interface, - * which provides methods to access the database storage for retrieving, - * creating, updating and removing SignupMeeting objects. - * - * @author Peter Liu - * - *

- */ -public class SignupMeetingDaoImpl extends HibernateGeneralGenericDao implements - SignupMeetingDao { - - private static Log log = LogFactory.getLog(SignupMeetingDaoImpl.class); - - public void init() { - log.debug("init"); - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - public List getAllSignupMeetings(String siteId) { - DetachedCriteria criteria = DetachedCriteria.forClass( - SignupMeeting.class).addOrder(Order.asc("startTime")) - .setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY) - .createCriteria("signupSites").add( - Restrictions.eq("siteId", siteId)); - return (List) getHibernateTemplate().findByCriteria(criteria); - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - public List getSignupMeetings(String siteId, - Date searchEndDate) { - DetachedCriteria criteria = DetachedCriteria.forClass( - SignupMeeting.class).add( - Restrictions.le("startTime", searchEndDate)).addOrder( - Order.asc("startTime")).createCriteria("signupSites").add( - Restrictions.eq("siteId", siteId)); - - return (List) getHibernateTemplate().findByCriteria(criteria); - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - public List getSignupMeetings(String siteId, Date startDate, - Date endDate) { - DetachedCriteria criteria = DetachedCriteria.forClass( - SignupMeeting.class).setResultTransformer( - Criteria.DISTINCT_ROOT_ENTITY) - .add(Restrictions.ge("endTime", startDate)) - .add(Restrictions.lt("startTime", endDate)) - .addOrder(Order.asc("startTime")).createCriteria("signupSites") - .add(Restrictions.eq("siteId", siteId)); - - return (List) getHibernateTemplate().findByCriteria(criteria); - } - - @SuppressWarnings("unchecked") - public List getSignupMeetingsInSite(String siteId, Date startDate, - Date endDate) { - DetachedCriteria criteria = DetachedCriteria.forClass( - SignupMeeting.class).setResultTransformer( - Criteria.DISTINCT_ROOT_ENTITY) - .add(Restrictions.ge("endTime", startDate)) - .add(Restrictions.lt("startTime", endDate)) - .addOrder(Order.asc("startTime")).createCriteria("signupSites") - .add(Restrictions.eq("siteId", siteId)); - - return (List) getHibernateTemplate().findByCriteria(criteria); - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - public List getSignupMeetingsInSites(List siteIds, Date startDate, - Date endDate) { - DetachedCriteria criteria = DetachedCriteria.forClass( - SignupMeeting.class).setResultTransformer( - Criteria.DISTINCT_ROOT_ENTITY) - .add(Restrictions.ge("endTime", startDate)) - .add(Restrictions.lt("startTime", endDate)) - .addOrder(Order.asc("startTime")).createCriteria("signupSites") - .add(Restrictions.in("siteId", siteIds)); - - return (List) getHibernateTemplate().findByCriteria(criteria); - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - public List getRecurringSignupMeetings(String siteId, - Long recurrenceId, Date currentTime) { - DetachedCriteria criteria = DetachedCriteria.forClass( - SignupMeeting.class).setResultTransformer( - Criteria.DISTINCT_ROOT_ENTITY).add( - Restrictions.eq("recurrenceId", recurrenceId)).add( - Restrictions.gt("endTime", currentTime)).addOrder( - Order.asc("startTime")).createCriteria("signupSites").add( - Restrictions.eq("siteId", siteId)); - - return (List) getHibernateTemplate().findByCriteria(criteria); - } - - /** - * {@inheritDoc} - */ - public Long saveMeeting(SignupMeeting signupMeeting) { - return (Long) getHibernateTemplate().save(signupMeeting); - } - - /** - * {@inheritDoc} - */ - public void saveMeetings(List signupMeetings) { - if (signupMeetings != null && signupMeetings.size() > 0) { - SignupMeeting sm = (SignupMeeting) signupMeetings.get(0); - if (sm.isRecurredMeeting()) { - Long reRecurId = (Long) getHibernateTemplate().save(sm); - /* - * use the first unique meeting id as the reRecurId for all - * recurring meetings - */ - for (SignupMeeting sMeeting : signupMeetings) { - sMeeting.setRecurrenceId(reRecurId); - } - - } - for (SignupMeeting signupMeeting : signupMeetings) { - getHibernateTemplate().saveOrUpdate(signupMeeting); - } - } - - } - - /** - * {@inheritDoc} - */ - public SignupMeeting loadSignupMeeting(Long meetingId) { - DetachedCriteria criteria = DetachedCriteria.forClass( - SignupMeeting.class).setResultTransformer( - Criteria.DISTINCT_ROOT_ENTITY).add( - Restrictions.eq("id", meetingId)); - List ls = (List) getHibernateTemplate().findByCriteria(criteria); - if (ls == null || ls.isEmpty()) - return null; - - return (SignupMeeting) ls.get(0); - - } - - /** - * {@inheritDoc} - */ - public void updateMeeting(SignupMeeting meeting) throws DataAccessException { - getHibernateTemplate().update(meeting); - - } - - - /** - * {@inheritDoc} - */ - public void updateMeetings(List meetings) - throws DataAccessException { - for (SignupMeeting meeting : meetings) { - getHibernateTemplate().saveOrUpdate(meeting); - } - } - - /** - * {@inheritDoc} - */ - public void updateModifiedMeetings(List meetings, List removedTimeslots) - throws DataAccessException { - for (SignupMeeting meeting : meetings) { - getHibernateTemplate().saveOrUpdate(meeting); - } - - /*remove the deleted timeslot and related attendees/wait-list people*/ - if(removedTimeslots !=null && removedTimeslots.size() > 0 ){ - for (SignupTimeslot ts : removedTimeslots) { - long tsId = ts.getId(); - SignupTimeslot sTimeslot = loadSignupTimeslot(tsId); - getHibernateTemplate().delete(sTimeslot); - } - } - - } - - private SignupTimeslot loadSignupTimeslot(Long timeslotId) { - DetachedCriteria criteria = DetachedCriteria.forClass( - SignupTimeslot.class).setResultTransformer( - Criteria.DISTINCT_ROOT_ENTITY).add( - Restrictions.eq("id", timeslotId)); - List ls = getHibernateTemplate().findByCriteria(criteria); - if (ls == null || ls.isEmpty()) - return null; - - return (SignupTimeslot) ls.get(0); - - } - - /** - * {@inheritDoc} - */ - public void removeMeetings(List meetings) { - getHibernateTemplate().deleteAll(meetings); - - } - - /** - * {@inheritDoc} - */ - public boolean isEventExisted(Long eventId) { - //TODO need test with lazy loading - SignupMeeting ls = loadSignupMeeting(eventId); - if (ls ==null) - return false; - - return true; - } - - /** - * {@inheritDoc} - */ - public int getAutoReminderTotalEventCounts(Date startDate, Date endDate) { - DetachedCriteria criteria = DetachedCriteria.forClass( - SignupMeeting.class).setResultTransformer( - Criteria.DISTINCT_ROOT_ENTITY).add(Restrictions.eq("autoReminder", true)) - .add(Restrictions.between("startTime", startDate, endDate)) - .setProjection(Projections.rowCount()); - - List ls = getHibernateTemplate().findByCriteria(criteria); - if (ls == null || ls.isEmpty()) - return 0; - - Integer rowCount = (Integer) ls.get(0); - - return rowCount !=null? rowCount.intValue():0; - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - public List getAutoReminderSignupMeetings(Date startDate, - Date endDate) { - DetachedCriteria criteria = DetachedCriteria.forClass( - SignupMeeting.class).setResultTransformer( - Criteria.DISTINCT_ROOT_ENTITY).add(Restrictions.eq("autoReminder", true)) - //.add(Restrictions.between("startTime", startDate, endDate)) - .add(Restrictions.le("startTime", endDate)) - .add(Restrictions.ge("endTime",startDate)) - .addOrder(Order.asc("startTime")); - - return (List) getHibernateTemplate().findByCriteria(criteria); - } - - @Override - public List getAllCategories(String siteId) throws DataAccessException { - DetachedCriteria criteria = DetachedCriteria.forClass( - SignupMeeting.class).setProjection(Projections.distinct(Projections.projectionList() - .add(Projections.property("category"), "category") )).setResultTransformer( - Criteria.DISTINCT_ROOT_ENTITY) - .addOrder(Order.asc("category")).createCriteria("signupSites") - .add(Restrictions.eq("siteId", siteId)); - - List categorys = (List) getHibernateTemplate().findByCriteria(criteria); - - if(categorys !=null && !categorys.isEmpty()){ - return categorys; - } - - return null; - } - - @Override - public List getAllLocations(String siteId) throws DataAccessException { - DetachedCriteria criteria = DetachedCriteria.forClass( - SignupMeeting.class).setProjection(Projections.distinct(Projections.projectionList() - .add(Projections.property("location"), "location") )).setResultTransformer( - Criteria.DISTINCT_ROOT_ENTITY) - .addOrder(Order.asc("location")).createCriteria("signupSites") - .add(Restrictions.eq("siteId", siteId)); - - List locations = (List) getHibernateTemplate().findByCriteria(criteria); - - if(locations !=null && !locations.isEmpty()){ - return locations; - } - - return null; - } - -} +/* +* Licensed to The Apereo Foundation under one or more contributor license +* agreements. See the NOTICE file distributed with this work for +* additional information regarding copyright ownership. +* +* The Apereo Foundation licenses this file to you 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: +* +* http://opensource.org/licenses/ecl2.txt +* +* 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.sakaiproject.signup.dao; + +import java.util.Date; +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.hibernate.Criteria; +import org.hibernate.criterion.DetachedCriteria; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.sakaiproject.genericdao.hibernate.HibernateGeneralGenericDao; +import org.sakaiproject.signup.model.SignupMeeting; +import org.sakaiproject.signup.model.SignupTimeslot; +import org.springframework.dao.DataAccessException; + +/** + *

+ * SignupMeetingServiceImpl is an implementation of SignupMeetingDao interface, + * which provides methods to access the database storage for retrieving, + * creating, updating and removing SignupMeeting objects. + * + * @author Peter Liu + * + *

+ */ +public class SignupMeetingDaoImpl extends HibernateGeneralGenericDao implements + SignupMeetingDao { + + private static Logger log = LoggerFactory.getLogger(SignupMeetingDaoImpl.class); + + public void init() { + log.debug("init"); + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public List getAllSignupMeetings(String siteId) { + DetachedCriteria criteria = DetachedCriteria.forClass( + SignupMeeting.class).addOrder(Order.asc("startTime")) + .setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY) + .createCriteria("signupSites").add( + Restrictions.eq("siteId", siteId)); + return (List) getHibernateTemplate().findByCriteria(criteria); + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public List getSignupMeetings(String siteId, + Date searchEndDate) { + DetachedCriteria criteria = DetachedCriteria.forClass( + SignupMeeting.class).add( + Restrictions.le("startTime", searchEndDate)).addOrder( + Order.asc("startTime")).createCriteria("signupSites").add( + Restrictions.eq("siteId", siteId)); + + return (List) getHibernateTemplate().findByCriteria(criteria); + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public List getSignupMeetings(String siteId, Date startDate, + Date endDate) { + DetachedCriteria criteria = DetachedCriteria.forClass( + SignupMeeting.class).setResultTransformer( + Criteria.DISTINCT_ROOT_ENTITY) + .add(Restrictions.ge("endTime", startDate)) + .add(Restrictions.lt("startTime", endDate)) + .addOrder(Order.asc("startTime")).createCriteria("signupSites") + .add(Restrictions.eq("siteId", siteId)); + + return (List) getHibernateTemplate().findByCriteria(criteria); + } + + @SuppressWarnings("unchecked") + public List getSignupMeetingsInSite(String siteId, Date startDate, + Date endDate) { + DetachedCriteria criteria = DetachedCriteria.forClass( + SignupMeeting.class).setResultTransformer( + Criteria.DISTINCT_ROOT_ENTITY) + .add(Restrictions.ge("endTime", startDate)) + .add(Restrictions.lt("startTime", endDate)) + .addOrder(Order.asc("startTime")).createCriteria("signupSites") + .add(Restrictions.eq("siteId", siteId)); + + return (List) getHibernateTemplate().findByCriteria(criteria); + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public List getSignupMeetingsInSites(List siteIds, Date startDate, + Date endDate) { + DetachedCriteria criteria = DetachedCriteria.forClass( + SignupMeeting.class).setResultTransformer( + Criteria.DISTINCT_ROOT_ENTITY) + .add(Restrictions.ge("endTime", startDate)) + .add(Restrictions.lt("startTime", endDate)) + .addOrder(Order.asc("startTime")).createCriteria("signupSites") + .add(Restrictions.in("siteId", siteIds)); + + return (List) getHibernateTemplate().findByCriteria(criteria); + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public List getRecurringSignupMeetings(String siteId, + Long recurrenceId, Date currentTime) { + DetachedCriteria criteria = DetachedCriteria.forClass( + SignupMeeting.class).setResultTransformer( + Criteria.DISTINCT_ROOT_ENTITY).add( + Restrictions.eq("recurrenceId", recurrenceId)).add( + Restrictions.gt("endTime", currentTime)).addOrder( + Order.asc("startTime")).createCriteria("signupSites").add( + Restrictions.eq("siteId", siteId)); + + return (List) getHibernateTemplate().findByCriteria(criteria); + } + + /** + * {@inheritDoc} + */ + public Long saveMeeting(SignupMeeting signupMeeting) { + return (Long) getHibernateTemplate().save(signupMeeting); + } + + /** + * {@inheritDoc} + */ + public void saveMeetings(List signupMeetings) { + if (signupMeetings != null && signupMeetings.size() > 0) { + SignupMeeting sm = (SignupMeeting) signupMeetings.get(0); + if (sm.isRecurredMeeting()) { + Long reRecurId = (Long) getHibernateTemplate().save(sm); + /* + * use the first unique meeting id as the reRecurId for all + * recurring meetings + */ + for (SignupMeeting sMeeting : signupMeetings) { + sMeeting.setRecurrenceId(reRecurId); + } + + } + for (SignupMeeting signupMeeting : signupMeetings) { + getHibernateTemplate().saveOrUpdate(signupMeeting); + } + } + + } + + /** + * {@inheritDoc} + */ + public SignupMeeting loadSignupMeeting(Long meetingId) { + DetachedCriteria criteria = DetachedCriteria.forClass( + SignupMeeting.class).setResultTransformer( + Criteria.DISTINCT_ROOT_ENTITY).add( + Restrictions.eq("id", meetingId)); + List ls = (List) getHibernateTemplate().findByCriteria(criteria); + if (ls == null || ls.isEmpty()) + return null; + + return (SignupMeeting) ls.get(0); + + } + + /** + * {@inheritDoc} + */ + public void updateMeeting(SignupMeeting meeting) throws DataAccessException { + getHibernateTemplate().update(meeting); + + } + + + /** + * {@inheritDoc} + */ + public void updateMeetings(List meetings) + throws DataAccessException { + for (SignupMeeting meeting : meetings) { + getHibernateTemplate().saveOrUpdate(meeting); + } + } + + /** + * {@inheritDoc} + */ + public void updateModifiedMeetings(List meetings, List removedTimeslots) + throws DataAccessException { + for (SignupMeeting meeting : meetings) { + getHibernateTemplate().saveOrUpdate(meeting); + } + + /*remove the deleted timeslot and related attendees/wait-list people*/ + if(removedTimeslots !=null && removedTimeslots.size() > 0 ){ + for (SignupTimeslot ts : removedTimeslots) { + long tsId = ts.getId(); + SignupTimeslot sTimeslot = loadSignupTimeslot(tsId); + getHibernateTemplate().delete(sTimeslot); + } + } + + } + + private SignupTimeslot loadSignupTimeslot(Long timeslotId) { + DetachedCriteria criteria = DetachedCriteria.forClass( + SignupTimeslot.class).setResultTransformer( + Criteria.DISTINCT_ROOT_ENTITY).add( + Restrictions.eq("id", timeslotId)); + List ls = getHibernateTemplate().findByCriteria(criteria); + if (ls == null || ls.isEmpty()) + return null; + + return (SignupTimeslot) ls.get(0); + + } + + /** + * {@inheritDoc} + */ + public void removeMeetings(List meetings) { + getHibernateTemplate().deleteAll(meetings); + + } + + /** + * {@inheritDoc} + */ + public boolean isEventExisted(Long eventId) { + //TODO need test with lazy loading + SignupMeeting ls = loadSignupMeeting(eventId); + if (ls ==null) + return false; + + return true; + } + + /** + * {@inheritDoc} + */ + public int getAutoReminderTotalEventCounts(Date startDate, Date endDate) { + DetachedCriteria criteria = DetachedCriteria.forClass( + SignupMeeting.class).setResultTransformer( + Criteria.DISTINCT_ROOT_ENTITY).add(Restrictions.eq("autoReminder", true)) + .add(Restrictions.between("startTime", startDate, endDate)) + .setProjection(Projections.rowCount()); + + List ls = getHibernateTemplate().findByCriteria(criteria); + if (ls == null || ls.isEmpty()) + return 0; + + Integer rowCount = (Integer) ls.get(0); + + return rowCount !=null? rowCount.intValue():0; + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public List getAutoReminderSignupMeetings(Date startDate, + Date endDate) { + DetachedCriteria criteria = DetachedCriteria.forClass( + SignupMeeting.class).setResultTransformer( + Criteria.DISTINCT_ROOT_ENTITY).add(Restrictions.eq("autoReminder", true)) + //.add(Restrictions.between("startTime", startDate, endDate)) + .add(Restrictions.le("startTime", endDate)) + .add(Restrictions.ge("endTime",startDate)) + .addOrder(Order.asc("startTime")); + + return (List) getHibernateTemplate().findByCriteria(criteria); + } + + @Override + public List getAllCategories(String siteId) throws DataAccessException { + DetachedCriteria criteria = DetachedCriteria.forClass( + SignupMeeting.class).setProjection(Projections.distinct(Projections.projectionList() + .add(Projections.property("category"), "category") )).setResultTransformer( + Criteria.DISTINCT_ROOT_ENTITY) + .addOrder(Order.asc("category")).createCriteria("signupSites") + .add(Restrictions.eq("siteId", siteId)); + + List categorys = (List) getHibernateTemplate().findByCriteria(criteria); + + if(categorys !=null && !categorys.isEmpty()){ + return categorys; + } + + return null; + } + + @Override + public List getAllLocations(String siteId) throws DataAccessException { + DetachedCriteria criteria = DetachedCriteria.forClass( + SignupMeeting.class).setProjection(Projections.distinct(Projections.projectionList() + .add(Projections.property("location"), "location") )).setResultTransformer( + Criteria.DISTINCT_ROOT_ENTITY) + .addOrder(Order.asc("location")).createCriteria("signupSites") + .add(Restrictions.eq("siteId", siteId)); + + List locations = (List) getHibernateTemplate().findByCriteria(criteria); + + if(locations !=null && !locations.isEmpty()){ + return locations; + } + + return null; + } + +} diff --git a/signup/impl/src/java/org/sakaiproject/signup/logic/SakaiFacadeImpl.java b/signup/impl/src/java/org/sakaiproject/signup/logic/SakaiFacadeImpl.java index 3d0a0af14b2c..c779a595d4a8 100644 --- a/signup/impl/src/java/org/sakaiproject/signup/logic/SakaiFacadeImpl.java +++ b/signup/impl/src/java/org/sakaiproject/signup/logic/SakaiFacadeImpl.java @@ -1,1467 +1,1467 @@ -/* -* Licensed to The Apereo Foundation under one or more contributor license -* agreements. See the NOTICE file distributed with this work for -* additional information regarding copyright ownership. -* -* The Apereo Foundation licenses this file to you 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: -* -* http://opensource.org/licenses/ecl2.txt -* -* 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.sakaiproject.signup.logic; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.sakaiproject.authz.api.AuthzGroupService; -import org.sakaiproject.authz.api.FunctionManager; -import org.sakaiproject.authz.api.Member; -import org.sakaiproject.authz.api.Role; -import org.sakaiproject.authz.api.SecurityAdvisor; -import org.sakaiproject.authz.api.SecurityService; -import org.sakaiproject.calendar.api.Calendar; -import org.sakaiproject.calendar.api.CalendarEdit; -import org.sakaiproject.calendar.api.CalendarService; -import org.sakaiproject.component.api.ServerConfigurationService; -import org.sakaiproject.component.cover.ComponentManager; -import org.sakaiproject.content.api.ContentHostingService; -import org.sakaiproject.exception.IdInvalidException; -import org.sakaiproject.exception.IdUnusedException; -import org.sakaiproject.exception.IdUsedException; -import org.sakaiproject.exception.PermissionException; -import org.sakaiproject.signup.model.SignupGroup; -import org.sakaiproject.signup.model.SignupMeeting; -import org.sakaiproject.signup.model.SignupSite; -import org.sakaiproject.site.api.Group; -import org.sakaiproject.site.api.Site; -import org.sakaiproject.site.api.SitePage; -import org.sakaiproject.site.api.SiteService; -import org.sakaiproject.site.api.ToolConfiguration; -import org.sakaiproject.time.api.TimeService; -import org.sakaiproject.tool.api.SessionManager; -import org.sakaiproject.tool.api.ToolManager; -import org.sakaiproject.user.api.User; -import org.sakaiproject.user.api.UserDirectoryService; -import org.sakaiproject.user.api.UserNotDefinedException; -import org.sakaiproject.util.ResourceLoader; - -/** - *

- * This is an implementation of SakaiFacade interface and it provides all - * necessary methods, which are depend on the Sakai Services. This will allow - * the separation of Signup Tool and the Sakai Tools - *

- * - * @author gl256 - * - */ -public class SakaiFacadeImpl implements SakaiFacade { - - private static Log log = LogFactory.getLog(SakaiFacadeImpl.class); - - private FunctionManager functionManager; - - private static ResourceLoader rb= new ResourceLoader(); - - /** - * set a Sakai FunctionManager object - * - * @param functionManager - * a Sakai FunctionManager object - */ - public void setFunctionManager(FunctionManager functionManager) { - this.functionManager = functionManager; - } - - private ToolManager toolManager; - - /** - * set a Sakai ToolManager object - * - * @param toolManager - * a Sakai ToolManager object - */ - public void setToolManager(ToolManager toolManager) { - this.toolManager = toolManager; - } - - /** - * get the ToolManager object. - * - * @return a ToolManager object. - */ - public ToolManager getToolManager() { - return this.toolManager; - } - - private SecurityService securityService; - - /** - * set a Sakai SecurityService object - * - * @param securityService - * a Sakai SecurityService object - */ - public void setSecurityService(SecurityService securityService) { - this.securityService = securityService; - } - - private SessionManager sessionManager; - - /** - * set a Sakai SessionManager object - * - * @param sessionManager - * a Sakai SessionManager object - */ - public void setSessionManager(SessionManager sessionManager) { - this.sessionManager = sessionManager; - } - - private SiteService siteService; - - /** - * set a Sakai SiteService object - * - * @param siteService - * a Sakai SiteService object - */ - public void setSiteService(SiteService siteService) { - this.siteService = siteService; - } - - /** - * {@inheritDoc} - */ - public SiteService getSiteService() { - return siteService; - } - - private UserDirectoryService userDirectoryService; - - /** - * set a Sakai UserDirectoryService object - * - * @param userDirectoryService - * a Sakai UserDirectoryService object - */ - public void setUserDirectoryService(UserDirectoryService userDirectoryService) { - this.userDirectoryService = userDirectoryService; - } - - private CalendarService calendarService; - - /** - * set a Sakai CalendarService object - * - * @param calendarService - * a Sakai CalendarService object - */ - public void setCalendarService(CalendarService calendarService) { - this.calendarService = calendarService; - } - - private ServerConfigurationService serverConfigurationService; - - /** - * {@inheritDoc} - */ - public ServerConfigurationService getServerConfigurationService() { - return serverConfigurationService; - } - - /** - * set a Sakai ServerConfigurationService object - * - * @param serverConfigurationService - * a Sakai ServerConfigurationService object - */ - public void setServerConfigurationService(ServerConfigurationService serverConfigurationService) { - this.serverConfigurationService = serverConfigurationService; - } - - private AuthzGroupService authzGroupService; - public AuthzGroupService getAuthzGroupService() { - return authzGroupService; - } - public void setAuthzGroupService(AuthzGroupService authzGroupService) { - this.authzGroupService=authzGroupService; - } - // Returns Google calendar if the calendar has been created in Google - public Calendar getAdditionalCalendar(String siteId) throws PermissionException { - CalendarService additionalCalendarService = null; - additionalCalendarService = (CalendarService) ComponentManager.get(CalendarService.ADDITIONAL_CALENDAR); - if (additionalCalendarService != null){ - if (additionalCalendarService.isCalendarToolInitialized(siteId)) { - try { - return additionalCalendarService.getCalendar(siteId); - } catch (IdUnusedException e) { - log.error("Error retrieving Calendar." + e.getMessage()); - } - } - } - return null; - } - - /** - * regist all the permission levels, which Signup Tool required. Place any - * code that should run when this class is initialized by spring here - */ - public void init() { - log.debug("init"); - // register Sakai permissions for this tool - functionManager.registerFunction(SIGNUP_VIEW); - functionManager.registerFunction(SIGNUP_VIEW_ALL); - functionManager.registerFunction(SIGNUP_ATTEND); - functionManager.registerFunction(SIGNUP_ATTEND_ALL); - functionManager.registerFunction(SIGNUP_CREATE_SITE); - functionManager.registerFunction(SIGNUP_CREATE_GROUP); - functionManager.registerFunction(SIGNUP_CREATE_GROUP_ALL); - functionManager.registerFunction(SIGNUP_DELETE_SITE); - functionManager.registerFunction(SIGNUP_DELETE_GROUP); - functionManager.registerFunction(SIGNUP_DELETE_GROUP_ALL); - functionManager.registerFunction(SIGNUP_UPDATE_SITE); - functionManager.registerFunction(SIGNUP_UPDATE_GROUP); - functionManager.registerFunction(SIGNUP_UPDATE_GROUP_ALL); - } - - /** - * {@inheritDoc} - */ - public boolean isUserAdmin(String userId) { - return securityService.isSuperUser(userId); - } - - /** - * {@inheritDoc} - */ - public String getCurrentUserId() { - return sessionManager.getCurrentSessionUserId(); - } - - /** - * {@inheritDoc} - */ - public User getUser(String userId) { - try { - return userDirectoryService.getUser(userId); - } catch (UserNotDefinedException e) { - log.warn("Cannot get user for id: " + userId); - return null; - } - } - - /** - * {@inheritDoc} - */ - public User getUserQuietly(String userId) { - try { - return userDirectoryService.getUser(userId); - } catch (UserNotDefinedException e) { - log.debug("User with id: " + userId + " does not exist : " + e.getClass() + " : " + e.getMessage()); - return null; - } - } - - /** - * {@inheritDoc} - */ - public boolean checkForUser(String userId) { - try { - User u = userDirectoryService.getUser(userId); - if (u != null) { - return true; - } - } catch (UserNotDefinedException e) { - log.debug("User with id: " + userId + " does not exist : " + e.getClass() + " : " + e.getMessage()); - } - return false; - } - - /** - * {@inheritDoc} - */ - public String getUserDisplayName(String userId) { - try { - return userDirectoryService.getUser(userId).getDisplayName(); - } catch (UserNotDefinedException e) { - log.warn("Cannot get user displayname for id: " + userId); - return "--------"; - } - } - - /** - * {@inheritDoc} - */ - public String getUserDisplayLastFirstName(String userId) { - try { - String dispLastName= userDirectoryService.getUser(userId).getLastName(); - if(dispLastName !=null){ - dispLastName = StringUtils.lowerCase(dispLastName, rb.getLocale()); - dispLastName = StringUtils.capitalize(dispLastName); - } - String dispFirstName = userDirectoryService.getUser(userId).getFirstName(); - if(dispFirstName !=null){ - dispFirstName = StringUtils.lowerCase(dispFirstName, rb.getLocale()); - dispFirstName = StringUtils.capitalize(dispFirstName); - } - String displayname = null; - if(( dispLastName ==null || dispLastName.isEmpty()) && (dispFirstName ==null || dispFirstName.isEmpty()) ){ - //Case: local user can have no first and last names - displayname = userDirectoryService.getUser(userId).getDisplayId(); - } - else{ - displayname = dispLastName +", " + dispFirstName; - } - - return displayname; - } catch (UserNotDefinedException e) { - log.warn("Cannot get user displayname for id: " + userId); - return "--------"; - } - } - - /** - * {@inheritDoc} - */ - public String getCurrentLocationId() { - try { - return toolManager.getCurrentPlacement().getContext(); - } catch (Exception e) { - log.info("Failed to get current location id"); - return NO_LOCATION; - } - } - - /** - * {@inheritDoc} - */ - public String getCurrentPageId() { - return getSiteSignupPageId(getCurrentLocationId()); - } - - /** - * {@inheritDoc} - */ - public String getSiteSignupPageId(String siteId) { - try { - Site appliedSite = siteService.getSite(siteId); - String signupToolId=null; - try{ - signupToolId = toolManager.getCurrentPlacement().getToolId(); - } - catch (Exception e){ - /*for case: cronJob or web-service etc.*/ - signupToolId = toolManager.getTool("sakai.signup").getId(); - } - - SitePage page = null; - List pageList = appliedSite.getPages(); - for (int i = 0; i < pageList.size(); i++) { - page = (SitePage) pageList.get(i); - List pageToolList = page.getTools(); - if (pageToolList != null && !pageToolList.isEmpty()) { - /* take first one only for efficiency */ - ToolConfiguration toolConf = (ToolConfiguration) pageToolList.get(0); - if (toolConf != null) { - String toolId = toolConf.getToolId(); - if (toolId.equalsIgnoreCase(signupToolId)) { - return page.getId(); - } - } - } - - } - } catch (Exception e) { - log.warn("Failed to get current page id"); - } - return ""; - } - - /** - * {@inheritDoc} - */ - public String getLocationTitle(String locationId) { - try { - Site site = siteService.getSite(locationId); - return site.getTitle(); - } catch (IdUnusedException e) { - log.warn("Cannot get the info about locationId: " + locationId); - return "----------"; - } - } - - /** - * {@inheritDoc} - */ - public List getUserPublishedSiteIds(String userId){ - List siteIds = new ArrayList(); - /*all sites for current user*/ - List tempL = siteService.getSites(SiteService.SelectionType.ACCESS, null, null, null, - SiteService.SortType.TITLE_ASC, null); - - for (Iterator iter = tempL.iterator(); iter.hasNext();) { - Site element = (Site) iter.next(); - // exclude my workspace & admin related sites - if (!siteService.isUserSite(element.getId()) && !siteService.isSpecialSite(element.getId())) { - // if the tools is not available in the site then don't add it. - Collection tools = element.getTools("sakai.signup"); - if (tools == null || tools.isEmpty()) - continue; - - if(element.isPublished()){ - siteIds.add(element.getId()); - } - } - - } - - return siteIds; - } - - /** - * {@inheritDoc} - */ - public List getUserSites(String userId) { - List signupSites = new ArrayList(); - List tempL = siteService.getSites(SiteService.SelectionType.ACCESS, null, null, null, - SiteService.SortType.TITLE_ASC, null); - - /*Case: Admin is not a member of current site and add it - * in order to let Admin create meetings*/ - if(isUserAdmin(getCurrentUserId())){ - String currentSitId = getCurrentLocationId(); - Site curSite=null; - try { - curSite =getSiteService().getSite(currentSitId); - } catch (IdUnusedException e) { - log.warn("IdUnusedException:" + e.getMessage()); - } - if(currentSitId !=null && curSite !=null){ - boolean foundSite=false; - for (Site s : tempL) { - if(currentSitId.equals(s.getId())){ - foundSite=true; - break; - } - } - if(!foundSite){ - tempL.add(curSite); - } - } - } - - for (Iterator iter = tempL.iterator(); iter.hasNext();) { - Site element = (Site) iter.next(); - // exclude my workspace & admin related sites - if (!siteService.isUserSite(element.getId()) && !siteService.isSpecialSite(element.getId())) { - // if the tools is not available in the site then don't add it. - Collection tools = element.getTools("sakai.signup"); - if (tools == null || tools.isEmpty()) - continue; - - SignupSite tmpSite = new SignupSite(); - tmpSite.setSiteId(element.getId()); - tmpSite.setTitle(element.getTitle()); - signupSites.add(tmpSite); - List groupList = new ArrayList(); - Collection tmpGroup = element.getGroups(); - for (Iterator iterator = tmpGroup.iterator(); iterator.hasNext();) { - Group grp = (Group) iterator.next(); - - //signup-51 don't show the hidden groups (if property exists, skip this group) - String gProp = grp.getProperties().getProperty(GROUP_PROP_SIGNUP_IGNORE); - if (gProp != null && gProp.equals(Boolean.TRUE.toString())) { - continue; - } - - SignupGroup sgrp = new SignupGroup(); - sgrp.setGroupId(grp.getId()); - sgrp.setTitle(grp.getTitle()); - groupList.add(sgrp); - } - tmpSite.setSignupGroups(groupList); - } - - } - return signupSites; - } - - /** - * {@inheritDoc} - */ - public boolean isAllowedGroup(String userId, String permission, String siteId, String groupId) { - return isAllowed(userId, permission, siteService.siteGroupReference(siteId, groupId)); - } - - /** - * {@inheritDoc} - */ - public boolean isAllowedSite(String userId, String permission, String siteId) { - return isAllowed(userId, permission, siteService.siteReference(siteId)); - } - - /* check permission */ - private boolean isAllowed(String userId, String permission, String realmId) { - if (securityService.unlock(userId, permission, realmId)) { - return true; - } - return false; - } - - /** - * {@inheritDoc} - */ - public String getUserId(String eid) throws UserNotDefinedException { - return userDirectoryService.getUserId(eid); - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - public List getAllUsers(SignupMeeting meeting) { - List signupSites = meeting.getSignupSites(); - Set signupUsers = new TreeSet(); - for (SignupSite signupSite : signupSites) { - if (signupSite.isSiteScope()) { - getUsersForSiteWithSiteScope(signupUsers, signupSite); - } else { - List signupGroups = signupSite.getSignupGroups(); - for (SignupGroup signupGroup : signupGroups) { - getUsersForGroup(signupUsers, signupSite, signupGroup); - } - } - - } - return new ArrayList(signupUsers); - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - public List getAllPossibleAttendees(SignupMeeting meeting){ - List signupSites = meeting.getSignupSites(); - Set signupUsers = new TreeSet(); - for (SignupSite signupSite : signupSites) { - if (signupSite.isSiteScope()) { - getAttendeesForSiteWithSiteScope(signupUsers, signupSite); - } else { - List signupGroups = signupSite.getSignupGroups(); - for (SignupGroup signupGroup : signupGroups) { - getAttendeesForGroup(signupUsers, signupSite, signupGroup); - } - } - - } - return new ArrayList(signupUsers); - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - public List getAllPossibleCoordinators(SignupMeeting meeting) { - List coordinators = new ArrayList(); - List signUpUsers = getAllUsers(meeting); - List signupSites = meeting.getSignupSites(); - Set userIdsHasPermissionToCreate = new HashSet(); - if (signupSites != null) { - for (SignupSite site: signupSites) { - userIdsHasPermissionToCreate.addAll(getUserIdsHasPermissionToCreate(site)); - } - } - for (SignupUser signUpUser: signUpUsers) { - if (userIdsHasPermissionToCreate.contains(signUpUser.getInternalUserId())) { - coordinators.add(signUpUser); - } - } - return coordinators; - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - public List getAllPossbileCoordinatorsOnFastTrack(SignupMeeting meeting) { - List coordinators = new ArrayList(); - List signupSites = meeting.getSignupSites(); - Set userIdsHasPermissionToCreate = new HashSet(); - if (signupSites != null) { - for (SignupSite site: signupSites) { - //Only thing we miss here is that the view permission is not checked. the Chance is very small. - userIdsHasPermissionToCreate.addAll(getUserIdsHasPermissionToCreate(site)); - } - } - - List sakaiUsers = userDirectoryService.getUsers(userIdsHasPermissionToCreate); - for (User user : sakaiUsers) { - SignupUser signupUser = new SignupUser(user.getEid(), user.getId(), user.getFirstName(), user.getLastName(), - null, "", true); - coordinators.add(signupUser); - } - - return coordinators; - } - - private Set getUserIdsHasPermissionToCreate(SignupSite site) { - Set userIds = new HashSet(); - userIds.addAll(getUserIdsWithPermission(SIGNUP_CREATE_SITE, site.getSiteId())); - if (!site.isSiteScope()) { - List signupGroups = site.getSignupGroups(); - for (SignupGroup group: signupGroups) { - userIds.addAll(getUserIdsWithPermission(SIGNUP_CREATE_GROUP_ALL, site.getSiteId(), group.getGroupId())); - userIds.addAll(getUserIdsWithPermission(SIGNUP_CREATE_GROUP, site.getSiteId(), group.getGroupId())); - } - } - return userIds; - } - - private List getUserIdsWithPermission(String permission, String siteId) { - return getUserIdsWithPermissionOnRealm(permission, siteService.siteReference(siteId)); - } - - private List getUserIdsWithPermission(String permission, String siteId, String groupId) { - return getUserIdsWithPermissionOnRealm(permission, siteService.siteGroupReference(siteId, groupId)); - } - - private List getUserIdsWithPermissionOnRealm(String permission, String realmId) { - List rv = new ArrayList(); - for (User user: securityService.unlockUsers(permission, realmId)) { - rv.add(user.getId()); - } - return rv; - } - - - /** - * {@inheritDoc} - */ - public SignupUser getSignupUser(SignupMeeting meeting, String userId){ - SignupUser signupUser=null; - List signupSites = meeting.getSignupSites(); - SignupSite currentSignupSite=null; - for (SignupSite signupSite : signupSites) { - Site site = null; - try { - site = siteService.getSite(signupSite.getSiteId()); - } catch (IdUnusedException e) { - log.error(e.getMessage(), e); - } - - if (site == null) - continue; - - if(site.getId().equals(signupSite.getSiteId())) - currentSignupSite=signupSite; - - /*Case 1: User is required to be a site member*/ - Member member = site.getMember(userId); - if (member ==null || !member.isActive()) - continue; - - if (hasPermissionToAttend(signupSite,userId)) { - User user = getUser(member.getUserId()); - if (user != null) { - SignupUser sUser = new SignupUser(member.getUserEid(), member.getUserId(), "", member.getUserEid(), - member.getRole(), site.getId(), site.isPublished()); - - if(signupUser ==null ){ - signupUser =sUser; - } - else if(sUser.isPublishedSite() && sUser.getMainSiteId().equals(getCurrentLocationId())){ - return sUser; - } - else if(!signupUser.isPublishedSite() && sUser.isPublishedSite()) - signupUser =sUser; - } - else - log.info("user is not found from 'userDirectoryService' for userId:" + member.getUserId()); - } - - }//end of for - - /*Case 2: site has '.auth' roleId and user is not required to be a site member*/ - if(signupUser ==null){ - signupUser = getSignupUserForLoginRequiredOnlySite(currentSignupSite,userId); - } - - return signupUser; - } - - /** - * {@inheritDoc} - */ - public List getUsersWithPermission(String permission) { - - try { - //current site - Site currentSite = siteService.getSite(getCurrentLocationId()); - - //get userids with permission in this site/azg - Set usersWithPermission = authzGroupService.getUsersIsAllowed(permission, Collections.singletonList(currentSite.getReference())); - - //get Users - return userDirectoryService.getUsers(usersWithPermission); - } catch (Exception e) { - log.error("getUsersWithPermission exception: " + e.getClass() + ":" + e.getMessage()); - } - return Collections.EMPTY_LIST; - } - - - private boolean hasPermissionToAttend(SignupSite site, String userId){ - if(isAllowedSite(userId, SIGNUP_ATTEND_ALL, site.getSiteId())) - return true; - - if (site.isSiteScope()) { - if (isAllowedSite(userId, SIGNUP_ATTEND, site.getSiteId())) - return true; - } else { - List signupGroups = site.getSignupGroups(); - for (SignupGroup group : signupGroups) { - if(isAllowedGroup(userId, SIGNUP_ATTEND, site.getSiteId(), group.getGroupId())) - return true; - } - } - - return false; - } - - public boolean hasPermissionToCreate(SignupMeeting meeting, String userId){ - - List signupSites = meeting.getSignupSites(); - if(signupSites !=null){ - for (SignupSite site : signupSites) { - if(isAllowedSite(userId, SIGNUP_CREATE_SITE, site.getSiteId())) - return true; - - if (site.isSiteScope()) { - if (isAllowedSite(userId, SIGNUP_CREATE_SITE, site.getSiteId())) - return true; - } else { - List signupGroups = site.getSignupGroups(); - for (SignupGroup group : signupGroups) { - if(isAllowedGroup(userId, SIGNUP_CREATE_GROUP_ALL, site.getSiteId(), group.getGroupId()) || isAllowedGroup(userId, SIGNUP_CREATE_GROUP, site.getSiteId(), group.getGroupId())) - return true; - } - } - - } - } - - return false; - } - - /*If site has roleId '.auth', any user is OK if logged in*/ - private SignupUser getSignupUserForLoginRequiredOnlySite(SignupSite signupSite, String userId){ - SignupUser signupUser=null; - Site site=null; - try { - site = siteService.getSite(signupSite.getSiteId()); - } catch (IdUnusedException e) { - log.error(e.getMessage(), e); - } - - if (site == null) - return null; - - Set siteRoles = site.getRoles(); - if(siteRoles !=null){ - for (Iterator iter = siteRoles.iterator(); iter.hasNext();) { - Role role = (Role) iter.next(); - if(REALM_ID_FOR_LOGIN_REQUIRED_ONLY.equals(role.getId())){ - if(hasPermissionToAttend(signupSite,userId)){ - User user = getUser(userId); - if(user !=null) - signupUser = new SignupUser(user.getEid(), userId, user.getFirstName(), user.getLastName(), - role, site.getId(), site.isPublished()); - break; - } - } - - } - } - - return signupUser; - } - - /* get all users in a specific group */ - @SuppressWarnings("unchecked") - private void getUsersForGroup(Set signupUsers, SignupSite signupSite, SignupGroup signupGroup) { - Site site = null; - try { - site = siteService.getSite(signupSite.getSiteId()); - } catch (IdUnusedException e) { - log.error("Cannot get the info about siteId: " + e.getMessage()); - return; - } - Group group = site.getGroup(signupGroup.getGroupId()); - if (group == null) - return; - Set members = group.getMembers(); - - //SIGNUP-241 : get bulk SakaiUsers for performance - List userIds = new ArrayList(); - Map memberRoleMap = new Hashtable(); - for (Member member : members) { - if (member.isActive() - && (hasPredefinedViewPermisson(member) - || isAllowedGroup(member.getUserId(), SIGNUP_VIEW, site.getId(), group.getId()) || isAllowedSite( - member.getUserId(), SIGNUP_VIEW_ALL, site.getId()))) { - //User user = getUserQuietly(member.getUserId()); - memberRoleMap.put(member.getUserId(), member.getRole()); - userIds.add(member.getUserId()); - } - } - - addAndPopulateSignupUsersInfo(signupUsers,memberRoleMap,userIds, site); - } - - private void addAndPopulateSignupUsersInfo(Set signupUsers, Map memberRoleMap, List userIds, Site site){ - //it should filter out non-existing userIds - List sakaiUsers = userDirectoryService.getUsers(userIds); - - if(sakaiUsers !=null){ - for (User user : sakaiUsers) { - SignupUser signupUser = new SignupUser(user.getEid(), user.getId(), user.getFirstName(), user.getLastName(), - memberRoleMap.get(user.getId()), site.getId(), site.isPublished()); - processAddOrUpdateSignupUsers(signupUsers, signupUser); - // comment: member.getUserDisplayId() not used - } - } - - } - - /* get all users in a specific group */ - @SuppressWarnings("unchecked") - private void getAttendeesForGroup(Set signupUsers, SignupSite signupSite, SignupGroup signupGroup) { - Site site = null; - try { - site = siteService.getSite(signupSite.getSiteId()); - } catch (IdUnusedException e) { - log.error("Cannot get the info about siteId: " + e.getMessage()); - return; - } - Group group = site.getGroup(signupGroup.getGroupId()); - if (group == null) - return; - Set members = group.getMembers(); - - //SIGNUP-241 : get bulk SakaiUsers for performance - List userIds = new ArrayList(); - Map memberRoleMap = new Hashtable(); - for (Member member : members) { - if (member.isActive() - && (hasPredefinedViewPermisson(member) - || isAllowedGroup(member.getUserId(), SIGNUP_ATTEND, site.getId(), group.getId()) || isAllowedSite( - member.getUserId(), SIGNUP_ATTEND_ALL, site.getId()))) { - memberRoleMap.put(member.getUserId(), member.getRole()); - userIds.add(member.getUserId()); - } - } - - addAndPopulateSignupUsersInfo(signupUsers,memberRoleMap,userIds, site); - } - - private boolean hasPredefinedViewPermisson(Member member) { - /* - * just assume student role has the signup.view permission and could add - * more roles to exclude - */ - return STUDENT_ROLE_ID.equalsIgnoreCase(member.getRole().getId()); - } - - /* get all users in a site */ - @SuppressWarnings("unchecked") - private void getUsersForSiteWithSiteScope(Set signupUsers, SignupSite signupSite) { - Site site = null; - try { - site = siteService.getSite(signupSite.getSiteId()); - } catch (IdUnusedException e) { - log.error(e.getMessage(), e); - } - - if (site == null) - return; - - //SIGNUP-241 : get bulk SakaiUsers for performance - List userIds = new ArrayList(); - Map memberRoleMap = new Hashtable(); - Set members = site.getMembers(); - for (Member member : members) { - if (member.isActive() - && (hasPredefinedViewPermisson(member) - || isAllowedSite(member.getUserId(), SIGNUP_VIEW, site.getId()) || isAllowedSite(member - .getUserId(), SIGNUP_VIEW_ALL, site.getId()))) { - memberRoleMap.put(member.getUserId(), member.getRole()); - userIds.add(member.getUserId()); - } - } - - addAndPopulateSignupUsersInfo(signupUsers,memberRoleMap,userIds, site); - - } - - /* get all users in a site */ - @SuppressWarnings("unchecked") - private void getAttendeesForSiteWithSiteScope(Set signupUsers, SignupSite signupSite) { - Site site = null; - try { - site = siteService.getSite(signupSite.getSiteId()); - } catch (IdUnusedException e) { - log.error(e.getMessage(), e); - } - - if (site == null) - return; - - Set members = site.getMembers(); - //SIGNUP-241 : get bulk SakaiUsers for performance - List userIds = new ArrayList(); - Map memberRoleMap = new Hashtable(); - for (Member member : members) { - if (member.isActive() - && (hasPredefinedViewPermisson(member) - || isAllowedSite(member.getUserId(), SIGNUP_ATTEND, site.getId()) || isAllowedSite(member - .getUserId(), SIGNUP_ATTEND_ALL, site.getId()) || isAllowedSite(member - .getUserId(), SIGNUP_UPDATE_SITE, site.getId()))) { - memberRoleMap.put(member.getUserId(), member.getRole()); - userIds.add(member.getUserId()); - } - } - - addAndPopulateSignupUsersInfo(signupUsers,memberRoleMap,userIds, site); - } - - /** - * It will make sure that the user has a point to a published site and - * possible with the same creator's siteId if possible - * - * @param signupUsers - * a List of SignupUser objects. - * @param signupUser - * a SignupUser object - */ - private void processAddOrUpdateSignupUsers(Set signupUsers, SignupUser signupUser) { - boolean update = true; - if (!signupUsers.isEmpty() && signupUsers.contains(signupUser)) { - for (SignupUser sUser : signupUsers) { - if (sUser.getEid().equals(signupUser.getEid())) { - if (!sUser.isPublishedSite() && signupUser.isPublishedSite() || signupUser.isPublishedSite() - && signupUser.getMainSiteId().equals(getCurrentLocationId())) { - update = true; - } else { - update = false; - } - - break; - } - } - } - - if (update) - signupUsers.add(signupUser); - } - - /** - * {@inheritDoc} - */ - public Calendar getCalendar(String siteId) throws PermissionException { - String calendarId = calendarService.calendarReference(siteId, SiteService.MAIN_CONTAINER); - return getCalendarById(calendarId); - } - - /** - * {@inheritDoc} - */ - public Calendar getCalendarById(String calendarId) throws PermissionException { - Calendar calendar = null; - try { - calendar = calendarService.getCalendar(calendarId); - } catch (IdUnusedException e) { - try { - CalendarEdit calendarEdit = calendarService.addCalendar(calendarId); - calendarService.commitCalendar(calendarEdit); - calendar = getCalendarById(calendarId); - } catch (IdInvalidException highlyUnlikely) { - log.error(highlyUnlikely); - } catch (IdUsedException extremelyUnlikely) { - log.error(extremelyUnlikely); - } - } - return calendar; - } - - /** - * {@inheritDoc} - */ - public Group getGroup(String siteId, String groupId) throws IdUnusedException { - Site site = siteService.getSite(siteId); - return site.getGroup(groupId); - } - - private TimeService timeService; - - /** - * {@inheritDoc} - */ - public TimeService getTimeService() { - return timeService; - } - - /** - * This is a setter. - * - * @param timeService - * a TimeService object. - */ - public void setTimeService(TimeService timeService) { - this.timeService = timeService; - } - - private ContentHostingService contentHostingService; - - /** - * {@inheritDoc} - */ - public ContentHostingService getContentHostingService() { - return contentHostingService; - } - - /** - * This is a setter. - * @param contentHostingService - * a ContentHostingService object - */ - public void setContentHostingService(ContentHostingService contentHostingService) { - this.contentHostingService = contentHostingService; - } - - /** - * {@inheritDoc} - */ - public List getUsersByEmail(String email) { - return (List)userDirectoryService.findUsersByEmail(email); - } - - /** - * {@inheritDoc} - */ - public User getUserByEmail(String email) { - - List users = (List)userDirectoryService.findUsersByEmail(email); - - if(users.isEmpty()) { - return null; - } - - return users.get(0); - } - - /** - * {@inheritDoc} - */ - public User getUserByEid(String eid) { - try { - return userDirectoryService.getUserByEid(eid); - } catch (UserNotDefinedException e) { - log.debug("User with eid: " + eid + " does not exist."); - } - return null; - } - - /** - * {@inheritDoc} - */ - public boolean isCsvExportEnabled() { - return serverConfigurationService.getBoolean("signup.csv.export.enabled", false); - } - - /** - * {@inheritDoc} - */ - public SecurityAdvisor pushAllowCalendarEdit(final Calendar calendar) { - SecurityAdvisor advisor = new SecurityAdvisor() { - public SecurityAdvice isAllowed(String userId, String function, String reference) { - if(calendar != null && calendar.canModifyAnyEvent(function)) { - return SecurityAdvice.ALLOWED; - } else { - return SecurityAdvice.NOT_ALLOWED; - } - } - }; - - enableSecurityAdvisor(advisor); - - return advisor; - } - - /** - * {@inheritDoc} - */ - public SecurityAdvisor pushSecurityAdvisor() { - SecurityAdvisor advisor = new SecurityAdvisor() { - public SecurityAdvice isAllowed(String userId, String function, String reference) { - return SecurityAdvice.ALLOWED; - } - }; - - enableSecurityAdvisor(advisor); - - return advisor; - } - - /** - * {@inheritDoc} - */ - public void popSecurityAdvisor(SecurityAdvisor advisor) { - disableSecurityAdvisor(advisor); - } - - /** - * {@inheritDoc} - */ - public String createGroup(String siteId, String title, String description, List userUuids) { - - Site site = null; - try { - site = siteService.getSite(siteId); - } catch (Exception e) { - log.error("createGroup failed for site: " + site.getId(), e); - return null; - } - - SecurityAdvisor securityAdvisor = new SecurityAdvisor(){ - public SecurityAdvice isAllowed(String userId, String function, String reference){ - return SecurityAdvice.ALLOWED; - } - }; - enableSecurityAdvisor(securityAdvisor); - - try { - - //add new group - Group group=site.addGroup(); - - group.setTitle(GROUP_PREFIX + title); - group.setDescription(description); - - //set this property so the groups shows in site info - group.getProperties().addProperty(GROUP_PROP_SITEINFO_VISIBLE, Boolean.TRUE.toString()); - - //set this so the group does not show in the list of groups in signups - //SIGNUP-182 allow groups to be normal groups, ie dont set this property - //group.getProperties().addProperty(GROUP_PROP_SIGNUP_IGNORE, Boolean.TRUE.toString()); - - - if(userUuids != null) { - group.removeMembers(); - - for(String userUuid: userUuids) { - group = addUserToGroup(userUuid, group); - } - } - - // save the changes - siteService.save(site); - - return group.getId(); - - } catch (Exception e) { - log.error("createGroup failed for site: " + site.getId(), e); - } finally { - disableSecurityAdvisor(securityAdvisor); - } - - return null; - } - - /** - * {@inheritDoc} - */ - public boolean addUsersToGroup(Collection userIds, String siteId, String groupId, String timeslottoGroup) { - - log.debug("addUsersToGroup(userIds=" + Arrays.asList(userIds).toString() + ", siteId=" + siteId + ", groupId=" + groupId); - - Site site = null; - try { - site = siteService.getSite(siteId); - } catch (Exception e) { - log.error("addUserToGroup failed to retrieve site: " + siteId, e); - return false; - } - - SecurityAdvisor securityAdvisor = new SecurityAdvisor(){ - public SecurityAdvice isAllowed(String userId, String function, String reference){ - return SecurityAdvice.ALLOWED; - } - }; - enableSecurityAdvisor(securityAdvisor); - - Group group = site.getGroup(groupId); - - if(group == null) { - log.error("No group for id: " + groupId); - return false; - } - - try { - - for(String userId: userIds) { - group = addUserToGroup(userId, group); - } - - //the synchronise is from the time slot to Site group membership - if(timeslottoGroup.equals("toGroup")) { - - List updateusers = getGroupMembers(siteId, groupId); - - //first clone a new group member - Set tmpUsers = new HashSet(); - tmpUsers.addAll(updateusers); - - //retrieve only the difference members from TimeSlot and SiteGroup - tmpUsers.removeAll(userIds); - - //remove the differences from group members - for (String mem: tmpUsers){ - group.removeMember(mem); - } - } - - siteService.save(site); - - return true; - - } catch (Exception e) { - log.error("addUsersToGroup failed for users: " + Arrays.asList(userIds).toString() + " and group: " + groupId, e); - } finally { - disableSecurityAdvisor(securityAdvisor); - } - return false; - } - - /** - * {@inheritDoc} - */ - public boolean synchonizeGroupTitle(String siteId, String groupId, String newTitle){ - Site site = null; - boolean changed = false; - try { - site = siteService.getSite(siteId); - } catch (Exception e) { - log.error("synchronizeGroup failed to retrieve site: " + siteId, e); - return false; - } - - SecurityAdvisor securityAdvisor = new SecurityAdvisor(){ - public SecurityAdvice isAllowed(String userId, String function, String reference){ - return SecurityAdvice.ALLOWED; - } - }; - enableSecurityAdvisor(securityAdvisor); - - Group group = site.getGroup(groupId); - - if(group == null) { - log.error("No group for id: " + groupId); - return false; - } - - try { - - if(group.getTitle().startsWith(GROUP_PREFIX)){ - //it means that the group title has not been modified via Site-info, we can change it now - group.setTitle(GROUP_PREFIX + newTitle); - siteService.save(site); - changed = true; - } - else if(group.getTitle().contains(newTitle)){ - //it is already changed due to version-multiple-try-saving process - //Don't do anything this time. - changed = true; - } - - } catch (Exception e) { - log.error("synchGroupTitle failed for group: " + group.getTitle() + " and group: " + groupId, e); - } finally { - disableSecurityAdvisor(securityAdvisor); - } - return changed; - } - - - /** - * {@inheritDoc} - */ - public boolean removeUserFromGroup(String userId, String siteId, String groupId) { - - log.debug("removeUserFromGroup(userId=" + userId + ", siteId=" + siteId + ", groupId=" + groupId); - - Site site = null; - try { - site = siteService.getSite(siteId); - } catch (Exception e) { - log.error("removeUserFromGroup failed to retrieve site: " + siteId, e); - return false; - } - - SecurityAdvisor securityAdvisor = new SecurityAdvisor(){ - public SecurityAdvice isAllowed(String userId, String function, String reference){ - return SecurityAdvice.ALLOWED; - } - }; - enableSecurityAdvisor(securityAdvisor); - - Group group = site.getGroup(groupId); - - try { - group.removeMember(userId); - siteService.save(site); - - return true; - - } catch (Exception e) { - log.error("removeUserFromGroup failed for user: " + userId + " and group: " + groupId, e); - } finally { - disableSecurityAdvisor(securityAdvisor); - } - - return false; - } - - /** - * {@inheritDoc} - */ - public List getGroupMembers(String siteId, String groupId) { - - List users = new ArrayList(); - - Site site = null; - try { - site = siteService.getSite(siteId); - } catch (Exception e) { - log.error("getGroupMembers failed to retrieve site: " + siteId, e); - return users; - } - - SecurityAdvisor securityAdvisor = new SecurityAdvisor(){ - public SecurityAdvice isAllowed(String userId, String function, String reference){ - return SecurityAdvice.ALLOWED; - } - }; - enableSecurityAdvisor(securityAdvisor); - - try { - Group group = site.getGroup(groupId); - Set members = group.getMembers(); - - for(Member m: members) { - users.add(m.getUserId()); - log.warn("Added user: " + m.getUserId() + " to group: " + groupId); - } - return users; - } catch (Exception e) { - log.error("getGroupMembers failed for site: " + siteId + " and group: " + groupId, e); - } finally { - disableSecurityAdvisor(securityAdvisor); - } - - return users; - } - - /** - * {@inheritDoc} - */ - public boolean checkForGroup(String siteId, String groupId) { - - log.debug("checkForGroup: siteId=" + siteId + ", groupId=" + groupId); - - Site site = null; - try { - site = siteService.getSite(siteId); - } catch (Exception e) { - log.error("checkForGroup failed to retrieve site: " + siteId, e); - return false; - } - - /* - SecurityAdvisor securityAdvisor = new SecurityAdvisor(){ - public SecurityAdvice isAllowed(String userId, String function, String reference){ - return SecurityAdvice.ALLOWED; - } - }; - enableSecurityAdvisor(securityAdvisor); - */ - - Group group = site.getGroup(groupId); - - if(group != null) { - return true; - } - return false; - } - - - /** - * Helper to add a user to a group. THIS DOES NOT SAVE ANYTHING. It is merely a helper to add the user to the group object and return it. - * - * @param userUuid uuid of user - * @param group Group obj - * @return - */ - private Group addUserToGroup(String userUuid, Group group) { - - Site site = group.getContainingSite(); - - //same logic as in site-manage - Role r = site.getUserRole(userUuid); - Member m = site.getMember(userUuid); - Role memberRole = m != null ? m.getRole() : null; - - //Each user should be marked as non provided - //Get role first from site definition. - //However, if the user is inactive, getUserRole would return null; then use member role instead - group.addMember(userUuid, r != null ? r.getId() : memberRole != null? memberRole.getId() : "", m != null ? m.isActive() : true, false); - - return group; - } - - /** - * Setup the security advisor for this transaction - */ - private void enableSecurityAdvisor(SecurityAdvisor securityAdvisor) { - securityService.pushAdvisor(securityAdvisor); - } - - /** - * Remove security advisor from the stack - */ - private void disableSecurityAdvisor(SecurityAdvisor securityAdvisor){ - securityService.popAdvisor(securityAdvisor); - } - -} +/* +* Licensed to The Apereo Foundation under one or more contributor license +* agreements. See the NOTICE file distributed with this work for +* additional information regarding copyright ownership. +* +* The Apereo Foundation licenses this file to you 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: +* +* http://opensource.org/licenses/ecl2.txt +* +* 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.sakaiproject.signup.logic; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; + +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sakaiproject.authz.api.AuthzGroupService; +import org.sakaiproject.authz.api.FunctionManager; +import org.sakaiproject.authz.api.Member; +import org.sakaiproject.authz.api.Role; +import org.sakaiproject.authz.api.SecurityAdvisor; +import org.sakaiproject.authz.api.SecurityService; +import org.sakaiproject.calendar.api.Calendar; +import org.sakaiproject.calendar.api.CalendarEdit; +import org.sakaiproject.calendar.api.CalendarService; +import org.sakaiproject.component.api.ServerConfigurationService; +import org.sakaiproject.component.cover.ComponentManager; +import org.sakaiproject.content.api.ContentHostingService; +import org.sakaiproject.exception.IdInvalidException; +import org.sakaiproject.exception.IdUnusedException; +import org.sakaiproject.exception.IdUsedException; +import org.sakaiproject.exception.PermissionException; +import org.sakaiproject.signup.model.SignupGroup; +import org.sakaiproject.signup.model.SignupMeeting; +import org.sakaiproject.signup.model.SignupSite; +import org.sakaiproject.site.api.Group; +import org.sakaiproject.site.api.Site; +import org.sakaiproject.site.api.SitePage; +import org.sakaiproject.site.api.SiteService; +import org.sakaiproject.site.api.ToolConfiguration; +import org.sakaiproject.time.api.TimeService; +import org.sakaiproject.tool.api.SessionManager; +import org.sakaiproject.tool.api.ToolManager; +import org.sakaiproject.user.api.User; +import org.sakaiproject.user.api.UserDirectoryService; +import org.sakaiproject.user.api.UserNotDefinedException; +import org.sakaiproject.util.ResourceLoader; + +/** + *

+ * This is an implementation of SakaiFacade interface and it provides all + * necessary methods, which are depend on the Sakai Services. This will allow + * the separation of Signup Tool and the Sakai Tools + *

+ * + * @author gl256 + * + */ +public class SakaiFacadeImpl implements SakaiFacade { + + private static Logger log = LoggerFactory.getLogger(SakaiFacadeImpl.class); + + private FunctionManager functionManager; + + private static ResourceLoader rb= new ResourceLoader(); + + /** + * set a Sakai FunctionManager object + * + * @param functionManager + * a Sakai FunctionManager object + */ + public void setFunctionManager(FunctionManager functionManager) { + this.functionManager = functionManager; + } + + private ToolManager toolManager; + + /** + * set a Sakai ToolManager object + * + * @param toolManager + * a Sakai ToolManager object + */ + public void setToolManager(ToolManager toolManager) { + this.toolManager = toolManager; + } + + /** + * get the ToolManager object. + * + * @return a ToolManager object. + */ + public ToolManager getToolManager() { + return this.toolManager; + } + + private SecurityService securityService; + + /** + * set a Sakai SecurityService object + * + * @param securityService + * a Sakai SecurityService object + */ + public void setSecurityService(SecurityService securityService) { + this.securityService = securityService; + } + + private SessionManager sessionManager; + + /** + * set a Sakai SessionManager object + * + * @param sessionManager + * a Sakai SessionManager object + */ + public void setSessionManager(SessionManager sessionManager) { + this.sessionManager = sessionManager; + } + + private SiteService siteService; + + /** + * set a Sakai SiteService object + * + * @param siteService + * a Sakai SiteService object + */ + public void setSiteService(SiteService siteService) { + this.siteService = siteService; + } + + /** + * {@inheritDoc} + */ + public SiteService getSiteService() { + return siteService; + } + + private UserDirectoryService userDirectoryService; + + /** + * set a Sakai UserDirectoryService object + * + * @param userDirectoryService + * a Sakai UserDirectoryService object + */ + public void setUserDirectoryService(UserDirectoryService userDirectoryService) { + this.userDirectoryService = userDirectoryService; + } + + private CalendarService calendarService; + + /** + * set a Sakai CalendarService object + * + * @param calendarService + * a Sakai CalendarService object + */ + public void setCalendarService(CalendarService calendarService) { + this.calendarService = calendarService; + } + + private ServerConfigurationService serverConfigurationService; + + /** + * {@inheritDoc} + */ + public ServerConfigurationService getServerConfigurationService() { + return serverConfigurationService; + } + + /** + * set a Sakai ServerConfigurationService object + * + * @param serverConfigurationService + * a Sakai ServerConfigurationService object + */ + public void setServerConfigurationService(ServerConfigurationService serverConfigurationService) { + this.serverConfigurationService = serverConfigurationService; + } + + private AuthzGroupService authzGroupService; + public AuthzGroupService getAuthzGroupService() { + return authzGroupService; + } + public void setAuthzGroupService(AuthzGroupService authzGroupService) { + this.authzGroupService=authzGroupService; + } + // Returns Google calendar if the calendar has been created in Google + public Calendar getAdditionalCalendar(String siteId) throws PermissionException { + CalendarService additionalCalendarService = null; + additionalCalendarService = (CalendarService) ComponentManager.get(CalendarService.ADDITIONAL_CALENDAR); + if (additionalCalendarService != null){ + if (additionalCalendarService.isCalendarToolInitialized(siteId)) { + try { + return additionalCalendarService.getCalendar(siteId); + } catch (IdUnusedException e) { + log.error("Error retrieving Calendar." + e.getMessage()); + } + } + } + return null; + } + + /** + * regist all the permission levels, which Signup Tool required. Place any + * code that should run when this class is initialized by spring here + */ + public void init() { + log.debug("init"); + // register Sakai permissions for this tool + functionManager.registerFunction(SIGNUP_VIEW); + functionManager.registerFunction(SIGNUP_VIEW_ALL); + functionManager.registerFunction(SIGNUP_ATTEND); + functionManager.registerFunction(SIGNUP_ATTEND_ALL); + functionManager.registerFunction(SIGNUP_CREATE_SITE); + functionManager.registerFunction(SIGNUP_CREATE_GROUP); + functionManager.registerFunction(SIGNUP_CREATE_GROUP_ALL); + functionManager.registerFunction(SIGNUP_DELETE_SITE); + functionManager.registerFunction(SIGNUP_DELETE_GROUP); + functionManager.registerFunction(SIGNUP_DELETE_GROUP_ALL); + functionManager.registerFunction(SIGNUP_UPDATE_SITE); + functionManager.registerFunction(SIGNUP_UPDATE_GROUP); + functionManager.registerFunction(SIGNUP_UPDATE_GROUP_ALL); + } + + /** + * {@inheritDoc} + */ + public boolean isUserAdmin(String userId) { + return securityService.isSuperUser(userId); + } + + /** + * {@inheritDoc} + */ + public String getCurrentUserId() { + return sessionManager.getCurrentSessionUserId(); + } + + /** + * {@inheritDoc} + */ + public User getUser(String userId) { + try { + return userDirectoryService.getUser(userId); + } catch (UserNotDefinedException e) { + log.warn("Cannot get user for id: " + userId); + return null; + } + } + + /** + * {@inheritDoc} + */ + public User getUserQuietly(String userId) { + try { + return userDirectoryService.getUser(userId); + } catch (UserNotDefinedException e) { + log.debug("User with id: " + userId + " does not exist : " + e.getClass() + " : " + e.getMessage()); + return null; + } + } + + /** + * {@inheritDoc} + */ + public boolean checkForUser(String userId) { + try { + User u = userDirectoryService.getUser(userId); + if (u != null) { + return true; + } + } catch (UserNotDefinedException e) { + log.debug("User with id: " + userId + " does not exist : " + e.getClass() + " : " + e.getMessage()); + } + return false; + } + + /** + * {@inheritDoc} + */ + public String getUserDisplayName(String userId) { + try { + return userDirectoryService.getUser(userId).getDisplayName(); + } catch (UserNotDefinedException e) { + log.warn("Cannot get user displayname for id: " + userId); + return "--------"; + } + } + + /** + * {@inheritDoc} + */ + public String getUserDisplayLastFirstName(String userId) { + try { + String dispLastName= userDirectoryService.getUser(userId).getLastName(); + if(dispLastName !=null){ + dispLastName = StringUtils.lowerCase(dispLastName, rb.getLocale()); + dispLastName = StringUtils.capitalize(dispLastName); + } + String dispFirstName = userDirectoryService.getUser(userId).getFirstName(); + if(dispFirstName !=null){ + dispFirstName = StringUtils.lowerCase(dispFirstName, rb.getLocale()); + dispFirstName = StringUtils.capitalize(dispFirstName); + } + String displayname = null; + if(( dispLastName ==null || dispLastName.isEmpty()) && (dispFirstName ==null || dispFirstName.isEmpty()) ){ + //Case: local user can have no first and last names + displayname = userDirectoryService.getUser(userId).getDisplayId(); + } + else{ + displayname = dispLastName +", " + dispFirstName; + } + + return displayname; + } catch (UserNotDefinedException e) { + log.warn("Cannot get user displayname for id: " + userId); + return "--------"; + } + } + + /** + * {@inheritDoc} + */ + public String getCurrentLocationId() { + try { + return toolManager.getCurrentPlacement().getContext(); + } catch (Exception e) { + log.info("Failed to get current location id"); + return NO_LOCATION; + } + } + + /** + * {@inheritDoc} + */ + public String getCurrentPageId() { + return getSiteSignupPageId(getCurrentLocationId()); + } + + /** + * {@inheritDoc} + */ + public String getSiteSignupPageId(String siteId) { + try { + Site appliedSite = siteService.getSite(siteId); + String signupToolId=null; + try{ + signupToolId = toolManager.getCurrentPlacement().getToolId(); + } + catch (Exception e){ + /*for case: cronJob or web-service etc.*/ + signupToolId = toolManager.getTool("sakai.signup").getId(); + } + + SitePage page = null; + List pageList = appliedSite.getPages(); + for (int i = 0; i < pageList.size(); i++) { + page = (SitePage) pageList.get(i); + List pageToolList = page.getTools(); + if (pageToolList != null && !pageToolList.isEmpty()) { + /* take first one only for efficiency */ + ToolConfiguration toolConf = (ToolConfiguration) pageToolList.get(0); + if (toolConf != null) { + String toolId = toolConf.getToolId(); + if (toolId.equalsIgnoreCase(signupToolId)) { + return page.getId(); + } + } + } + + } + } catch (Exception e) { + log.warn("Failed to get current page id"); + } + return ""; + } + + /** + * {@inheritDoc} + */ + public String getLocationTitle(String locationId) { + try { + Site site = siteService.getSite(locationId); + return site.getTitle(); + } catch (IdUnusedException e) { + log.warn("Cannot get the info about locationId: " + locationId); + return "----------"; + } + } + + /** + * {@inheritDoc} + */ + public List getUserPublishedSiteIds(String userId){ + List siteIds = new ArrayList(); + /*all sites for current user*/ + List tempL = siteService.getSites(SiteService.SelectionType.ACCESS, null, null, null, + SiteService.SortType.TITLE_ASC, null); + + for (Iterator iter = tempL.iterator(); iter.hasNext();) { + Site element = (Site) iter.next(); + // exclude my workspace & admin related sites + if (!siteService.isUserSite(element.getId()) && !siteService.isSpecialSite(element.getId())) { + // if the tools is not available in the site then don't add it. + Collection tools = element.getTools("sakai.signup"); + if (tools == null || tools.isEmpty()) + continue; + + if(element.isPublished()){ + siteIds.add(element.getId()); + } + } + + } + + return siteIds; + } + + /** + * {@inheritDoc} + */ + public List getUserSites(String userId) { + List signupSites = new ArrayList(); + List tempL = siteService.getSites(SiteService.SelectionType.ACCESS, null, null, null, + SiteService.SortType.TITLE_ASC, null); + + /*Case: Admin is not a member of current site and add it + * in order to let Admin create meetings*/ + if(isUserAdmin(getCurrentUserId())){ + String currentSitId = getCurrentLocationId(); + Site curSite=null; + try { + curSite =getSiteService().getSite(currentSitId); + } catch (IdUnusedException e) { + log.warn("IdUnusedException:" + e.getMessage()); + } + if(currentSitId !=null && curSite !=null){ + boolean foundSite=false; + for (Site s : tempL) { + if(currentSitId.equals(s.getId())){ + foundSite=true; + break; + } + } + if(!foundSite){ + tempL.add(curSite); + } + } + } + + for (Iterator iter = tempL.iterator(); iter.hasNext();) { + Site element = (Site) iter.next(); + // exclude my workspace & admin related sites + if (!siteService.isUserSite(element.getId()) && !siteService.isSpecialSite(element.getId())) { + // if the tools is not available in the site then don't add it. + Collection tools = element.getTools("sakai.signup"); + if (tools == null || tools.isEmpty()) + continue; + + SignupSite tmpSite = new SignupSite(); + tmpSite.setSiteId(element.getId()); + tmpSite.setTitle(element.getTitle()); + signupSites.add(tmpSite); + List groupList = new ArrayList(); + Collection tmpGroup = element.getGroups(); + for (Iterator iterator = tmpGroup.iterator(); iterator.hasNext();) { + Group grp = (Group) iterator.next(); + + //signup-51 don't show the hidden groups (if property exists, skip this group) + String gProp = grp.getProperties().getProperty(GROUP_PROP_SIGNUP_IGNORE); + if (gProp != null && gProp.equals(Boolean.TRUE.toString())) { + continue; + } + + SignupGroup sgrp = new SignupGroup(); + sgrp.setGroupId(grp.getId()); + sgrp.setTitle(grp.getTitle()); + groupList.add(sgrp); + } + tmpSite.setSignupGroups(groupList); + } + + } + return signupSites; + } + + /** + * {@inheritDoc} + */ + public boolean isAllowedGroup(String userId, String permission, String siteId, String groupId) { + return isAllowed(userId, permission, siteService.siteGroupReference(siteId, groupId)); + } + + /** + * {@inheritDoc} + */ + public boolean isAllowedSite(String userId, String permission, String siteId) { + return isAllowed(userId, permission, siteService.siteReference(siteId)); + } + + /* check permission */ + private boolean isAllowed(String userId, String permission, String realmId) { + if (securityService.unlock(userId, permission, realmId)) { + return true; + } + return false; + } + + /** + * {@inheritDoc} + */ + public String getUserId(String eid) throws UserNotDefinedException { + return userDirectoryService.getUserId(eid); + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public List getAllUsers(SignupMeeting meeting) { + List signupSites = meeting.getSignupSites(); + Set signupUsers = new TreeSet(); + for (SignupSite signupSite : signupSites) { + if (signupSite.isSiteScope()) { + getUsersForSiteWithSiteScope(signupUsers, signupSite); + } else { + List signupGroups = signupSite.getSignupGroups(); + for (SignupGroup signupGroup : signupGroups) { + getUsersForGroup(signupUsers, signupSite, signupGroup); + } + } + + } + return new ArrayList(signupUsers); + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public List getAllPossibleAttendees(SignupMeeting meeting){ + List signupSites = meeting.getSignupSites(); + Set signupUsers = new TreeSet(); + for (SignupSite signupSite : signupSites) { + if (signupSite.isSiteScope()) { + getAttendeesForSiteWithSiteScope(signupUsers, signupSite); + } else { + List signupGroups = signupSite.getSignupGroups(); + for (SignupGroup signupGroup : signupGroups) { + getAttendeesForGroup(signupUsers, signupSite, signupGroup); + } + } + + } + return new ArrayList(signupUsers); + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public List getAllPossibleCoordinators(SignupMeeting meeting) { + List coordinators = new ArrayList(); + List signUpUsers = getAllUsers(meeting); + List signupSites = meeting.getSignupSites(); + Set userIdsHasPermissionToCreate = new HashSet(); + if (signupSites != null) { + for (SignupSite site: signupSites) { + userIdsHasPermissionToCreate.addAll(getUserIdsHasPermissionToCreate(site)); + } + } + for (SignupUser signUpUser: signUpUsers) { + if (userIdsHasPermissionToCreate.contains(signUpUser.getInternalUserId())) { + coordinators.add(signUpUser); + } + } + return coordinators; + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public List getAllPossbileCoordinatorsOnFastTrack(SignupMeeting meeting) { + List coordinators = new ArrayList(); + List signupSites = meeting.getSignupSites(); + Set userIdsHasPermissionToCreate = new HashSet(); + if (signupSites != null) { + for (SignupSite site: signupSites) { + //Only thing we miss here is that the view permission is not checked. the Chance is very small. + userIdsHasPermissionToCreate.addAll(getUserIdsHasPermissionToCreate(site)); + } + } + + List sakaiUsers = userDirectoryService.getUsers(userIdsHasPermissionToCreate); + for (User user : sakaiUsers) { + SignupUser signupUser = new SignupUser(user.getEid(), user.getId(), user.getFirstName(), user.getLastName(), + null, "", true); + coordinators.add(signupUser); + } + + return coordinators; + } + + private Set getUserIdsHasPermissionToCreate(SignupSite site) { + Set userIds = new HashSet(); + userIds.addAll(getUserIdsWithPermission(SIGNUP_CREATE_SITE, site.getSiteId())); + if (!site.isSiteScope()) { + List signupGroups = site.getSignupGroups(); + for (SignupGroup group: signupGroups) { + userIds.addAll(getUserIdsWithPermission(SIGNUP_CREATE_GROUP_ALL, site.getSiteId(), group.getGroupId())); + userIds.addAll(getUserIdsWithPermission(SIGNUP_CREATE_GROUP, site.getSiteId(), group.getGroupId())); + } + } + return userIds; + } + + private List getUserIdsWithPermission(String permission, String siteId) { + return getUserIdsWithPermissionOnRealm(permission, siteService.siteReference(siteId)); + } + + private List getUserIdsWithPermission(String permission, String siteId, String groupId) { + return getUserIdsWithPermissionOnRealm(permission, siteService.siteGroupReference(siteId, groupId)); + } + + private List getUserIdsWithPermissionOnRealm(String permission, String realmId) { + List rv = new ArrayList(); + for (User user: securityService.unlockUsers(permission, realmId)) { + rv.add(user.getId()); + } + return rv; + } + + + /** + * {@inheritDoc} + */ + public SignupUser getSignupUser(SignupMeeting meeting, String userId){ + SignupUser signupUser=null; + List signupSites = meeting.getSignupSites(); + SignupSite currentSignupSite=null; + for (SignupSite signupSite : signupSites) { + Site site = null; + try { + site = siteService.getSite(signupSite.getSiteId()); + } catch (IdUnusedException e) { + log.error(e.getMessage(), e); + } + + if (site == null) + continue; + + if(site.getId().equals(signupSite.getSiteId())) + currentSignupSite=signupSite; + + /*Case 1: User is required to be a site member*/ + Member member = site.getMember(userId); + if (member ==null || !member.isActive()) + continue; + + if (hasPermissionToAttend(signupSite,userId)) { + User user = getUser(member.getUserId()); + if (user != null) { + SignupUser sUser = new SignupUser(member.getUserEid(), member.getUserId(), "", member.getUserEid(), + member.getRole(), site.getId(), site.isPublished()); + + if(signupUser ==null ){ + signupUser =sUser; + } + else if(sUser.isPublishedSite() && sUser.getMainSiteId().equals(getCurrentLocationId())){ + return sUser; + } + else if(!signupUser.isPublishedSite() && sUser.isPublishedSite()) + signupUser =sUser; + } + else + log.info("user is not found from 'userDirectoryService' for userId:" + member.getUserId()); + } + + }//end of for + + /*Case 2: site has '.auth' roleId and user is not required to be a site member*/ + if(signupUser ==null){ + signupUser = getSignupUserForLoginRequiredOnlySite(currentSignupSite,userId); + } + + return signupUser; + } + + /** + * {@inheritDoc} + */ + public List getUsersWithPermission(String permission) { + + try { + //current site + Site currentSite = siteService.getSite(getCurrentLocationId()); + + //get userids with permission in this site/azg + Set usersWithPermission = authzGroupService.getUsersIsAllowed(permission, Collections.singletonList(currentSite.getReference())); + + //get Users + return userDirectoryService.getUsers(usersWithPermission); + } catch (Exception e) { + log.error("getUsersWithPermission exception: " + e.getClass() + ":" + e.getMessage()); + } + return Collections.EMPTY_LIST; + } + + + private boolean hasPermissionToAttend(SignupSite site, String userId){ + if(isAllowedSite(userId, SIGNUP_ATTEND_ALL, site.getSiteId())) + return true; + + if (site.isSiteScope()) { + if (isAllowedSite(userId, SIGNUP_ATTEND, site.getSiteId())) + return true; + } else { + List signupGroups = site.getSignupGroups(); + for (SignupGroup group : signupGroups) { + if(isAllowedGroup(userId, SIGNUP_ATTEND, site.getSiteId(), group.getGroupId())) + return true; + } + } + + return false; + } + + public boolean hasPermissionToCreate(SignupMeeting meeting, String userId){ + + List signupSites = meeting.getSignupSites(); + if(signupSites !=null){ + for (SignupSite site : signupSites) { + if(isAllowedSite(userId, SIGNUP_CREATE_SITE, site.getSiteId())) + return true; + + if (site.isSiteScope()) { + if (isAllowedSite(userId, SIGNUP_CREATE_SITE, site.getSiteId())) + return true; + } else { + List signupGroups = site.getSignupGroups(); + for (SignupGroup group : signupGroups) { + if(isAllowedGroup(userId, SIGNUP_CREATE_GROUP_ALL, site.getSiteId(), group.getGroupId()) || isAllowedGroup(userId, SIGNUP_CREATE_GROUP, site.getSiteId(), group.getGroupId())) + return true; + } + } + + } + } + + return false; + } + + /*If site has roleId '.auth', any user is OK if logged in*/ + private SignupUser getSignupUserForLoginRequiredOnlySite(SignupSite signupSite, String userId){ + SignupUser signupUser=null; + Site site=null; + try { + site = siteService.getSite(signupSite.getSiteId()); + } catch (IdUnusedException e) { + log.error(e.getMessage(), e); + } + + if (site == null) + return null; + + Set siteRoles = site.getRoles(); + if(siteRoles !=null){ + for (Iterator iter = siteRoles.iterator(); iter.hasNext();) { + Role role = (Role) iter.next(); + if(REALM_ID_FOR_LOGIN_REQUIRED_ONLY.equals(role.getId())){ + if(hasPermissionToAttend(signupSite,userId)){ + User user = getUser(userId); + if(user !=null) + signupUser = new SignupUser(user.getEid(), userId, user.getFirstName(), user.getLastName(), + role, site.getId(), site.isPublished()); + break; + } + } + + } + } + + return signupUser; + } + + /* get all users in a specific group */ + @SuppressWarnings("unchecked") + private void getUsersForGroup(Set signupUsers, SignupSite signupSite, SignupGroup signupGroup) { + Site site = null; + try { + site = siteService.getSite(signupSite.getSiteId()); + } catch (IdUnusedException e) { + log.error("Cannot get the info about siteId: " + e.getMessage()); + return; + } + Group group = site.getGroup(signupGroup.getGroupId()); + if (group == null) + return; + Set members = group.getMembers(); + + //SIGNUP-241 : get bulk SakaiUsers for performance + List userIds = new ArrayList(); + Map memberRoleMap = new Hashtable(); + for (Member member : members) { + if (member.isActive() + && (hasPredefinedViewPermisson(member) + || isAllowedGroup(member.getUserId(), SIGNUP_VIEW, site.getId(), group.getId()) || isAllowedSite( + member.getUserId(), SIGNUP_VIEW_ALL, site.getId()))) { + //User user = getUserQuietly(member.getUserId()); + memberRoleMap.put(member.getUserId(), member.getRole()); + userIds.add(member.getUserId()); + } + } + + addAndPopulateSignupUsersInfo(signupUsers,memberRoleMap,userIds, site); + } + + private void addAndPopulateSignupUsersInfo(Set signupUsers, Map memberRoleMap, List userIds, Site site){ + //it should filter out non-existing userIds + List sakaiUsers = userDirectoryService.getUsers(userIds); + + if(sakaiUsers !=null){ + for (User user : sakaiUsers) { + SignupUser signupUser = new SignupUser(user.getEid(), user.getId(), user.getFirstName(), user.getLastName(), + memberRoleMap.get(user.getId()), site.getId(), site.isPublished()); + processAddOrUpdateSignupUsers(signupUsers, signupUser); + // comment: member.getUserDisplayId() not used + } + } + + } + + /* get all users in a specific group */ + @SuppressWarnings("unchecked") + private void getAttendeesForGroup(Set signupUsers, SignupSite signupSite, SignupGroup signupGroup) { + Site site = null; + try { + site = siteService.getSite(signupSite.getSiteId()); + } catch (IdUnusedException e) { + log.error("Cannot get the info about siteId: " + e.getMessage()); + return; + } + Group group = site.getGroup(signupGroup.getGroupId()); + if (group == null) + return; + Set members = group.getMembers(); + + //SIGNUP-241 : get bulk SakaiUsers for performance + List userIds = new ArrayList(); + Map memberRoleMap = new Hashtable(); + for (Member member : members) { + if (member.isActive() + && (hasPredefinedViewPermisson(member) + || isAllowedGroup(member.getUserId(), SIGNUP_ATTEND, site.getId(), group.getId()) || isAllowedSite( + member.getUserId(), SIGNUP_ATTEND_ALL, site.getId()))) { + memberRoleMap.put(member.getUserId(), member.getRole()); + userIds.add(member.getUserId()); + } + } + + addAndPopulateSignupUsersInfo(signupUsers,memberRoleMap,userIds, site); + } + + private boolean hasPredefinedViewPermisson(Member member) { + /* + * just assume student role has the signup.view permission and could add + * more roles to exclude + */ + return STUDENT_ROLE_ID.equalsIgnoreCase(member.getRole().getId()); + } + + /* get all users in a site */ + @SuppressWarnings("unchecked") + private void getUsersForSiteWithSiteScope(Set signupUsers, SignupSite signupSite) { + Site site = null; + try { + site = siteService.getSite(signupSite.getSiteId()); + } catch (IdUnusedException e) { + log.error(e.getMessage(), e); + } + + if (site == null) + return; + + //SIGNUP-241 : get bulk SakaiUsers for performance + List userIds = new ArrayList(); + Map memberRoleMap = new Hashtable(); + Set members = site.getMembers(); + for (Member member : members) { + if (member.isActive() + && (hasPredefinedViewPermisson(member) + || isAllowedSite(member.getUserId(), SIGNUP_VIEW, site.getId()) || isAllowedSite(member + .getUserId(), SIGNUP_VIEW_ALL, site.getId()))) { + memberRoleMap.put(member.getUserId(), member.getRole()); + userIds.add(member.getUserId()); + } + } + + addAndPopulateSignupUsersInfo(signupUsers,memberRoleMap,userIds, site); + + } + + /* get all users in a site */ + @SuppressWarnings("unchecked") + private void getAttendeesForSiteWithSiteScope(Set signupUsers, SignupSite signupSite) { + Site site = null; + try { + site = siteService.getSite(signupSite.getSiteId()); + } catch (IdUnusedException e) { + log.error(e.getMessage(), e); + } + + if (site == null) + return; + + Set members = site.getMembers(); + //SIGNUP-241 : get bulk SakaiUsers for performance + List userIds = new ArrayList(); + Map memberRoleMap = new Hashtable(); + for (Member member : members) { + if (member.isActive() + && (hasPredefinedViewPermisson(member) + || isAllowedSite(member.getUserId(), SIGNUP_ATTEND, site.getId()) || isAllowedSite(member + .getUserId(), SIGNUP_ATTEND_ALL, site.getId()) || isAllowedSite(member + .getUserId(), SIGNUP_UPDATE_SITE, site.getId()))) { + memberRoleMap.put(member.getUserId(), member.getRole()); + userIds.add(member.getUserId()); + } + } + + addAndPopulateSignupUsersInfo(signupUsers,memberRoleMap,userIds, site); + } + + /** + * It will make sure that the user has a point to a published site and + * possible with the same creator's siteId if possible + * + * @param signupUsers + * a List of SignupUser objects. + * @param signupUser + * a SignupUser object + */ + private void processAddOrUpdateSignupUsers(Set signupUsers, SignupUser signupUser) { + boolean update = true; + if (!signupUsers.isEmpty() && signupUsers.contains(signupUser)) { + for (SignupUser sUser : signupUsers) { + if (sUser.getEid().equals(signupUser.getEid())) { + if (!sUser.isPublishedSite() && signupUser.isPublishedSite() || signupUser.isPublishedSite() + && signupUser.getMainSiteId().equals(getCurrentLocationId())) { + update = true; + } else { + update = false; + } + + break; + } + } + } + + if (update) + signupUsers.add(signupUser); + } + + /** + * {@inheritDoc} + */ + public Calendar getCalendar(String siteId) throws PermissionException { + String calendarId = calendarService.calendarReference(siteId, SiteService.MAIN_CONTAINER); + return getCalendarById(calendarId); + } + + /** + * {@inheritDoc} + */ + public Calendar getCalendarById(String calendarId) throws PermissionException { + Calendar calendar = null; + try { + calendar = calendarService.getCalendar(calendarId); + } catch (IdUnusedException e) { + try { + CalendarEdit calendarEdit = calendarService.addCalendar(calendarId); + calendarService.commitCalendar(calendarEdit); + calendar = getCalendarById(calendarId); + } catch (IdInvalidException highlyUnlikely) { + log.error(highlyUnlikely.getMessage()); + } catch (IdUsedException extremelyUnlikely) { + log.error(extremelyUnlikely.getMessage()); + } + } + return calendar; + } + + /** + * {@inheritDoc} + */ + public Group getGroup(String siteId, String groupId) throws IdUnusedException { + Site site = siteService.getSite(siteId); + return site.getGroup(groupId); + } + + private TimeService timeService; + + /** + * {@inheritDoc} + */ + public TimeService getTimeService() { + return timeService; + } + + /** + * This is a setter. + * + * @param timeService + * a TimeService object. + */ + public void setTimeService(TimeService timeService) { + this.timeService = timeService; + } + + private ContentHostingService contentHostingService; + + /** + * {@inheritDoc} + */ + public ContentHostingService getContentHostingService() { + return contentHostingService; + } + + /** + * This is a setter. + * @param contentHostingService + * a ContentHostingService object + */ + public void setContentHostingService(ContentHostingService contentHostingService) { + this.contentHostingService = contentHostingService; + } + + /** + * {@inheritDoc} + */ + public List getUsersByEmail(String email) { + return (List)userDirectoryService.findUsersByEmail(email); + } + + /** + * {@inheritDoc} + */ + public User getUserByEmail(String email) { + + List users = (List)userDirectoryService.findUsersByEmail(email); + + if(users.isEmpty()) { + return null; + } + + return users.get(0); + } + + /** + * {@inheritDoc} + */ + public User getUserByEid(String eid) { + try { + return userDirectoryService.getUserByEid(eid); + } catch (UserNotDefinedException e) { + log.debug("User with eid: " + eid + " does not exist."); + } + return null; + } + + /** + * {@inheritDoc} + */ + public boolean isCsvExportEnabled() { + return serverConfigurationService.getBoolean("signup.csv.export.enabled", false); + } + + /** + * {@inheritDoc} + */ + public SecurityAdvisor pushAllowCalendarEdit(final Calendar calendar) { + SecurityAdvisor advisor = new SecurityAdvisor() { + public SecurityAdvice isAllowed(String userId, String function, String reference) { + if(calendar != null && calendar.canModifyAnyEvent(function)) { + return SecurityAdvice.ALLOWED; + } else { + return SecurityAdvice.NOT_ALLOWED; + } + } + }; + + enableSecurityAdvisor(advisor); + + return advisor; + } + + /** + * {@inheritDoc} + */ + public SecurityAdvisor pushSecurityAdvisor() { + SecurityAdvisor advisor = new SecurityAdvisor() { + public SecurityAdvice isAllowed(String userId, String function, String reference) { + return SecurityAdvice.ALLOWED; + } + }; + + enableSecurityAdvisor(advisor); + + return advisor; + } + + /** + * {@inheritDoc} + */ + public void popSecurityAdvisor(SecurityAdvisor advisor) { + disableSecurityAdvisor(advisor); + } + + /** + * {@inheritDoc} + */ + public String createGroup(String siteId, String title, String description, List userUuids) { + + Site site = null; + try { + site = siteService.getSite(siteId); + } catch (Exception e) { + log.error("createGroup failed for site: " + site.getId(), e); + return null; + } + + SecurityAdvisor securityAdvisor = new SecurityAdvisor(){ + public SecurityAdvice isAllowed(String userId, String function, String reference){ + return SecurityAdvice.ALLOWED; + } + }; + enableSecurityAdvisor(securityAdvisor); + + try { + + //add new group + Group group=site.addGroup(); + + group.setTitle(GROUP_PREFIX + title); + group.setDescription(description); + + //set this property so the groups shows in site info + group.getProperties().addProperty(GROUP_PROP_SITEINFO_VISIBLE, Boolean.TRUE.toString()); + + //set this so the group does not show in the list of groups in signups + //SIGNUP-182 allow groups to be normal groups, ie dont set this property + //group.getProperties().addProperty(GROUP_PROP_SIGNUP_IGNORE, Boolean.TRUE.toString()); + + + if(userUuids != null) { + group.removeMembers(); + + for(String userUuid: userUuids) { + group = addUserToGroup(userUuid, group); + } + } + + // save the changes + siteService.save(site); + + return group.getId(); + + } catch (Exception e) { + log.error("createGroup failed for site: " + site.getId(), e); + } finally { + disableSecurityAdvisor(securityAdvisor); + } + + return null; + } + + /** + * {@inheritDoc} + */ + public boolean addUsersToGroup(Collection userIds, String siteId, String groupId, String timeslottoGroup) { + + log.debug("addUsersToGroup(userIds=" + Arrays.asList(userIds).toString() + ", siteId=" + siteId + ", groupId=" + groupId); + + Site site = null; + try { + site = siteService.getSite(siteId); + } catch (Exception e) { + log.error("addUserToGroup failed to retrieve site: " + siteId, e); + return false; + } + + SecurityAdvisor securityAdvisor = new SecurityAdvisor(){ + public SecurityAdvice isAllowed(String userId, String function, String reference){ + return SecurityAdvice.ALLOWED; + } + }; + enableSecurityAdvisor(securityAdvisor); + + Group group = site.getGroup(groupId); + + if(group == null) { + log.error("No group for id: " + groupId); + return false; + } + + try { + + for(String userId: userIds) { + group = addUserToGroup(userId, group); + } + + //the synchronise is from the time slot to Site group membership + if(timeslottoGroup.equals("toGroup")) { + + List updateusers = getGroupMembers(siteId, groupId); + + //first clone a new group member + Set tmpUsers = new HashSet(); + tmpUsers.addAll(updateusers); + + //retrieve only the difference members from TimeSlot and SiteGroup + tmpUsers.removeAll(userIds); + + //remove the differences from group members + for (String mem: tmpUsers){ + group.removeMember(mem); + } + } + + siteService.save(site); + + return true; + + } catch (Exception e) { + log.error("addUsersToGroup failed for users: " + Arrays.asList(userIds).toString() + " and group: " + groupId, e); + } finally { + disableSecurityAdvisor(securityAdvisor); + } + return false; + } + + /** + * {@inheritDoc} + */ + public boolean synchonizeGroupTitle(String siteId, String groupId, String newTitle){ + Site site = null; + boolean changed = false; + try { + site = siteService.getSite(siteId); + } catch (Exception e) { + log.error("synchronizeGroup failed to retrieve site: " + siteId, e); + return false; + } + + SecurityAdvisor securityAdvisor = new SecurityAdvisor(){ + public SecurityAdvice isAllowed(String userId, String function, String reference){ + return SecurityAdvice.ALLOWED; + } + }; + enableSecurityAdvisor(securityAdvisor); + + Group group = site.getGroup(groupId); + + if(group == null) { + log.error("No group for id: " + groupId); + return false; + } + + try { + + if(group.getTitle().startsWith(GROUP_PREFIX)){ + //it means that the group title has not been modified via Site-info, we can change it now + group.setTitle(GROUP_PREFIX + newTitle); + siteService.save(site); + changed = true; + } + else if(group.getTitle().contains(newTitle)){ + //it is already changed due to version-multiple-try-saving process + //Don't do anything this time. + changed = true; + } + + } catch (Exception e) { + log.error("synchGroupTitle failed for group: " + group.getTitle() + " and group: " + groupId, e); + } finally { + disableSecurityAdvisor(securityAdvisor); + } + return changed; + } + + + /** + * {@inheritDoc} + */ + public boolean removeUserFromGroup(String userId, String siteId, String groupId) { + + log.debug("removeUserFromGroup(userId=" + userId + ", siteId=" + siteId + ", groupId=" + groupId); + + Site site = null; + try { + site = siteService.getSite(siteId); + } catch (Exception e) { + log.error("removeUserFromGroup failed to retrieve site: " + siteId, e); + return false; + } + + SecurityAdvisor securityAdvisor = new SecurityAdvisor(){ + public SecurityAdvice isAllowed(String userId, String function, String reference){ + return SecurityAdvice.ALLOWED; + } + }; + enableSecurityAdvisor(securityAdvisor); + + Group group = site.getGroup(groupId); + + try { + group.removeMember(userId); + siteService.save(site); + + return true; + + } catch (Exception e) { + log.error("removeUserFromGroup failed for user: " + userId + " and group: " + groupId, e); + } finally { + disableSecurityAdvisor(securityAdvisor); + } + + return false; + } + + /** + * {@inheritDoc} + */ + public List getGroupMembers(String siteId, String groupId) { + + List users = new ArrayList(); + + Site site = null; + try { + site = siteService.getSite(siteId); + } catch (Exception e) { + log.error("getGroupMembers failed to retrieve site: " + siteId, e); + return users; + } + + SecurityAdvisor securityAdvisor = new SecurityAdvisor(){ + public SecurityAdvice isAllowed(String userId, String function, String reference){ + return SecurityAdvice.ALLOWED; + } + }; + enableSecurityAdvisor(securityAdvisor); + + try { + Group group = site.getGroup(groupId); + Set members = group.getMembers(); + + for(Member m: members) { + users.add(m.getUserId()); + log.warn("Added user: " + m.getUserId() + " to group: " + groupId); + } + return users; + } catch (Exception e) { + log.error("getGroupMembers failed for site: " + siteId + " and group: " + groupId, e); + } finally { + disableSecurityAdvisor(securityAdvisor); + } + + return users; + } + + /** + * {@inheritDoc} + */ + public boolean checkForGroup(String siteId, String groupId) { + + log.debug("checkForGroup: siteId=" + siteId + ", groupId=" + groupId); + + Site site = null; + try { + site = siteService.getSite(siteId); + } catch (Exception e) { + log.error("checkForGroup failed to retrieve site: " + siteId, e); + return false; + } + + /* + SecurityAdvisor securityAdvisor = new SecurityAdvisor(){ + public SecurityAdvice isAllowed(String userId, String function, String reference){ + return SecurityAdvice.ALLOWED; + } + }; + enableSecurityAdvisor(securityAdvisor); + */ + + Group group = site.getGroup(groupId); + + if(group != null) { + return true; + } + return false; + } + + + /** + * Helper to add a user to a group. THIS DOES NOT SAVE ANYTHING. It is merely a helper to add the user to the group object and return it. + * + * @param userUuid uuid of user + * @param group Group obj + * @return + */ + private Group addUserToGroup(String userUuid, Group group) { + + Site site = group.getContainingSite(); + + //same logic as in site-manage + Role r = site.getUserRole(userUuid); + Member m = site.getMember(userUuid); + Role memberRole = m != null ? m.getRole() : null; + + //Each user should be marked as non provided + //Get role first from site definition. + //However, if the user is inactive, getUserRole would return null; then use member role instead + group.addMember(userUuid, r != null ? r.getId() : memberRole != null? memberRole.getId() : "", m != null ? m.isActive() : true, false); + + return group; + } + + /** + * Setup the security advisor for this transaction + */ + private void enableSecurityAdvisor(SecurityAdvisor securityAdvisor) { + securityService.pushAdvisor(securityAdvisor); + } + + /** + * Remove security advisor from the stack + */ + private void disableSecurityAdvisor(SecurityAdvisor securityAdvisor){ + securityService.popAdvisor(securityAdvisor); + } + +} diff --git a/signup/impl/src/java/org/sakaiproject/signup/logic/SignupCacheServiceImpl.java b/signup/impl/src/java/org/sakaiproject/signup/logic/SignupCacheServiceImpl.java index f75517f66c09..20065f23eeb9 100644 --- a/signup/impl/src/java/org/sakaiproject/signup/logic/SignupCacheServiceImpl.java +++ b/signup/impl/src/java/org/sakaiproject/signup/logic/SignupCacheServiceImpl.java @@ -1,187 +1,187 @@ -/* -* Licensed to The Apereo Foundation under one or more contributor license -* agreements. See the NOTICE file distributed with this work for -* additional information regarding copyright ownership. -* -* The Apereo Foundation licenses this file to you 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: -* -* http://opensource.org/licenses/ecl2.txt -* -* 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.sakaiproject.signup.logic; - -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.sakaiproject.event.api.Event; -import org.sakaiproject.memory.api.Cache; -import org.sakaiproject.memory.api.CacheRefresher; -import org.sakaiproject.memory.api.MemoryService; -import org.sakaiproject.signup.dao.SignupMeetingDao; -import org.sakaiproject.signup.model.SignupMeeting; - -/** - *

- * SignupCacheServiceImpl implements the methods to cache the search results of a - * list of the SignupMeeting objects from the DB. - *

- * - * @author Peter Liu - * - */ - -public class SignupCacheServiceImpl implements SignupCacheService, - CacheRefresher { - - private MemoryService memoryService; - - protected SignupMeetingDao signupMeetingDao; - - private static Log M_log = LogFactory.getLog(SignupCacheServiceImpl.class); - - private Cache m_signupSiteCache = null; - - /** The one and only one client. */ - public static SignupCacheServiceImpl m_instance = null; - - public void init() { - - /* Here we use sakai default cache expiration: 5 minutes */ - try { - // The other parameters are not needed for this cache - m_signupSiteCache = memoryService - .newCache("org.sakaiproject.signup.logic.siteCache"); - if (m_instance == null) { - m_instance = this; - } - - if (M_log.isDebugEnabled()) { - M_log.debug(this + ".init()"); - } - } catch (Throwable t) { - M_log.warn(this + "init(): ", t); - } - } - - /** - * {@inheritDoc} - */ - public List getAllSignupMeetingsInSite(String siteId, - Date startDate, int timeLengthInDays) { - List sEvents = null; - - Calendar calendar = Calendar.getInstance(); - calendar.setTime(startDate); - calendar.add(Calendar.HOUR, 24 * timeLengthInDays); - Date endDate = calendar.getTime(); - - String searchKey = siteId + "_" + timeLengthInDays; - - Object cached = getCachedValue(searchKey); - - if (cached != null) { - sEvents = (List) cached; - return sEvents; - } - - /* Case: if not cached */ - - //get data from db then cache and return it - sEvents = getSignupMeetingDao().getSignupMeetingsInSite(siteId, - startDate, endDate); - - if (sEvents == null || sEvents.isEmpty()) { - return null; - } - - // cache the results for awhile Sakai default: 5 minutes. - if (m_signupSiteCache != null) - m_signupSiteCache.put(searchKey, sEvents); - - //if the expiration time 5 minutes is too long, then we should use the below one. - //m_signupSiteCache.put(searchKey, sEvents, 3*60); //3 minutes - - return sEvents; - } - - /** - * {@inheritDoc} - */ - public List getAllSignupMeetingsInSites( - List siteIds, Date startDate, int searchTimeFrame) { - List allSearchSitesEvents = new ArrayList(); - if (siteIds != null) { - for (String siteId : siteIds) { - List oneSiteEvents = getAllSignupMeetingsInSite( - siteId, startDate, searchTimeFrame); - //add in - if (oneSiteEvents != null && !oneSiteEvents.isEmpty()) { - allSearchSitesEvents.addAll(oneSiteEvents); - } - } - } - - return allSearchSitesEvents; - } - - /* - * Encapsulate the null-check on the cache itself and return the object - */ - private Object getCachedValue(String searchKey) { - return (m_signupSiteCache != null) ? m_signupSiteCache.get(searchKey): null; - } - - - /** - * Returns to uninitialized state. - */ - public void destroy() { - if (m_signupSiteCache != null) { - m_signupSiteCache.close(); - - } - - M_log.info("destroy()"); - } - - /** - * {@inheritDoc} - */ - public Object refresh(Object key, Object oldValue, Event event) { - /* - * instead of refreshing when an entry expires, let it go and we'll get - * it again if needed - */ - return null; - } - - public MemoryService getMemoryService() { - return memoryService; - } - - public void setMemoryService(MemoryService memoryService) { - this.memoryService = memoryService; - } - - public SignupMeetingDao getSignupMeetingDao() { - return signupMeetingDao; - } - - public void setSignupMeetingDao(SignupMeetingDao signupMeetingDao) { - this.signupMeetingDao = signupMeetingDao; - } - -} +/* +* Licensed to The Apereo Foundation under one or more contributor license +* agreements. See the NOTICE file distributed with this work for +* additional information regarding copyright ownership. +* +* The Apereo Foundation licenses this file to you 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: +* +* http://opensource.org/licenses/ecl2.txt +* +* 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.sakaiproject.signup.logic; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sakaiproject.event.api.Event; +import org.sakaiproject.memory.api.Cache; +import org.sakaiproject.memory.api.CacheRefresher; +import org.sakaiproject.memory.api.MemoryService; +import org.sakaiproject.signup.dao.SignupMeetingDao; +import org.sakaiproject.signup.model.SignupMeeting; + +/** + *

+ * SignupCacheServiceImpl implements the methods to cache the search results of a + * list of the SignupMeeting objects from the DB. + *

+ * + * @author Peter Liu + * + */ + +public class SignupCacheServiceImpl implements SignupCacheService, + CacheRefresher { + + private MemoryService memoryService; + + protected SignupMeetingDao signupMeetingDao; + + private static Logger M_log = LoggerFactory.getLogger(SignupCacheServiceImpl.class); + + private Cache m_signupSiteCache = null; + + /** The one and only one client. */ + public static SignupCacheServiceImpl m_instance = null; + + public void init() { + + /* Here we use sakai default cache expiration: 5 minutes */ + try { + // The other parameters are not needed for this cache + m_signupSiteCache = memoryService + .newCache("org.sakaiproject.signup.logic.siteCache"); + if (m_instance == null) { + m_instance = this; + } + + if (M_log.isDebugEnabled()) { + M_log.debug(this + ".init()"); + } + } catch (Throwable t) { + M_log.warn(this + "init(): ", t); + } + } + + /** + * {@inheritDoc} + */ + public List getAllSignupMeetingsInSite(String siteId, + Date startDate, int timeLengthInDays) { + List sEvents = null; + + Calendar calendar = Calendar.getInstance(); + calendar.setTime(startDate); + calendar.add(Calendar.HOUR, 24 * timeLengthInDays); + Date endDate = calendar.getTime(); + + String searchKey = siteId + "_" + timeLengthInDays; + + Object cached = getCachedValue(searchKey); + + if (cached != null) { + sEvents = (List) cached; + return sEvents; + } + + /* Case: if not cached */ + + //get data from db then cache and return it + sEvents = getSignupMeetingDao().getSignupMeetingsInSite(siteId, + startDate, endDate); + + if (sEvents == null || sEvents.isEmpty()) { + return null; + } + + // cache the results for awhile Sakai default: 5 minutes. + if (m_signupSiteCache != null) + m_signupSiteCache.put(searchKey, sEvents); + + //if the expiration time 5 minutes is too long, then we should use the below one. + //m_signupSiteCache.put(searchKey, sEvents, 3*60); //3 minutes + + return sEvents; + } + + /** + * {@inheritDoc} + */ + public List getAllSignupMeetingsInSites( + List siteIds, Date startDate, int searchTimeFrame) { + List allSearchSitesEvents = new ArrayList(); + if (siteIds != null) { + for (String siteId : siteIds) { + List oneSiteEvents = getAllSignupMeetingsInSite( + siteId, startDate, searchTimeFrame); + //add in + if (oneSiteEvents != null && !oneSiteEvents.isEmpty()) { + allSearchSitesEvents.addAll(oneSiteEvents); + } + } + } + + return allSearchSitesEvents; + } + + /* + * Encapsulate the null-check on the cache itself and return the object + */ + private Object getCachedValue(String searchKey) { + return (m_signupSiteCache != null) ? m_signupSiteCache.get(searchKey): null; + } + + + /** + * Returns to uninitialized state. + */ + public void destroy() { + if (m_signupSiteCache != null) { + m_signupSiteCache.close(); + + } + + M_log.info("destroy()"); + } + + /** + * {@inheritDoc} + */ + public Object refresh(Object key, Object oldValue, Event event) { + /* + * instead of refreshing when an entry expires, let it go and we'll get + * it again if needed + */ + return null; + } + + public MemoryService getMemoryService() { + return memoryService; + } + + public void setMemoryService(MemoryService memoryService) { + this.memoryService = memoryService; + } + + public SignupMeetingDao getSignupMeetingDao() { + return signupMeetingDao; + } + + public void setSignupMeetingDao(SignupMeetingDao signupMeetingDao) { + this.signupMeetingDao = signupMeetingDao; + } + +} diff --git a/signup/impl/src/java/org/sakaiproject/signup/logic/SignupEmailFacadeImpl.java b/signup/impl/src/java/org/sakaiproject/signup/logic/SignupEmailFacadeImpl.java index fb6f7d06728c..c88ced8ff9b5 100644 --- a/signup/impl/src/java/org/sakaiproject/signup/logic/SignupEmailFacadeImpl.java +++ b/signup/impl/src/java/org/sakaiproject/signup/logic/SignupEmailFacadeImpl.java @@ -1,819 +1,819 @@ -/* -* Licensed to The Apereo Foundation under one or more contributor license -* agreements. See the NOTICE file distributed with this work for -* additional information regarding copyright ownership. -* -* The Apereo Foundation licenses this file to you 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: -* -* http://opensource.org/licenses/ecl2.txt -* -* 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.sakaiproject.signup.logic; - -import java.io.File; -import java.util.*; - -import lombok.Getter; -import lombok.Setter; - -import net.fortuna.ical4j.model.component.VEvent; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.commons.validator.EmailValidator; -import org.sakaiproject.email.api.AddressValidationException; -import org.sakaiproject.email.api.Attachment; -import org.sakaiproject.email.api.EmailAddress; -import org.sakaiproject.email.api.EmailMessage; -import org.sakaiproject.email.api.EmailService; -import org.sakaiproject.email.api.NoRecipientsException; -import org.sakaiproject.signup.logic.messages.AddAttendeeEmail; -import org.sakaiproject.signup.logic.messages.AttendeeCancellationEmail; -import org.sakaiproject.signup.logic.messages.AttendeeCancellationOwnEmail; -import org.sakaiproject.signup.logic.messages.AttendeeModifiedCommentEmail; -import org.sakaiproject.signup.logic.messages.AttendeeSignupEmail; -import org.sakaiproject.signup.logic.messages.AttendeeSignupOwnEmail; -import org.sakaiproject.signup.logic.messages.CancelMeetingEmail; -import org.sakaiproject.signup.logic.messages.CancellationEmail; -import org.sakaiproject.signup.logic.messages.EmailDeliverer; -import org.sakaiproject.signup.logic.messages.ModifyMeetingEmail; -import org.sakaiproject.signup.logic.messages.MoveAttendeeEmail; -import org.sakaiproject.signup.logic.messages.NewMeetingEmail; -import org.sakaiproject.signup.logic.messages.OrganizerPreAssignEmail; -import org.sakaiproject.signup.logic.messages.PromoteAttendeeEmail; -import org.sakaiproject.signup.logic.messages.SignupEmailNotification; -import org.sakaiproject.signup.logic.messages.SignupEventTrackingInfo; -import org.sakaiproject.signup.logic.messages.SwapAttendeeEmail; -import org.sakaiproject.signup.model.SignupAttendee; -import org.sakaiproject.signup.model.SignupMeeting; -import org.sakaiproject.signup.model.SignupTimeslot; -import org.sakaiproject.user.api.User; -import org.sakaiproject.user.api.UserDirectoryService; -import org.sakaiproject.user.api.UserNotDefinedException; - -import javax.activation.DataSource; -import javax.activation.FileDataSource; - -/** - *

- * This is an implementation of SignupEmailFacade interface, which provided - * methods for Signup tool to send emails out via emailService - *

- */ -public class SignupEmailFacadeImpl implements SignupEmailFacade { - - @Getter @Setter - private EmailService emailService; - - @Getter @Setter - private UserDirectoryService userDirectoryService; - - @Getter @Setter - private SakaiFacade sakaiFacade; - - @Setter - private SignupCalendarHelper calendarHelper; - - private Log logger = LogFactory.getLog(SignupEmailFacadeImpl.class); - - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - public void sendEmailAllUsers(SignupMeeting meeting, String messageType) throws Exception { - if (messageType.equals(SIGNUP_NEW_MEETING) || messageType.equals(SIGNUP_MEETING_MODIFIED) || messageType.equals(SIGNUP_CANCEL_MEETING)) { - sendEmailToAllUsers(meeting, messageType); - return; - } - } - - /** - * {@inheritDoc} - */ - public void sendEmailToOrganizer(SignupEventTrackingInfo signupEventTrackingInfo) throws Exception { - - boolean isException=false; - - //generate VEvents - generateVEvents(signupEventTrackingInfo.getMeeting()); - - List sigupTList = signupEventTrackingInfo.getAttendeeTransferInfos(); - for (SignupTrackingItem item : sigupTList) { - if (item.getMessageType().equals(SIGNUP_ATTENDEE_SIGNUP)) { - //User creator = null; - User participant = null; - try { - //creator = userDirectoryService.getUser(signupEventTrackingInfo.getMeeting().getCreatorUserId()) - List OwnerAndCoordinators = getMeetingOwnerAndCoordinators(signupEventTrackingInfo.getMeeting()); - if(OwnerAndCoordinators.isEmpty()){ - throw new Exception("No Organizer/Coordinator is not found and Email is not sent away for oraginzer"); - } - - participant = userDirectoryService.getUser(item.getAttendee().getAttendeeUserId()); - for (User organizer : OwnerAndCoordinators) { - SignupEmailNotification email = new AttendeeSignupEmail(organizer, participant, - signupEventTrackingInfo.getMeeting(), item.getAddToTimeslot(), this.sakaiFacade); - - sendEmail(organizer, email); - } - /*SignupEmailNotification email = new AttendeeSignupEmail(creator, participant, - signupEventTrackingInfo.getMeeting(), item.getAddToTimeslot(), this.sakaiFacade); - - sendEmail(creator, email);*/ - } catch (UserNotDefinedException e) { - isException = true; - } - } - } - - if(isException) - throw new Exception("Email may not be sent out due to error."); - - return; - - } - - private List getMeetingOwnerAndCoordinators(SignupMeeting meeting){ - Set organizerCoordinators = new LinkedHashSet(); - try{ - User creator = userDirectoryService.getUser(meeting.getCreatorUserId()); - organizerCoordinators.add(creator); - }catch (UserNotDefinedException e) { - logger.warn("User is not found and Email is not sent away for oraginzer userId:" - + meeting.getCreatorUserId()); - } - - List coordinatorIds = meeting.getCoordinatorIdsList(); - for (String cId : coordinatorIds) { - try{ - User coUser = userDirectoryService.getUser(cId); - organizerCoordinators.add(coUser); - }catch (UserNotDefinedException e) { - logger.warn("User is not found and Email is not sent away for coordinator userId:" + cId); - } - } - - - return new ArrayList(organizerCoordinators); - } - - /** - * {@inheritDoc} - */ - public void sendCancellationEmail(SignupEventTrackingInfo signupEventTrackingInfo) throws Exception { - - //generate VEvents - generateVEvents(signupEventTrackingInfo.getMeeting()); - - /* send email to everyone who get promoted during the process */ - // TODO Do we need to send info about promoted guys to organizer? - List sigupTList = signupEventTrackingInfo.getAttendeeTransferInfos(); - for (SignupTrackingItem item : sigupTList) { - /* no email send to the cancellation guy */ - if (item.getMessageType().equals(SIGNUP_ATTENDEE_PROMOTE)) { - User attendee = null; - try { - attendee = userDirectoryService.getUser(item.getAttendee().getAttendeeUserId()); - PromoteAttendeeEmail email = new PromoteAttendeeEmail(attendee, item, signupEventTrackingInfo - .getMeeting(), this.sakaiFacade); - sendEmail(attendee, email); - } catch (UserNotDefinedException e) { - throw new Exception("User is not found and Email is not sent away for attendee userId: " - + item.getAttendee().getAttendeeUserId()); - } - } - - } - - //User organizer = null; - User initiator = null; - try { - //organizer = userDirectoryService.getUser(signupEventTrackingInfo.getMeeting().getCreatorUserId()) - List OwnerAndCoordinators = getMeetingOwnerAndCoordinators(signupEventTrackingInfo.getMeeting()); - if(OwnerAndCoordinators.isEmpty()){ - throw new Exception("No Organizer/Coordinator is not found and Email is not sent away for oraginzer"); - } - - initiator = userDirectoryService.getUser(signupEventTrackingInfo.getInitiatorAllocationInfo().getAttendee() .getAttendeeUserId()); - - /* send one email to organizer about the update status */ - if (signupEventTrackingInfo.getMeeting().isReceiveEmailByOwner()){ - for (User organizer : OwnerAndCoordinators) { - try{ - AttendeeCancellationEmail email = new AttendeeCancellationEmail(organizer, initiator, sigupTList, signupEventTrackingInfo.getMeeting(), this.sakaiFacade); - sendEmail(organizer, email); - }catch(Exception e){ - //do nothing: avoid one wrong email address for one user to break all things - } - } - } - - //also send an email to the attendee - AttendeeCancellationOwnEmail attendeeEmail = new AttendeeCancellationOwnEmail(initiator, sigupTList, signupEventTrackingInfo.getMeeting(), this.sakaiFacade); - sendEmail(initiator, attendeeEmail); - - } catch (UserNotDefinedException e) { - throw new Exception("User is not found for userId: " - + signupEventTrackingInfo.getMeeting().getCreatorUserId()); - } - - } - - /** - * {@inheritDoc} - */ - public void sendUpdateCommentEmail(SignupEventTrackingInfo signupEventTrackingInfo) throws Exception { - try { - User currentModifier = userDirectoryService.getUser(sakaiFacade.getCurrentUserId()); - boolean isOrganizer = signupEventTrackingInfo.getMeeting().getPermission().isUpdate(); - List coOrganizers = signupEventTrackingInfo.getMeeting().getCoordinatorIdsList(); - User selectedAttendee = userDirectoryService.getUser(signupEventTrackingInfo.getAttendeeComment().getAttendeeId()); - String emailReturnSiteId = sakaiFacade.getCurrentLocationId(); - AttendeeModifiedCommentEmail email = new AttendeeModifiedCommentEmail(currentModifier, signupEventTrackingInfo.getMeeting(), - this.sakaiFacade, emailReturnSiteId, signupEventTrackingInfo.getAttendeeComment()); - - if (isOrganizer){ - try{ - sendEmail(selectedAttendee, email); - }catch(Exception e){ - //do nothing: avoid one wrong email address for one user to break all things - } - } - else { - try{ - //attendee send email out - List coUsers = new ArrayList(); - User organizer = userDirectoryService.getUser(signupEventTrackingInfo.getMeeting().getCreatorUserId()); - coUsers.add(organizer); - if(coOrganizers !=null && !coOrganizers.isEmpty()){ - for (String userId : coOrganizers) { - User coUser = userDirectoryService.getUser(userId); - coUsers.add(coUser); - } - } - sendEmail(coUsers, email); - }catch(Exception e){ - //do nothing: avoid one wrong email address for one user to break all things - } - } - } catch (UserNotDefinedException e) { - throw new Exception("User is not found for userId: " - + signupEventTrackingInfo.getMeeting().getCreatorUserId()); - } - } - - /** - * {@inheritDoc} - */ - public void sendEmailToParticipantsByOrganizerAction(SignupEventTrackingInfo signupEventTrackingInfo) throws Exception { - - //generate VEvents - generateVEvents(signupEventTrackingInfo.getMeeting()); - - List sigupTList = signupEventTrackingInfo.getAttendeeTransferInfos(); - for (SignupTrackingItem item : sigupTList) { - - User organizer = null; - User participant = null; - User participant2 = null; - try { - organizer = userDirectoryService.getUser(getSakaiFacade().getCurrentUserId()); - participant = userDirectoryService.getUser(item.getAttendee().getAttendeeUserId()); - if (item.getMessageType().equals(SIGNUP_ATTENDEE_SIGNUP_SWAP) - || item.getMessageType().equals(SIGNUP_ATTENDEE_SIGNUP_REPLACE)) { - participant2 = userDirectoryService.getUser(item.getReplacedAttendde().getAttendeeUserId()); - } - - SignupEmailNotification email = null; - if (item.getMessageType().equals(SIGNUP_ATTENDEE_SIGNUP_MOVE)) - email = new MoveAttendeeEmail(organizer, participant, item, signupEventTrackingInfo.getMeeting(), - sakaiFacade); - else if (item.getMessageType().equals(SIGNUP_ATTENDEE_SIGNUP_SWAP)) - email = new SwapAttendeeEmail(organizer, participant, participant2, item, signupEventTrackingInfo - .getMeeting(), sakaiFacade); - else if (item.getMessageType().equals(SIGNUP_ATTENDEE_CANCEL)) - email = new CancellationEmail(organizer, participant, item, signupEventTrackingInfo.getMeeting(), - sakaiFacade); - else if (item.getMessageType().equals(SIGNUP_ATTENDEE_SIGNUP_REPLACE) - || item.getMessageType().equals(SIGNUP_ATTENDEE_SIGNUP)) - email = new AddAttendeeEmail(organizer, participant, item, signupEventTrackingInfo.getMeeting(), - sakaiFacade); - else if (item.getMessageType().equals(SIGNUP_ATTENDEE_PROMOTE)) - email = new PromoteAttendeeEmail(participant, item, signupEventTrackingInfo.getMeeting(), - sakaiFacade); - else { - logger.warn("For attendee(Eid):" + participant.getEid() + " - No such message type:" - + item.getMessageType() + " was found and no email was able to send away"); - return; - } - // send email out - sendEmail(participant, email); - - } catch (UserNotDefinedException e) { - throw new Exception("User is not found and Email is not sent away for oraginzer userId:" - + signupEventTrackingInfo.getMeeting().getCreatorUserId()); - } - } - } - - - /** - * {@inheritDoc} - */ - public void sendEmailToAttendee(SignupEventTrackingInfo signupEventTrackingInfo) throws Exception { - - //generate VEvents - generateVEvents(signupEventTrackingInfo.getMeeting()); - - List sigupTList = signupEventTrackingInfo.getAttendeeTransferInfos(); - for (SignupTrackingItem item : sigupTList) { - if (item.getMessageType().equals(SIGNUP_ATTENDEE_SIGNUP)) { - User participant = null; - try { - participant = userDirectoryService.getUser(item.getAttendee().getAttendeeUserId()); - SignupEmailNotification email = new AttendeeSignupOwnEmail(participant, signupEventTrackingInfo.getMeeting(), item.getAddToTimeslot(), this.sakaiFacade); - sendEmail(participant, email); - } catch (UserNotDefinedException e) { - throw new Exception("User is not found and email has not been sent for participant: " + signupEventTrackingInfo.getMeeting().getCreatorUserId()); - } - } - } - return; - } - - /* send email via Sakai email Service */ - private void sendEmail(User user, SignupEmailNotification email) { - - logger.debug("sendMail called for user:" + user.getEid()); - - try { - EmailMessage message = convertSignupEmail(email, user); - - if(message != null) { - emailService.send(message); - } - - } catch (NoRecipientsException e) { - logger.error("Cannot send mail. No recipient." + e.getMessage()); - } catch (AddressValidationException e) { - //this should be caught when adding the email address, since it is validated then. - logger.warn("Cannot send mail to user: " + user.getEid() + ". Invalid email address." + EmailAddress.toString(e.getInvalidEmailAddresses())); - } - - } - - /* all email is sent in this manner, so that we can send attachments. So individual users are processed separately - * There may be issues with this if there are many users. */ - private void sendEmail(List users, SignupEmailNotification email) { - for(User u: users) { - sendEmail(u, email); - } - } - - @SuppressWarnings("unchecked") - private List getUserSiteEmailGroups(List signupUsers) { - List userSiteGroupList = new ArrayList(); - for (SignupUser signupUser : signupUsers) { - String siteId = signupUser.getMainSiteId(); - boolean found = false; - for (EmailUserSiteGroup userSiteGroup : userSiteGroupList) { - if (siteId.equals(userSiteGroup.getSiteId())) { - userSiteGroup.addSignupUser(signupUser); - found = true; - break; - } - } - if (!found) { - EmailUserSiteGroup usg = new EmailUserSiteGroup(siteId, signupUser); - userSiteGroupList.add(usg); - } - } - - return userSiteGroupList; - } - - - /* send email to all according to the message type */ - @SuppressWarnings("unchecked") - private void sendEmailToAllUsers(SignupMeeting meeting, String messageType) throws Exception { - - //generate VEvents - generateVEvents(meeting); - - List signupUsers = sakaiFacade.getAllUsers(meeting); - - List userSiteGroupList = getUserSiteEmailGroups(signupUsers); - boolean isException = false; - boolean isAlreadyEmailedToOrganizerCoordinators = false; //avoid duplicated email - /*divide email-send out by site to site*/ - for (EmailUserSiteGroup emailUserSiteGroup : userSiteGroupList) { - if (!emailUserSiteGroup.isPublishedSite()) - continue;// skip sending email - - List userIds = null; - List sakaiUsers = null; - User organizer = null; - try { - SignupEmailNotification email = null; - if (messageType.equals(SIGNUP_NEW_MEETING)) { - organizer = userDirectoryService.getUser(meeting.getCreatorUserId()); - email = new NewMeetingEmail(organizer, meeting, this.sakaiFacade, emailUserSiteGroup.getSiteId()); - /* - * We have to send it no matter what!!! - * send email to pre-assiged people for this site group and - * also excluding them for next step. - */ - try{ - //don't stop to send another email out due to exception - sendEmailToPreAssignedAttendee(emailUserSiteGroup, meeting); - }catch(Exception e){ - isException=true; - } - - /*Check to see if email is for all participants*/ - if(SEND_EMAIL_ALL_PARTICIPANTS.equals(meeting.getSendEmailToSelectedPeopleOnly())){ - /* get the people list excluding pre-assigned ones */ - userIds = emailUserSiteGroup.getUserInternalIds(); - sakaiUsers = userDirectoryService.getUsers(userIds); - } - else { - //Case: SEND_EMAIL_ONLY_ORGANIZER_COORDINATORS/SEND_EMAIL_ONLY_SIGNED_UP_ATTENDEES - //we have to send to organizers no matter what!! - //case: email attendee Only and the email are already sent away - /*Now, we need to send email to organizer and coordinators - * since the iCal file is involved*/ - if(!isAlreadyEmailedToOrganizerCoordinators){ - sakaiUsers =getMeetingOwnerAndCoordinators(meeting); - isAlreadyEmailedToOrganizerCoordinators=true; - } - } - - } else if (messageType.equals(SIGNUP_MEETING_MODIFIED) || messageType.equals(SIGNUP_CANCEL_MEETING)) { - organizer = userDirectoryService.getUser(getSakaiFacade().getCurrentUserId()); - - //same logic for both, just different emails - if(messageType.equals(SIGNUP_MEETING_MODIFIED)) { - email = new ModifyMeetingEmail(organizer, meeting, this.sakaiFacade, emailUserSiteGroup.getSiteId()); - }else if(messageType.equals(SIGNUP_CANCEL_MEETING)) { - email = new CancelMeetingEmail(organizer, meeting, this.sakaiFacade, emailUserSiteGroup.getSiteId()); - } - - if (SEND_EMAIL_ALL_PARTICIPANTS.equals(meeting.getSendEmailToSelectedPeopleOnly())){ - userIds = emailUserSiteGroup.getUserInternalIds(); - sakaiUsers = userDirectoryService.getUsers(userIds); - }else if (SEND_EMAIL_ONLY_ORGANIZER_COORDINATORS.equals(meeting.getSendEmailToSelectedPeopleOnly())){ - if(!isAlreadyEmailedToOrganizerCoordinators){ - //avoid duplicated email - sakaiUsers =getMeetingOwnerAndCoordinators(meeting); - isAlreadyEmailedToOrganizerCoordinators=true; - } - }else if (SEND_EMAIL_ONLY_SIGNED_UP_ATTENDEES.equals(meeting.getSendEmailToSelectedPeopleOnly())){ - List tsList = meeting.getSignupTimeSlots(); - User user = null; - List sgpUsers = emailUserSiteGroup.getSignupUsers(); - sakaiUsers = new ArrayList(); - - /*due to iCal file, we need to handle for canceling meeting case for organizer etc.*/ - //this one may not be needed since SIGNUP_CANCEL_MEETING always should with value:SEND_EMAIL_ALL_PARTICIPANTS - //TODO need to find a way: update related ones iCals if the meeting schedule is modified - if(!isAlreadyEmailedToOrganizerCoordinators && messageType.equals(SIGNUP_CANCEL_MEETING) ){ - sakaiUsers =getMeetingOwnerAndCoordinators(meeting); - isAlreadyEmailedToOrganizerCoordinators=true; - } - - if(tsList !=null){ - for (SignupTimeslot ts : tsList) { - List attList = ts.getAttendees(); - if(attList !=null){ - for (SignupAttendee att : attList) { - /*test to see if attendee is in this site-group*/ - for (SignupUser spgUser : sgpUsers) { - if(att.getAttendeeUserId().equals(spgUser.getInternalUserId())){ - try{ - user = userDirectoryService.getUser(att.getAttendeeUserId()); - } catch (UserNotDefinedException e) { - logger.warn("User is not found for userId: " + att.getAttendeeUserId()); - isException = true; - } - sakaiUsers.add(user); - break; - } - } - - } - } - - } - } - } - } - - if (email != null){ - if(sakaiUsers.size()> 400){ - /*Currently, use this only for heavy case. - * One drawback: the organizer don't know weather the email is really sent away or not. - * There is no error message for user if an unexpected exception happens. - * Will add the email-send-error notification at near future time. - * */ - - //NO ICS FILE IS SENT VIA THIS METHOD YET - EmailDeliverer deliverer = new EmailDeliverer(sakaiUsers, email.getHeader(),email.getMessage(),emailService); - Thread t = new Thread(deliverer); - t.start(); - } - else { - //emailService.sendToUsers(sakaiUsers, email.getHeader(), email.getMessage()); - sendEmail(sakaiUsers, email); - } - } - - } catch (UserNotDefinedException ue) { - isException = true; - logger.warn("User is not found for userId: " + meeting.getCreatorUserId()); - } catch (Exception e) { - isException = true; - logger.error("Exception: " + e.getClass() + ": " + e.getMessage()); - } - } - - if(isException) - throw new Exception("Some emails may not be sent out due to error."); - } - - private void sendEmailToPreAssignedAttendee(EmailUserSiteGroup emailUserSiteGroup, SignupMeeting meeting) - throws Exception { - List sgpUsers = emailUserSiteGroup.getSignupUsers(); - List signupTimeSlots = meeting.getSignupTimeSlots(); - if (signupTimeSlots == null) - return; - - boolean isExcepiotn = false; - User currentUser = userDirectoryService.getCurrentUser(); - for (SignupTimeslot timeslot : signupTimeSlots) { - List attendees = timeslot.getAttendees(); - if (attendees == null) - continue; - - for (SignupAttendee attendee : attendees) { - for (Iterator iter = sgpUsers.iterator(); iter.hasNext();) { - SignupUser spUser = (SignupUser) iter.next(); - if (spUser.getInternalUserId().equals(attendee.getAttendeeUserId())) { - User user; - try { - user = userDirectoryService.getUser(attendee.getAttendeeUserId()); - SignupEmailNotification email = new OrganizerPreAssignEmail(currentUser, meeting, timeslot, - user, this.sakaiFacade, emailUserSiteGroup.getSiteId()); - sendEmail(user, email); - } catch (UserNotDefinedException e) { - logger.warn("User is not found for userId: " + attendee.getAttendeeUserId()); - isExcepiotn = true; - } - /* - * remove it to avoid send new meeting notification - * again - */ - iter.remove(); - break; - } - } - - } - } - - if (isExcepiotn) - throw new Exception("User is not found and email may not be sent out."); - } - - /** - * This will exlude the pre-assigned attendee for a new meeting since they - * will receive a different email - * - * @param sakaiUsers - * a list of User objects. - * @param meeting - * a SignupMeeting Object. - */ - private void excludPreAssignedAttendee(List sakaiUsers, SignupMeeting meeting) { - List signupTimeSlots = meeting.getSignupTimeSlots(); - if (signupTimeSlots == null) - return; - - for (SignupTimeslot timeslot : signupTimeSlots) { - List attendees = timeslot.getAttendees(); - if (attendees == null) - continue; - - User preAssignedUser = null; - for (SignupAttendee attendee : attendees) { - try { - preAssignedUser = userDirectoryService.getUser(attendee.getAttendeeUserId()); - for (Iterator iter = sakaiUsers.iterator(); iter.hasNext();) { - User sakaiUser = (User) iter.next(); - if (sakaiUser.getEid().equals(preAssignedUser.getEid())) { - iter.remove(); - } - } - - } catch (UserNotDefinedException e) { - logger.warn("User is not found for userId: " + attendee.getAttendeeUserId()); - } - - } - } - } - - private class EmailUserSiteGroup { - private String siteId; - - private boolean publishedSite; - - private List signupUsers = new ArrayList(); - - public EmailUserSiteGroup(String siteId, SignupUser user) { - this.siteId = siteId; - this.signupUsers.add(user); - this.publishedSite = user.isPublishedSite(); - } - - public void addSignupUser(SignupUser user) { - this.signupUsers.add(user); - } - - public String getSiteId() { - return siteId; - } - - public void setSiteId(String siteId) { - this.siteId = siteId; - } - - public List getSignupUsers() { - return signupUsers; - } - - public void setSignupUsers(List signupUsers) { - this.signupUsers = signupUsers; - } - - public List getUserInternalIds() { - List userIds = new ArrayList(); - for (SignupUser signupUser : signupUsers) { - userIds.add(signupUser.getInternalUserId()); - } - return userIds; - } - - public boolean isPublishedSite() { - return publishedSite; - } - - public void setPublishedSite(boolean publishedSite) { - this.publishedSite = publishedSite; - } - - } - - /** - * Helper to convert a signup email notification into a Sakai EmailMessage, which can encapsulate attachments. - * - *

Due to the way the email objects are created, ie one per email that needs to be sent, not one per user, we cannot store any - * user specific attachments within the email objects themselves. So this method assembles an EmailMessage per user - * - * @param email - the signup email obj we will extract info from - * @param recipient - list of user to receive the email - * @return - */ - private EmailMessage convertSignupEmail(SignupEmailNotification email, User recipient) { - - EmailMessage message = new EmailMessage(); - - //setup message - message.setHeaders(email.getHeader()); - message.setBody(email.getMessage()); - - // Pass a flag to the EmailService to indicate that we want the MIME multipart subtype set to alternative - // so that an email client can present the message as a meeting invite - message.setHeader("multipart-subtype", "alternative"); - - //note that the headers are largely ignored so we need to repeat some things here that are actually in the headers - //if these are eventaully converted to proper email templates, this should be alleviated - message.setSubject(email.getSubject()); - - logger.debug("email.getFromAddress(): " + email.getFromAddress()); - - message.setFrom(email.getFromAddress()); - message.setContentType("text/html; charset=UTF-8"); - - if(!email.isModifyComment()){ - //skip ICS attachment file for user comment email - for(Attachment a: collectAttachments(email, recipient)){ - message.addAttachment(a); - } - } - - //add recipient, only if valid email - String emailAddress = recipient.getEmail(); - if(StringUtils.isNotBlank(emailAddress) && EmailValidator.getInstance().isValid(emailAddress)) { - message.addRecipient(EmailAddress.RecipientType.TO, recipient.getDisplayName(), emailAddress); - } else { - logger.debug("Invalid email for user: " + recipient.getDisplayId() + ". No email will be sent to this user"); - return null; - } - - return message; - } - - /** - * Helper method to collect all attachments that need to go out for this email and to this user - * @param email signupemailnotification - * @param user the user that will receive this email - * @return list of Attachments - */ - private List collectAttachments(SignupEmailNotification email, User user) { - - List attachments = new ArrayList(); - attachments.addAll(generateICS(email, user)); - //add more here as required - - return attachments; - - } - - /** - * Generate an ICS file for the user and the email message type and return as an attachment. - * - * @param email email obj - * @param user User - * @return - */ - private List generateICS(SignupEmailNotification email, User user) { - - List attachments = new ArrayList(); - - String method = email.isCancellation() ? "CANCEL" : "REQUEST"; - final List events = email.generateEvents(user, calendarHelper); - - if (events.size() > 0) { - attachments.add(formatICSAttachment(events, method)); - } - - /* - * Note that there is no notification if a meeting is removed altogether. - */ - - - return attachments; - } - - - /** - * Helper to generate the calendareventedit objects, turn them into VEvents, then write back into the meeting/timeslot objects - * One is generated for the signupmeeting itself, then one for each timeslot. - * @param meeting SignupMeeting - * @return modifiedSignupmeeting with the VEvents injected - */ - private SignupMeeting generateVEvents(SignupMeeting meeting) { - - //generate VEvent for meeting, add to object - meeting.setVevent(calendarHelper.generateVEventForMeeting(meeting)); - - //now one for each timeslot - for(SignupTimeslot ts: meeting.getSignupTimeSlots()){ - - //generate VEvent for timeslot, add to object - ts.setVevent(calendarHelper.generateVEventForTimeslot(meeting, ts)); - } - - return meeting; - } - - /** - * Helper to create an ICS calendar from a list of vevents, then turn it into an attachment - * @param vevents list of vevents - * @param method the ITIP method for the calendar, e.g. "REQUEST" - * @return - */ - private Attachment formatICSAttachment(List vevents, String method) { - String path = calendarHelper.createCalendarFile(vevents, method); - - // Explicitly define the Content-Type and Content-Diposition headers so the invitation appears inline - String filename = StringUtils.substringAfterLast(path, File.separator); - String type = String.format("text/calendar; charset=\"utf-8\"; method=%s; name=signup-invite.ics", method); - File file = new File(path); - DataSource dataSource = new Attachment.RenamedDataSource(new FileDataSource(file), filename); - return new Attachment(dataSource, type, Attachment.ContentDisposition.INLINE); - } - - -} +/* +* Licensed to The Apereo Foundation under one or more contributor license +* agreements. See the NOTICE file distributed with this work for +* additional information regarding copyright ownership. +* +* The Apereo Foundation licenses this file to you 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: +* +* http://opensource.org/licenses/ecl2.txt +* +* 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.sakaiproject.signup.logic; + +import java.io.File; +import java.util.*; + +import lombok.Getter; +import lombok.Setter; + +import net.fortuna.ical4j.model.component.VEvent; + +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.apache.commons.validator.EmailValidator; +import org.sakaiproject.email.api.AddressValidationException; +import org.sakaiproject.email.api.Attachment; +import org.sakaiproject.email.api.EmailAddress; +import org.sakaiproject.email.api.EmailMessage; +import org.sakaiproject.email.api.EmailService; +import org.sakaiproject.email.api.NoRecipientsException; +import org.sakaiproject.signup.logic.messages.AddAttendeeEmail; +import org.sakaiproject.signup.logic.messages.AttendeeCancellationEmail; +import org.sakaiproject.signup.logic.messages.AttendeeCancellationOwnEmail; +import org.sakaiproject.signup.logic.messages.AttendeeModifiedCommentEmail; +import org.sakaiproject.signup.logic.messages.AttendeeSignupEmail; +import org.sakaiproject.signup.logic.messages.AttendeeSignupOwnEmail; +import org.sakaiproject.signup.logic.messages.CancelMeetingEmail; +import org.sakaiproject.signup.logic.messages.CancellationEmail; +import org.sakaiproject.signup.logic.messages.EmailDeliverer; +import org.sakaiproject.signup.logic.messages.ModifyMeetingEmail; +import org.sakaiproject.signup.logic.messages.MoveAttendeeEmail; +import org.sakaiproject.signup.logic.messages.NewMeetingEmail; +import org.sakaiproject.signup.logic.messages.OrganizerPreAssignEmail; +import org.sakaiproject.signup.logic.messages.PromoteAttendeeEmail; +import org.sakaiproject.signup.logic.messages.SignupEmailNotification; +import org.sakaiproject.signup.logic.messages.SignupEventTrackingInfo; +import org.sakaiproject.signup.logic.messages.SwapAttendeeEmail; +import org.sakaiproject.signup.model.SignupAttendee; +import org.sakaiproject.signup.model.SignupMeeting; +import org.sakaiproject.signup.model.SignupTimeslot; +import org.sakaiproject.user.api.User; +import org.sakaiproject.user.api.UserDirectoryService; +import org.sakaiproject.user.api.UserNotDefinedException; + +import javax.activation.DataSource; +import javax.activation.FileDataSource; + +/** + *

+ * This is an implementation of SignupEmailFacade interface, which provided + * methods for Signup tool to send emails out via emailService + *

+ */ +public class SignupEmailFacadeImpl implements SignupEmailFacade { + + @Getter @Setter + private EmailService emailService; + + @Getter @Setter + private UserDirectoryService userDirectoryService; + + @Getter @Setter + private SakaiFacade sakaiFacade; + + @Setter + private SignupCalendarHelper calendarHelper; + + private Logger logger = LoggerFactory.getLogger(SignupEmailFacadeImpl.class); + + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public void sendEmailAllUsers(SignupMeeting meeting, String messageType) throws Exception { + if (messageType.equals(SIGNUP_NEW_MEETING) || messageType.equals(SIGNUP_MEETING_MODIFIED) || messageType.equals(SIGNUP_CANCEL_MEETING)) { + sendEmailToAllUsers(meeting, messageType); + return; + } + } + + /** + * {@inheritDoc} + */ + public void sendEmailToOrganizer(SignupEventTrackingInfo signupEventTrackingInfo) throws Exception { + + boolean isException=false; + + //generate VEvents + generateVEvents(signupEventTrackingInfo.getMeeting()); + + List sigupTList = signupEventTrackingInfo.getAttendeeTransferInfos(); + for (SignupTrackingItem item : sigupTList) { + if (item.getMessageType().equals(SIGNUP_ATTENDEE_SIGNUP)) { + //User creator = null; + User participant = null; + try { + //creator = userDirectoryService.getUser(signupEventTrackingInfo.getMeeting().getCreatorUserId()) + List OwnerAndCoordinators = getMeetingOwnerAndCoordinators(signupEventTrackingInfo.getMeeting()); + if(OwnerAndCoordinators.isEmpty()){ + throw new Exception("No Organizer/Coordinator is not found and Email is not sent away for oraginzer"); + } + + participant = userDirectoryService.getUser(item.getAttendee().getAttendeeUserId()); + for (User organizer : OwnerAndCoordinators) { + SignupEmailNotification email = new AttendeeSignupEmail(organizer, participant, + signupEventTrackingInfo.getMeeting(), item.getAddToTimeslot(), this.sakaiFacade); + + sendEmail(organizer, email); + } + /*SignupEmailNotification email = new AttendeeSignupEmail(creator, participant, + signupEventTrackingInfo.getMeeting(), item.getAddToTimeslot(), this.sakaiFacade); + + sendEmail(creator, email);*/ + } catch (UserNotDefinedException e) { + isException = true; + } + } + } + + if(isException) + throw new Exception("Email may not be sent out due to error."); + + return; + + } + + private List getMeetingOwnerAndCoordinators(SignupMeeting meeting){ + Set organizerCoordinators = new LinkedHashSet(); + try{ + User creator = userDirectoryService.getUser(meeting.getCreatorUserId()); + organizerCoordinators.add(creator); + }catch (UserNotDefinedException e) { + logger.warn("User is not found and Email is not sent away for oraginzer userId:" + + meeting.getCreatorUserId()); + } + + List coordinatorIds = meeting.getCoordinatorIdsList(); + for (String cId : coordinatorIds) { + try{ + User coUser = userDirectoryService.getUser(cId); + organizerCoordinators.add(coUser); + }catch (UserNotDefinedException e) { + logger.warn("User is not found and Email is not sent away for coordinator userId:" + cId); + } + } + + + return new ArrayList(organizerCoordinators); + } + + /** + * {@inheritDoc} + */ + public void sendCancellationEmail(SignupEventTrackingInfo signupEventTrackingInfo) throws Exception { + + //generate VEvents + generateVEvents(signupEventTrackingInfo.getMeeting()); + + /* send email to everyone who get promoted during the process */ + // TODO Do we need to send info about promoted guys to organizer? + List sigupTList = signupEventTrackingInfo.getAttendeeTransferInfos(); + for (SignupTrackingItem item : sigupTList) { + /* no email send to the cancellation guy */ + if (item.getMessageType().equals(SIGNUP_ATTENDEE_PROMOTE)) { + User attendee = null; + try { + attendee = userDirectoryService.getUser(item.getAttendee().getAttendeeUserId()); + PromoteAttendeeEmail email = new PromoteAttendeeEmail(attendee, item, signupEventTrackingInfo + .getMeeting(), this.sakaiFacade); + sendEmail(attendee, email); + } catch (UserNotDefinedException e) { + throw new Exception("User is not found and Email is not sent away for attendee userId: " + + item.getAttendee().getAttendeeUserId()); + } + } + + } + + //User organizer = null; + User initiator = null; + try { + //organizer = userDirectoryService.getUser(signupEventTrackingInfo.getMeeting().getCreatorUserId()) + List OwnerAndCoordinators = getMeetingOwnerAndCoordinators(signupEventTrackingInfo.getMeeting()); + if(OwnerAndCoordinators.isEmpty()){ + throw new Exception("No Organizer/Coordinator is not found and Email is not sent away for oraginzer"); + } + + initiator = userDirectoryService.getUser(signupEventTrackingInfo.getInitiatorAllocationInfo().getAttendee() .getAttendeeUserId()); + + /* send one email to organizer about the update status */ + if (signupEventTrackingInfo.getMeeting().isReceiveEmailByOwner()){ + for (User organizer : OwnerAndCoordinators) { + try{ + AttendeeCancellationEmail email = new AttendeeCancellationEmail(organizer, initiator, sigupTList, signupEventTrackingInfo.getMeeting(), this.sakaiFacade); + sendEmail(organizer, email); + }catch(Exception e){ + //do nothing: avoid one wrong email address for one user to break all things + } + } + } + + //also send an email to the attendee + AttendeeCancellationOwnEmail attendeeEmail = new AttendeeCancellationOwnEmail(initiator, sigupTList, signupEventTrackingInfo.getMeeting(), this.sakaiFacade); + sendEmail(initiator, attendeeEmail); + + } catch (UserNotDefinedException e) { + throw new Exception("User is not found for userId: " + + signupEventTrackingInfo.getMeeting().getCreatorUserId()); + } + + } + + /** + * {@inheritDoc} + */ + public void sendUpdateCommentEmail(SignupEventTrackingInfo signupEventTrackingInfo) throws Exception { + try { + User currentModifier = userDirectoryService.getUser(sakaiFacade.getCurrentUserId()); + boolean isOrganizer = signupEventTrackingInfo.getMeeting().getPermission().isUpdate(); + List coOrganizers = signupEventTrackingInfo.getMeeting().getCoordinatorIdsList(); + User selectedAttendee = userDirectoryService.getUser(signupEventTrackingInfo.getAttendeeComment().getAttendeeId()); + String emailReturnSiteId = sakaiFacade.getCurrentLocationId(); + AttendeeModifiedCommentEmail email = new AttendeeModifiedCommentEmail(currentModifier, signupEventTrackingInfo.getMeeting(), + this.sakaiFacade, emailReturnSiteId, signupEventTrackingInfo.getAttendeeComment()); + + if (isOrganizer){ + try{ + sendEmail(selectedAttendee, email); + }catch(Exception e){ + //do nothing: avoid one wrong email address for one user to break all things + } + } + else { + try{ + //attendee send email out + List coUsers = new ArrayList(); + User organizer = userDirectoryService.getUser(signupEventTrackingInfo.getMeeting().getCreatorUserId()); + coUsers.add(organizer); + if(coOrganizers !=null && !coOrganizers.isEmpty()){ + for (String userId : coOrganizers) { + User coUser = userDirectoryService.getUser(userId); + coUsers.add(coUser); + } + } + sendEmail(coUsers, email); + }catch(Exception e){ + //do nothing: avoid one wrong email address for one user to break all things + } + } + } catch (UserNotDefinedException e) { + throw new Exception("User is not found for userId: " + + signupEventTrackingInfo.getMeeting().getCreatorUserId()); + } + } + + /** + * {@inheritDoc} + */ + public void sendEmailToParticipantsByOrganizerAction(SignupEventTrackingInfo signupEventTrackingInfo) throws Exception { + + //generate VEvents + generateVEvents(signupEventTrackingInfo.getMeeting()); + + List sigupTList = signupEventTrackingInfo.getAttendeeTransferInfos(); + for (SignupTrackingItem item : sigupTList) { + + User organizer = null; + User participant = null; + User participant2 = null; + try { + organizer = userDirectoryService.getUser(getSakaiFacade().getCurrentUserId()); + participant = userDirectoryService.getUser(item.getAttendee().getAttendeeUserId()); + if (item.getMessageType().equals(SIGNUP_ATTENDEE_SIGNUP_SWAP) + || item.getMessageType().equals(SIGNUP_ATTENDEE_SIGNUP_REPLACE)) { + participant2 = userDirectoryService.getUser(item.getReplacedAttendde().getAttendeeUserId()); + } + + SignupEmailNotification email = null; + if (item.getMessageType().equals(SIGNUP_ATTENDEE_SIGNUP_MOVE)) + email = new MoveAttendeeEmail(organizer, participant, item, signupEventTrackingInfo.getMeeting(), + sakaiFacade); + else if (item.getMessageType().equals(SIGNUP_ATTENDEE_SIGNUP_SWAP)) + email = new SwapAttendeeEmail(organizer, participant, participant2, item, signupEventTrackingInfo + .getMeeting(), sakaiFacade); + else if (item.getMessageType().equals(SIGNUP_ATTENDEE_CANCEL)) + email = new CancellationEmail(organizer, participant, item, signupEventTrackingInfo.getMeeting(), + sakaiFacade); + else if (item.getMessageType().equals(SIGNUP_ATTENDEE_SIGNUP_REPLACE) + || item.getMessageType().equals(SIGNUP_ATTENDEE_SIGNUP)) + email = new AddAttendeeEmail(organizer, participant, item, signupEventTrackingInfo.getMeeting(), + sakaiFacade); + else if (item.getMessageType().equals(SIGNUP_ATTENDEE_PROMOTE)) + email = new PromoteAttendeeEmail(participant, item, signupEventTrackingInfo.getMeeting(), + sakaiFacade); + else { + logger.warn("For attendee(Eid):" + participant.getEid() + " - No such message type:" + + item.getMessageType() + " was found and no email was able to send away"); + return; + } + // send email out + sendEmail(participant, email); + + } catch (UserNotDefinedException e) { + throw new Exception("User is not found and Email is not sent away for oraginzer userId:" + + signupEventTrackingInfo.getMeeting().getCreatorUserId()); + } + } + } + + + /** + * {@inheritDoc} + */ + public void sendEmailToAttendee(SignupEventTrackingInfo signupEventTrackingInfo) throws Exception { + + //generate VEvents + generateVEvents(signupEventTrackingInfo.getMeeting()); + + List sigupTList = signupEventTrackingInfo.getAttendeeTransferInfos(); + for (SignupTrackingItem item : sigupTList) { + if (item.getMessageType().equals(SIGNUP_ATTENDEE_SIGNUP)) { + User participant = null; + try { + participant = userDirectoryService.getUser(item.getAttendee().getAttendeeUserId()); + SignupEmailNotification email = new AttendeeSignupOwnEmail(participant, signupEventTrackingInfo.getMeeting(), item.getAddToTimeslot(), this.sakaiFacade); + sendEmail(participant, email); + } catch (UserNotDefinedException e) { + throw new Exception("User is not found and email has not been sent for participant: " + signupEventTrackingInfo.getMeeting().getCreatorUserId()); + } + } + } + return; + } + + /* send email via Sakai email Service */ + private void sendEmail(User user, SignupEmailNotification email) { + + logger.debug("sendMail called for user:" + user.getEid()); + + try { + EmailMessage message = convertSignupEmail(email, user); + + if(message != null) { + emailService.send(message); + } + + } catch (NoRecipientsException e) { + logger.error("Cannot send mail. No recipient." + e.getMessage()); + } catch (AddressValidationException e) { + //this should be caught when adding the email address, since it is validated then. + logger.warn("Cannot send mail to user: " + user.getEid() + ". Invalid email address." + EmailAddress.toString(e.getInvalidEmailAddresses())); + } + + } + + /* all email is sent in this manner, so that we can send attachments. So individual users are processed separately + * There may be issues with this if there are many users. */ + private void sendEmail(List users, SignupEmailNotification email) { + for(User u: users) { + sendEmail(u, email); + } + } + + @SuppressWarnings("unchecked") + private List getUserSiteEmailGroups(List signupUsers) { + List userSiteGroupList = new ArrayList(); + for (SignupUser signupUser : signupUsers) { + String siteId = signupUser.getMainSiteId(); + boolean found = false; + for (EmailUserSiteGroup userSiteGroup : userSiteGroupList) { + if (siteId.equals(userSiteGroup.getSiteId())) { + userSiteGroup.addSignupUser(signupUser); + found = true; + break; + } + } + if (!found) { + EmailUserSiteGroup usg = new EmailUserSiteGroup(siteId, signupUser); + userSiteGroupList.add(usg); + } + } + + return userSiteGroupList; + } + + + /* send email to all according to the message type */ + @SuppressWarnings("unchecked") + private void sendEmailToAllUsers(SignupMeeting meeting, String messageType) throws Exception { + + //generate VEvents + generateVEvents(meeting); + + List signupUsers = sakaiFacade.getAllUsers(meeting); + + List userSiteGroupList = getUserSiteEmailGroups(signupUsers); + boolean isException = false; + boolean isAlreadyEmailedToOrganizerCoordinators = false; //avoid duplicated email + /*divide email-send out by site to site*/ + for (EmailUserSiteGroup emailUserSiteGroup : userSiteGroupList) { + if (!emailUserSiteGroup.isPublishedSite()) + continue;// skip sending email + + List userIds = null; + List sakaiUsers = null; + User organizer = null; + try { + SignupEmailNotification email = null; + if (messageType.equals(SIGNUP_NEW_MEETING)) { + organizer = userDirectoryService.getUser(meeting.getCreatorUserId()); + email = new NewMeetingEmail(organizer, meeting, this.sakaiFacade, emailUserSiteGroup.getSiteId()); + /* + * We have to send it no matter what!!! + * send email to pre-assiged people for this site group and + * also excluding them for next step. + */ + try{ + //don't stop to send another email out due to exception + sendEmailToPreAssignedAttendee(emailUserSiteGroup, meeting); + }catch(Exception e){ + isException=true; + } + + /*Check to see if email is for all participants*/ + if(SEND_EMAIL_ALL_PARTICIPANTS.equals(meeting.getSendEmailToSelectedPeopleOnly())){ + /* get the people list excluding pre-assigned ones */ + userIds = emailUserSiteGroup.getUserInternalIds(); + sakaiUsers = userDirectoryService.getUsers(userIds); + } + else { + //Case: SEND_EMAIL_ONLY_ORGANIZER_COORDINATORS/SEND_EMAIL_ONLY_SIGNED_UP_ATTENDEES + //we have to send to organizers no matter what!! + //case: email attendee Only and the email are already sent away + /*Now, we need to send email to organizer and coordinators + * since the iCal file is involved*/ + if(!isAlreadyEmailedToOrganizerCoordinators){ + sakaiUsers =getMeetingOwnerAndCoordinators(meeting); + isAlreadyEmailedToOrganizerCoordinators=true; + } + } + + } else if (messageType.equals(SIGNUP_MEETING_MODIFIED) || messageType.equals(SIGNUP_CANCEL_MEETING)) { + organizer = userDirectoryService.getUser(getSakaiFacade().getCurrentUserId()); + + //same logic for both, just different emails + if(messageType.equals(SIGNUP_MEETING_MODIFIED)) { + email = new ModifyMeetingEmail(organizer, meeting, this.sakaiFacade, emailUserSiteGroup.getSiteId()); + }else if(messageType.equals(SIGNUP_CANCEL_MEETING)) { + email = new CancelMeetingEmail(organizer, meeting, this.sakaiFacade, emailUserSiteGroup.getSiteId()); + } + + if (SEND_EMAIL_ALL_PARTICIPANTS.equals(meeting.getSendEmailToSelectedPeopleOnly())){ + userIds = emailUserSiteGroup.getUserInternalIds(); + sakaiUsers = userDirectoryService.getUsers(userIds); + }else if (SEND_EMAIL_ONLY_ORGANIZER_COORDINATORS.equals(meeting.getSendEmailToSelectedPeopleOnly())){ + if(!isAlreadyEmailedToOrganizerCoordinators){ + //avoid duplicated email + sakaiUsers =getMeetingOwnerAndCoordinators(meeting); + isAlreadyEmailedToOrganizerCoordinators=true; + } + }else if (SEND_EMAIL_ONLY_SIGNED_UP_ATTENDEES.equals(meeting.getSendEmailToSelectedPeopleOnly())){ + List tsList = meeting.getSignupTimeSlots(); + User user = null; + List sgpUsers = emailUserSiteGroup.getSignupUsers(); + sakaiUsers = new ArrayList(); + + /*due to iCal file, we need to handle for canceling meeting case for organizer etc.*/ + //this one may not be needed since SIGNUP_CANCEL_MEETING always should with value:SEND_EMAIL_ALL_PARTICIPANTS + //TODO need to find a way: update related ones iCals if the meeting schedule is modified + if(!isAlreadyEmailedToOrganizerCoordinators && messageType.equals(SIGNUP_CANCEL_MEETING) ){ + sakaiUsers =getMeetingOwnerAndCoordinators(meeting); + isAlreadyEmailedToOrganizerCoordinators=true; + } + + if(tsList !=null){ + for (SignupTimeslot ts : tsList) { + List attList = ts.getAttendees(); + if(attList !=null){ + for (SignupAttendee att : attList) { + /*test to see if attendee is in this site-group*/ + for (SignupUser spgUser : sgpUsers) { + if(att.getAttendeeUserId().equals(spgUser.getInternalUserId())){ + try{ + user = userDirectoryService.getUser(att.getAttendeeUserId()); + } catch (UserNotDefinedException e) { + logger.warn("User is not found for userId: " + att.getAttendeeUserId()); + isException = true; + } + sakaiUsers.add(user); + break; + } + } + + } + } + + } + } + } + } + + if (email != null){ + if(sakaiUsers.size()> 400){ + /*Currently, use this only for heavy case. + * One drawback: the organizer don't know weather the email is really sent away or not. + * There is no error message for user if an unexpected exception happens. + * Will add the email-send-error notification at near future time. + * */ + + //NO ICS FILE IS SENT VIA THIS METHOD YET + EmailDeliverer deliverer = new EmailDeliverer(sakaiUsers, email.getHeader(),email.getMessage(),emailService); + Thread t = new Thread(deliverer); + t.start(); + } + else { + //emailService.sendToUsers(sakaiUsers, email.getHeader(), email.getMessage()); + sendEmail(sakaiUsers, email); + } + } + + } catch (UserNotDefinedException ue) { + isException = true; + logger.warn("User is not found for userId: " + meeting.getCreatorUserId()); + } catch (Exception e) { + isException = true; + logger.error("Exception: " + e.getClass() + ": " + e.getMessage()); + } + } + + if(isException) + throw new Exception("Some emails may not be sent out due to error."); + } + + private void sendEmailToPreAssignedAttendee(EmailUserSiteGroup emailUserSiteGroup, SignupMeeting meeting) + throws Exception { + List sgpUsers = emailUserSiteGroup.getSignupUsers(); + List signupTimeSlots = meeting.getSignupTimeSlots(); + if (signupTimeSlots == null) + return; + + boolean isExcepiotn = false; + User currentUser = userDirectoryService.getCurrentUser(); + for (SignupTimeslot timeslot : signupTimeSlots) { + List attendees = timeslot.getAttendees(); + if (attendees == null) + continue; + + for (SignupAttendee attendee : attendees) { + for (Iterator iter = sgpUsers.iterator(); iter.hasNext();) { + SignupUser spUser = (SignupUser) iter.next(); + if (spUser.getInternalUserId().equals(attendee.getAttendeeUserId())) { + User user; + try { + user = userDirectoryService.getUser(attendee.getAttendeeUserId()); + SignupEmailNotification email = new OrganizerPreAssignEmail(currentUser, meeting, timeslot, + user, this.sakaiFacade, emailUserSiteGroup.getSiteId()); + sendEmail(user, email); + } catch (UserNotDefinedException e) { + logger.warn("User is not found for userId: " + attendee.getAttendeeUserId()); + isExcepiotn = true; + } + /* + * remove it to avoid send new meeting notification + * again + */ + iter.remove(); + break; + } + } + + } + } + + if (isExcepiotn) + throw new Exception("User is not found and email may not be sent out."); + } + + /** + * This will exlude the pre-assigned attendee for a new meeting since they + * will receive a different email + * + * @param sakaiUsers + * a list of User objects. + * @param meeting + * a SignupMeeting Object. + */ + private void excludPreAssignedAttendee(List sakaiUsers, SignupMeeting meeting) { + List signupTimeSlots = meeting.getSignupTimeSlots(); + if (signupTimeSlots == null) + return; + + for (SignupTimeslot timeslot : signupTimeSlots) { + List attendees = timeslot.getAttendees(); + if (attendees == null) + continue; + + User preAssignedUser = null; + for (SignupAttendee attendee : attendees) { + try { + preAssignedUser = userDirectoryService.getUser(attendee.getAttendeeUserId()); + for (Iterator iter = sakaiUsers.iterator(); iter.hasNext();) { + User sakaiUser = (User) iter.next(); + if (sakaiUser.getEid().equals(preAssignedUser.getEid())) { + iter.remove(); + } + } + + } catch (UserNotDefinedException e) { + logger.warn("User is not found for userId: " + attendee.getAttendeeUserId()); + } + + } + } + } + + private class EmailUserSiteGroup { + private String siteId; + + private boolean publishedSite; + + private List signupUsers = new ArrayList(); + + public EmailUserSiteGroup(String siteId, SignupUser user) { + this.siteId = siteId; + this.signupUsers.add(user); + this.publishedSite = user.isPublishedSite(); + } + + public void addSignupUser(SignupUser user) { + this.signupUsers.add(user); + } + + public String getSiteId() { + return siteId; + } + + public void setSiteId(String siteId) { + this.siteId = siteId; + } + + public List getSignupUsers() { + return signupUsers; + } + + public void setSignupUsers(List signupUsers) { + this.signupUsers = signupUsers; + } + + public List getUserInternalIds() { + List userIds = new ArrayList(); + for (SignupUser signupUser : signupUsers) { + userIds.add(signupUser.getInternalUserId()); + } + return userIds; + } + + public boolean isPublishedSite() { + return publishedSite; + } + + public void setPublishedSite(boolean publishedSite) { + this.publishedSite = publishedSite; + } + + } + + /** + * Helper to convert a signup email notification into a Sakai EmailMessage, which can encapsulate attachments. + * + *

Due to the way the email objects are created, ie one per email that needs to be sent, not one per user, we cannot store any + * user specific attachments within the email objects themselves. So this method assembles an EmailMessage per user + * + * @param email - the signup email obj we will extract info from + * @param recipient - list of user to receive the email + * @return + */ + private EmailMessage convertSignupEmail(SignupEmailNotification email, User recipient) { + + EmailMessage message = new EmailMessage(); + + //setup message + message.setHeaders(email.getHeader()); + message.setBody(email.getMessage()); + + // Pass a flag to the EmailService to indicate that we want the MIME multipart subtype set to alternative + // so that an email client can present the message as a meeting invite + message.setHeader("multipart-subtype", "alternative"); + + //note that the headers are largely ignored so we need to repeat some things here that are actually in the headers + //if these are eventaully converted to proper email templates, this should be alleviated + message.setSubject(email.getSubject()); + + logger.debug("email.getFromAddress(): " + email.getFromAddress()); + + message.setFrom(email.getFromAddress()); + message.setContentType("text/html; charset=UTF-8"); + + if(!email.isModifyComment()){ + //skip ICS attachment file for user comment email + for(Attachment a: collectAttachments(email, recipient)){ + message.addAttachment(a); + } + } + + //add recipient, only if valid email + String emailAddress = recipient.getEmail(); + if(StringUtils.isNotBlank(emailAddress) && EmailValidator.getInstance().isValid(emailAddress)) { + message.addRecipient(EmailAddress.RecipientType.TO, recipient.getDisplayName(), emailAddress); + } else { + logger.debug("Invalid email for user: " + recipient.getDisplayId() + ". No email will be sent to this user"); + return null; + } + + return message; + } + + /** + * Helper method to collect all attachments that need to go out for this email and to this user + * @param email signupemailnotification + * @param user the user that will receive this email + * @return list of Attachments + */ + private List collectAttachments(SignupEmailNotification email, User user) { + + List attachments = new ArrayList(); + attachments.addAll(generateICS(email, user)); + //add more here as required + + return attachments; + + } + + /** + * Generate an ICS file for the user and the email message type and return as an attachment. + * + * @param email email obj + * @param user User + * @return + */ + private List generateICS(SignupEmailNotification email, User user) { + + List attachments = new ArrayList(); + + String method = email.isCancellation() ? "CANCEL" : "REQUEST"; + final List events = email.generateEvents(user, calendarHelper); + + if (events.size() > 0) { + attachments.add(formatICSAttachment(events, method)); + } + + /* + * Note that there is no notification if a meeting is removed altogether. + */ + + + return attachments; + } + + + /** + * Helper to generate the calendareventedit objects, turn them into VEvents, then write back into the meeting/timeslot objects + * One is generated for the signupmeeting itself, then one for each timeslot. + * @param meeting SignupMeeting + * @return modifiedSignupmeeting with the VEvents injected + */ + private SignupMeeting generateVEvents(SignupMeeting meeting) { + + //generate VEvent for meeting, add to object + meeting.setVevent(calendarHelper.generateVEventForMeeting(meeting)); + + //now one for each timeslot + for(SignupTimeslot ts: meeting.getSignupTimeSlots()){ + + //generate VEvent for timeslot, add to object + ts.setVevent(calendarHelper.generateVEventForTimeslot(meeting, ts)); + } + + return meeting; + } + + /** + * Helper to create an ICS calendar from a list of vevents, then turn it into an attachment + * @param vevents list of vevents + * @param method the ITIP method for the calendar, e.g. "REQUEST" + * @return + */ + private Attachment formatICSAttachment(List vevents, String method) { + String path = calendarHelper.createCalendarFile(vevents, method); + + // Explicitly define the Content-Type and Content-Diposition headers so the invitation appears inline + String filename = StringUtils.substringAfterLast(path, File.separator); + String type = String.format("text/calendar; charset=\"utf-8\"; method=%s; name=signup-invite.ics", method); + File file = new File(path); + DataSource dataSource = new Attachment.RenamedDataSource(new FileDataSource(file), filename); + return new Attachment(dataSource, type, Attachment.ContentDisposition.INLINE); + } + + +} diff --git a/signup/impl/src/java/org/sakaiproject/signup/logic/SignupMeetingServiceImpl.java b/signup/impl/src/java/org/sakaiproject/signup/logic/SignupMeetingServiceImpl.java index 2b23be32aad9..1ae570cab4d0 100644 --- a/signup/impl/src/java/org/sakaiproject/signup/logic/SignupMeetingServiceImpl.java +++ b/signup/impl/src/java/org/sakaiproject/signup/logic/SignupMeetingServiceImpl.java @@ -1,1147 +1,1147 @@ -/* -* Licensed to The Apereo Foundation under one or more contributor license -* agreements. See the NOTICE file distributed with this work for -* additional information regarding copyright ownership. -* -* The Apereo Foundation licenses this file to you 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: -* -* http://opensource.org/licenses/ecl2.txt -* -* 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.sakaiproject.signup.logic; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.Iterator; -import java.util.List; -import java.util.StringTokenizer; - -import lombok.Getter; -import lombok.Setter; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.sakaiproject.authz.api.SecurityAdvisor; -import org.sakaiproject.calendar.api.Calendar; -import org.sakaiproject.calendar.api.CalendarEventEdit; -import org.sakaiproject.calendaring.api.ExternalCalendaringService; -import org.sakaiproject.exception.IdUnusedException; -import org.sakaiproject.exception.PermissionException; -import org.sakaiproject.signup.dao.SignupMeetingDao; -import org.sakaiproject.signup.logic.messages.SignupEventTrackingInfo; -import org.sakaiproject.signup.model.MeetingTypes; -import org.sakaiproject.signup.model.SignupAttendee; -import org.sakaiproject.signup.model.SignupGroup; -import org.sakaiproject.signup.model.SignupMeeting; -import org.sakaiproject.signup.model.SignupSite; -import org.sakaiproject.signup.model.SignupTimeslot; -import org.sakaiproject.signup.restful.SignupTargetSiteEventInfo; -import org.sakaiproject.signup.util.PlainTextFormat; -import org.sakaiproject.site.api.Group; -import org.sakaiproject.site.api.Site; -import org.sakaiproject.time.api.Time; -import org.sakaiproject.time.api.TimeRange; -import org.sakaiproject.time.api.TimeService; -import org.springframework.dao.OptimisticLockingFailureException; - -/** - *

- * SignupMeetingServiceImpl is an implementation of SignupMeetingService, which - * provides methods to manipulate the SignupMeeting object to the DB, send - * email, post/edit Calendar and check permission. - * - * @author Peter Liu - * - *

- */ -public class SignupMeetingServiceImpl implements SignupMeetingService, Retry, MeetingTypes, SignupMessageTypes { - - private static Log log = LogFactory.getLog(SignupMeetingServiceImpl.class); - - @Getter @Setter - private SignupMeetingDao signupMeetingDao; - - @Getter @Setter - private SakaiFacade sakaiFacade; - - @Getter @Setter - private SignupCacheService signupCacheService; - - @Getter @Setter - private SignupEmailFacade signupEmailFacade; - - public void init() { - log.debug("init"); - } - - /** - * {@inheritDoc} - */ - public List getAllSignupMeetings(String currentSiteId, String userId) { - List meetings = signupMeetingDao.getAllSignupMeetings(currentSiteId); - - return screenAllowableMeetings(currentSiteId, userId, meetings); - - } - - /** - * {@inheritDoc} - */ - public List getSignupMeetings(String currentSiteId, String userId, Date searchEndDate) { - List meetings = signupMeetingDao.getSignupMeetings(currentSiteId, searchEndDate); - return screenAllowableMeetings(currentSiteId, userId, meetings); - } - - /** - * {@inheritDoc} - */ - public List getSignupMeetings(String currentSiteId, String userId, Date startDate, Date endDate) { - List meetings = signupMeetingDao.getSignupMeetings(currentSiteId, startDate, endDate); - return screenAllowableMeetings(currentSiteId, userId, meetings); - } - - /** - * {@inheritDoc} - */ - public List getSignupMeetingsInSiteWithCache(String siteId, Date startDate, int timeFrameInDays) { - List meetings = signupCacheService.getAllSignupMeetingsInSite(siteId, startDate, timeFrameInDays); - return meetings; - } - - /** - * {@inheritDoc} - */ - public List getSignupMeetingsInSitesWithCache(List siteIds, Date startDate, int timeFrameInDays) { - List meetings = signupCacheService.getAllSignupMeetingsInSites(siteIds, startDate, timeFrameInDays); - return meetings; - } - - /** - * {@inheritDoc} - */ - public List getSignupMeetingsInSite(String siteId, Date startDate, Date endDate) { - List meetings = signupMeetingDao.getSignupMeetingsInSite(siteId, startDate, endDate); - return meetings; - } - - /** - * {@inheritDoc} - */ - public List getSignupMeetingsInSites(List siteIds, Date startDate, Date endDate) { - List meetings = signupMeetingDao.getSignupMeetingsInSites(siteIds, startDate, endDate); - return meetings; - } - - /** - * {@inheritDoc} - */ - public List getRecurringSignupMeetings(String currentSiteId, String userId, Long recurrenceId, Date startDate) { - List meetings = signupMeetingDao.getRecurringSignupMeetings(currentSiteId, recurrenceId, startDate); - return screenAllowableMeetings(currentSiteId, userId, meetings); - } - - /** - * This method will return a list of meetings, which contain all the - * populated permission information - * - * @param currentSiteId - * a unique id which represents the current site - * @param userId - * the internal user id (not username) - * @param meetings - * a list of SignupMeeting objects - * @return a list of SignupMeeting object - */ - private List screenAllowableMeetings(String currentSiteId, String userId, - List meetings) { - List allowedMeetings = new ArrayList(); - - for (SignupMeeting meeting : meetings) { - if (isAllowedToView(meeting, userId, currentSiteId)) { - allowedMeetings.add(meeting); - } - } - updatePermissions(userId, currentSiteId, meetings); - - return allowedMeetings; - } - - /** - * This will obtain the permission for attend, update and delete - * - * @param userId - * a unique id which represents the current site - * @param siteId - * a unique id which represents the current site - * @param meetings - * a list of SignupMeeting objects - */ - private void updatePermissions(String userId, String siteId, List meetings) { - for (SignupMeeting meeting : meetings) { - boolean attend = isAllowToAttend(userId, siteId, meeting); - boolean update = isAllowToUpdate(userId, siteId, meeting); - boolean delete = isAllowToDelete(userId, siteId, meeting); - Permission permission = new Permission(attend, update, delete); - meeting.setPermission(permission); - } - - } - - private String assignPermission(String userId, String siteId, SignupMeeting meeting){ - String targetSiteId = siteId; - if(targetSiteId == null){ - targetSiteId = findSiteWithHighestPermissionLevel(userId, meeting); - } - - if(targetSiteId !=null){ - boolean attend = isAllowToAttend(userId, targetSiteId, meeting); - boolean update = isAllowToUpdate(userId, targetSiteId, meeting); - boolean delete = isAllowToDelete(userId, targetSiteId, meeting); - Permission permission = new Permission(attend, update, delete); - meeting.setPermission(permission); - } - - return targetSiteId; - } - - private String findSiteWithHighestPermissionLevel(String userId, SignupMeeting meeting){ - List sites = meeting.getSignupSites(); - - //look if user has update and delete permissions - for (SignupSite site : sites) { - String sId = site.getSiteId(); - boolean update = isAllowToUpdate(userId, sId, meeting); - boolean delete = isAllowToDelete(userId, sId, meeting); - if(update && delete){ - return sId; - } - } - //look if user has update permission - for (SignupSite site : sites) { - String sId = site.getSiteId(); - boolean update = isAllowToUpdate(userId, sId, meeting); - if(update){ - return sId; - } - } - - //look if user has attend permission - for (SignupSite site : sites) { - String sId = site.getSiteId(); - boolean attend = isAllowToAttend(userId, sId, meeting); - if(attend){ - return sId; - } - } - - return null; - } - - /* - * TODO Under what condition the organizer can delete the meeting? Have to - * have all level permission? across site - */ - private boolean isAllowToDelete(String userId, String siteId, SignupMeeting meeting) { - if (sakaiFacade.isUserAdmin(userId)) - return true; - - SignupSite site = currentSite(meeting, siteId); - if (site != null) { - if (site.isSiteScope()) {// GroupList is null or empty case - if (sakaiFacade.isAllowedSite(userId, SakaiFacade.SIGNUP_DELETE_SITE, site.getSiteId())) - return true; - else - return false; - } - - /* It's groups scope */ - if (sakaiFacade.isAllowedSite(userId, SakaiFacade.SIGNUP_DELETE_GROUP_ALL, site.getSiteId()) - || sakaiFacade.isAllowedSite(userId, SakaiFacade.SIGNUP_DELETE_SITE, site.getSiteId())) - return true; - - /* - * organizer has to have permission to delete every group in the - * list,otherwise can't delete - */ - boolean allowedTodelete = true; - List signupGroups = site.getSignupGroups(); - for (SignupGroup group : signupGroups) { - if (!(sakaiFacade.isAllowedGroup(userId, SakaiFacade.SIGNUP_DELETE_GROUP, site.getSiteId(), group.getGroupId()) - || sakaiFacade.isAllowedGroup(userId, SakaiFacade.SIGNUP_DELETE_GROUP_ALL, siteId, group.getGroupId()))) { - allowedTodelete = false; - break; - } - } - return allowedTodelete; - - } - return false; - - } - - /* check to see if the user has update permission at any level */ - private boolean isAllowToUpdate(String userId, String siteId, SignupMeeting meeting) { - if (sakaiFacade.isUserAdmin(userId)) - return true; - - SignupSite site = currentSite(meeting, siteId); - if (site != null) { - if (site.isSiteScope()) { - if (sakaiFacade.isAllowedSite(userId, SakaiFacade.SIGNUP_UPDATE_SITE, site.getSiteId())) - return true; - } - /* Do we allow people with a group.all permission to update the meeting with a site scope? - * currently we allow them to update - * */ - if (sakaiFacade.isAllowedSite(userId, SakaiFacade.SIGNUP_UPDATE_GROUP_ALL, site.getSiteId()) - || sakaiFacade.isAllowedSite(userId, SakaiFacade.SIGNUP_UPDATE_SITE, site.getSiteId())) - return true; - - List signupGroups = site.getSignupGroups(); - for (SignupGroup group : signupGroups) { - if (sakaiFacade.isAllowedGroup(userId, SakaiFacade.SIGNUP_UPDATE_GROUP, site.getSiteId(), group - .getGroupId()) - || sakaiFacade.isAllowedGroup(userId, SakaiFacade.SIGNUP_UPDATE_GROUP_ALL, siteId, group - .getGroupId())) - return true; - } - } - - return false; - - } - - /* check if the current user can attend all items (or is super user) */ - private boolean isAllowToAttend(String userId, String siteId, SignupMeeting meeting) { - if (sakaiFacade.isUserAdmin(userId)) - return true; - - if (sakaiFacade.isAllowedSite(userId, SakaiFacade.SIGNUP_ATTEND_ALL, siteId)) - return true; - - SignupSite site = currentSite(meeting, siteId); - if (site != null) { - if (site.isSiteScope()) - return sakaiFacade.isAllowedSite(userId, SakaiFacade.SIGNUP_ATTEND, siteId); - - List signupGroups = site.getSignupGroups(); - for (SignupGroup group : signupGroups) { - if (sakaiFacade.isAllowedGroup(userId, SakaiFacade.SIGNUP_ATTEND, siteId, group.getGroupId()) - || sakaiFacade - .isAllowedGroup(userId, SakaiFacade.SIGNUP_ATTEND_ALL, siteId, group.getGroupId())) - return true; - } - } - return false; - - } - - /* check if the current user can see all items (or is super user) */ - private boolean isAllowedToView(SignupMeeting meeting, String userId, String siteId) { - if (sakaiFacade.isUserAdmin(userId)) - return true; - - if (sakaiFacade.isAllowedSite(userId, SakaiFacade.SIGNUP_VIEW_ALL, siteId)) - return true; - - SignupSite site = currentSite(meeting, siteId); - if (site != null) { - if (site.isSiteScope()) - return sakaiFacade.isAllowedSite(userId, SakaiFacade.SIGNUP_VIEW, siteId); - - List signupGroups = site.getSignupGroups(); - for (SignupGroup group : signupGroups) { - if (sakaiFacade.isAllowedGroup(userId, SakaiFacade.SIGNUP_VIEW, siteId, group.getGroupId()) - || sakaiFacade.isAllowedGroup(userId, SakaiFacade.SIGNUP_VIEW_ALL, siteId, group.getGroupId())) - return true; - } - } - return false; - - } - - /* get SignupSite object for the site Id */ - private SignupSite currentSite(SignupMeeting meeting, String siteId) { - List signupSites = meeting.getSignupSites(); - for (SignupSite site : signupSites) { - if (site.getSiteId().equals(siteId)) - return site; - } - return null; - } - - /** - * {@inheritDoc} - */ - public Long saveMeeting(SignupMeeting signupMeeting, String userId) throws PermissionException { - if (isAllowedToCreate(userId, signupMeeting)) { - return signupMeetingDao.saveMeeting(signupMeeting); - } - throw new PermissionException(userId, "signup.create", "signup tool"); - } - - /** - * {@inheritDoc} - */ - public void saveMeetings(List signupMeetings, String userId) throws PermissionException { - if (signupMeetings ==null || signupMeetings.isEmpty()) - return; - - if (isAllowedToCreate(userId, signupMeetings.get(0))) { - signupMeetingDao.saveMeetings(signupMeetings); - } - else{ - throw new PermissionException(userId, "signup.create", "signup tool"); - } - } - - /* check to see if the user has create permission at any level */ - private boolean isAllowedToCreate(String userId, SignupMeeting signupMeeting) { - if (sakaiFacade.isUserAdmin(userId)) - return true; - - List signupSites = signupMeeting.getSignupSites(); - for (SignupSite site : signupSites) { - if (site.isSiteScope()) { - if (!sakaiFacade.isAllowedSite(userId, SakaiFacade.SIGNUP_CREATE_SITE, site.getSiteId())) - return false; - else { - continue; - } - } else { - if (sakaiFacade.isAllowedSite(userId, SakaiFacade.SIGNUP_CREATE_SITE, site.getSiteId()) - || sakaiFacade.isAllowedSite(userId, SakaiFacade.SIGNUP_CREATE_GROUP_ALL, site.getSiteId())) - continue; - - List signupGroups = site.getSignupGroups(); - for (SignupGroup group : signupGroups) { - if (!(sakaiFacade.isAllowedGroup(userId, SakaiFacade.SIGNUP_CREATE_GROUP, site.getSiteId(), group.getGroupId()) - || sakaiFacade.isAllowedGroup(userId, SakaiFacade.SIGNUP_CREATE_GROUP_ALL, site.getSiteId(), group.getGroupId()))) - return false; - } - } - } - - return true; - - } - - /** - * {@inheritDoc} - */ - public boolean isAllowedToCreateinGroup(String userId, String siteId, String groupId) { - return sakaiFacade.isAllowedSite(userId, SakaiFacade.SIGNUP_CREATE_GROUP_ALL, siteId) - || sakaiFacade.isAllowedGroup(userId, SakaiFacade.SIGNUP_CREATE_GROUP, siteId, groupId); - } - - /** - * {@inheritDoc} - */ - public boolean isAllowedToCreateinSite(String userId, String siteId) { - return sakaiFacade.isAllowedSite(userId, SakaiFacade.SIGNUP_CREATE_SITE, siteId); - } - - /** - * {@inheritDoc} - */ - public boolean isAllowedToCreateAnyInSite(String userId, String siteId) { - if (sakaiFacade.isUserAdmin(userId)) - return true; - - if (sakaiFacade.isAllowedSite(userId, SakaiFacade.SIGNUP_CREATE_SITE, siteId)) - return true; - - /* check groups */ - Site site = null; - try { - site = sakaiFacade.getSiteService().getSite(siteId); - } catch (IdUnusedException e) { - log.info("IdUnusedException for siteId: siteId -- " + e.getMessage()); - return false; - } - Collection groups = site.getGroups(); - if (groups == null || groups.isEmpty()) - return false; - - for (Iterator iter = groups.iterator(); iter.hasNext();) { - Group gp = (Group) iter.next(); - if (isAllowedToCreateinGroup(userId, siteId, gp.getId())) - return true; - - } - - return false; - } - - /** - * {@inheritDoc} - */ - public void updateSignupMeeting(SignupMeeting meeting, boolean isOrganizer) throws Exception { - Permission permission = meeting.getPermission(); - - /* - * if null, only consider an organizer-updating case (higher requirement - * level) - */ - if (permission == null) { - if (isAllowToUpdate(sakaiFacade.getCurrentUserId(), sakaiFacade.getCurrentLocationId(), meeting)) { - signupMeetingDao.updateMeeting(meeting); - return; - } - throw new PermissionException(sakaiFacade.getCurrentUserId(), "signup.update", "SignupTool"); - } - - if (isOrganizer) { - if (permission.isUpdate()) - signupMeetingDao.updateMeeting(meeting); - else - throw new PermissionException(sakaiFacade.getCurrentUserId(), "signup.update", "SignupTool"); - } else { - if (permission.isAttend()) - signupMeetingDao.updateMeeting(meeting); - else - throw new PermissionException(sakaiFacade.getCurrentUserId(), "signup.attend", "SignupTool"); - } - } - - /** - * {@inheritDoc} - */ - public void updateSignupMeetings(List meetings, boolean isOrganizer) throws Exception { - - if (meetings == null || meetings.isEmpty()) { - return; - } - - SignupMeeting oneMeeting = (SignupMeeting) meetings.get(0); - /* Here, assuming that organizer has the update permission for any one meeting, then he has the permissions for all */ - Permission permission = oneMeeting.getPermission(); - - /* - * if null, only consider an organizer-updating case (higher requirement - * level) - */ - if (permission == null) { - if (isAllowToUpdate(sakaiFacade.getCurrentUserId(), sakaiFacade.getCurrentLocationId(), oneMeeting)) { - signupMeetingDao.updateMeetings(meetings); - return; - } - throw new PermissionException(sakaiFacade.getCurrentUserId(), "signup.update", "SignupTool"); - } - - if (isOrganizer) { - if (permission.isUpdate()) - signupMeetingDao.updateMeetings(meetings); - else - throw new PermissionException(sakaiFacade.getCurrentUserId(), "signup.update", "SignupTool"); - } else { - if (permission.isAttend()) - signupMeetingDao.updateMeetings(meetings); - else - throw new PermissionException(sakaiFacade.getCurrentUserId(), "signup.attend", "SignupTool"); - } - } - - /** - * {@inheritDoc} - */ - public void updateModifiedMeetings(List meetings, List removedTimeslots, - boolean isOrganizer) throws Exception { - - if (meetings == null || meetings.isEmpty()) { - return; - } - - SignupMeeting oneMeeting = (SignupMeeting) meetings.get(0); - /* Here, assuming that organizer has the update permission for any one meeting, then he has the permissions for all */ - Permission permission = oneMeeting.getPermission(); - - /* - * if null, only consider an organizer-updating case (higher requirement - * level) - */ - if (permission == null) { - if (isAllowToUpdate(sakaiFacade.getCurrentUserId(), sakaiFacade.getCurrentLocationId(), oneMeeting)) { - signupMeetingDao.updateModifiedMeetings(meetings, removedTimeslots); - return; - } - throw new PermissionException(sakaiFacade.getCurrentUserId(), "signup.update", "SignupTool"); - } - - if (isOrganizer) { - if (permission.isUpdate()) - signupMeetingDao.updateModifiedMeetings(meetings, removedTimeslots); - else - throw new PermissionException(sakaiFacade.getCurrentUserId(), "signup.update", "SignupTool"); - } else { - if (permission.isAttend()) - signupMeetingDao.updateModifiedMeetings(meetings, removedTimeslots); - else - throw new PermissionException(sakaiFacade.getCurrentUserId(), "signup.attend", "SignupTool"); - } - } - - /** - * {@inheritDoc} - */ - public SignupMeeting loadSignupMeeting(Long meetingId, String userId, String siteId) { - SignupMeeting meeting = signupMeetingDao.loadSignupMeeting(meetingId); - List temp = new ArrayList(); - temp.add(meeting); - updatePermissions(userId, siteId, temp); - return meeting; - } - - /** - * {@inheritDoc} - */ - public SignupTargetSiteEventInfo loadSignupMeetingWithAutoSelectedSite(Long meetingId, String userId, String siteId) { - SignupMeeting meeting = signupMeetingDao.loadSignupMeeting(meetingId); - String sId = assignPermission(userId, siteId, meeting); - SignupTargetSiteEventInfo defaultSiteEvent = new SignupTargetSiteEventInfo(meeting,sId); - return defaultSiteEvent; - } - - /* TODO: attachments if any */ - /** - * {@inheritDoc} - */ - public void postToCalendar(SignupMeeting meeting) throws Exception { - modifyCalendar(meeting); - } - - /** - * {@inheritDoc} - */ - public void modifyCalendar(SignupMeeting meeting) throws Exception { - List signupSites = meeting.getSignupSites(); - boolean saveMeeting = false; - List calendarBlocks = scanDivideCalendarBlocks(meeting); - boolean hasMulptleBlock = calendarBlocks.size() > 1? true : false; - - /*we remove all the calendar events for custom-defined type to simplify process - * when existing meetings come here. New meeting don't have permission setting yet - * and it is null.*/ - if(meeting.getPermission() !=null && meeting.getPermission().isUpdate()){ - //only instructor or maintainer/TF can do this since they can create/delete/move new blocks - if(CUSTOM_TIMESLOTS.equals(meeting.getMeetingType())){ - List smList = new ArrayList(); - smList.add(meeting); - removeCalendarEvents(smList); - } - } - - int sequence = 1; - boolean firstBlockLoop = true; - /*only custom-defined events have multiple discontinued calendar blocks*/ - int calBlock =0; - for (SignupTimeslot calendarBlock : calendarBlocks) { - for (SignupSite site : signupSites) { - try { - Calendar calendar = chooseCalendar(site); - - if (calendar == null)// something went wrong when fetching the calendar - continue; - - String eventId = null; - if (site.isSiteScope()) { - eventId = site.getCalendarEventId(); - } else { - List signupGroups = site.getSignupGroups(); - for (SignupGroup group : signupGroups) { - eventId = group.getCalendarEventId(); - break; - } - } - CalendarEventEdit eventEdit = null; - - if(meeting.getPermission() !=null && !meeting.getPermission().isUpdate() && CUSTOM_TIMESLOTS.equals(meeting.getMeetingType())){ - /*Case: for customed Calendar blocks, we need to break down the eventIds and update one by one. - *only attendee can come here. Instructor/TF will first remove old Calendar blocks and create new ones again for simplicity!!! - */ - eventId = retrieveCustomCalendarEventId(calBlock,eventId); - } - else{ - /*make sure that instructor/TF will create new Calendar blocks since calendars is already removed*/ - if(CUSTOM_TIMESLOTS.equals(meeting.getMeetingType())) - eventId =null; - } - - boolean isNew = true; - /*for custom_ts type, TF/instructor has no modification here eventId is null*/ - if (eventId != null && eventId.trim().length() > 1) { - //allow attendee to update calendar - SecurityAdvisor advisor = sakaiFacade.pushAllowCalendarEdit(calendar); - - try { - eventEdit = calendar.getEditEvent(eventId, - org.sakaiproject.calendar.api.CalendarService.EVENT_MODIFY_CALENDAR); - isNew = false; - if (!calendar.allowEditEvent(eventId)) { - continue; - } - }catch (IdUnusedException e) { - log.debug("IdUnusedException: " + e.getMessage()); - // If the event was removed from the calendar. - eventEdit = calendarEvent(calendar, meeting, site); - } finally { - sakaiFacade.popSecurityAdvisor(advisor); - } - } else { - eventEdit = calendarEvent(calendar, meeting, site); - } - if (eventEdit == null) - continue; - - /* new time frame */ - String title_suffix = ""; - if(hasMulptleBlock){ - title_suffix = " (part " + sequence + ")"; - sequence++; - } - - populateDataForEventEditObject(eventEdit, meeting,title_suffix, calendarBlock.getStartTime(),calendarBlock.getEndTime()); - - calendar.commitEvent(eventEdit); - - if (isNew) { - saveMeeting = true; // Need to save these back - if (site.isSiteScope()) { - if(firstBlockLoop){ - site.setCalendarEventId(eventEdit.getId()); - site.setCalendarId(calendar.getId()); - }else{ - /*only custom-defined event type could come here*/ - String lastEventId = site.getCalendarEventId(); - //appending new one - site.setCalendarEventId(lastEventId + "|" + eventEdit.getId()); - } - } else { - List signupGroups = site.getSignupGroups(); - for (SignupGroup group : signupGroups) { - if(firstBlockLoop){ - group.setCalendarEventId(eventEdit.getId()); - group.setCalendarId(calendar.getId()); - }else{ - String lastEventId = group.getCalendarEventId(); - //appending new one - group.setCalendarEventId(lastEventId + "|" + eventEdit.getId()); - } - - } - } - } - } catch (PermissionException pe) { - log.info("PermissionException for calendar-modification: " + pe.getMessage()); - throw pe; - } - }//end-for - - firstBlockLoop = false; - calBlock++; - }//end-for - if (saveMeeting) { - updateMeetingWithVersionHandling(meeting); - } - - - } - - /** - * Only custom-defined event type has discontinued calendar blocks - * since the user can do anything with the time slots in discontinued way. - * It will make the calendar unreadable. - */ - private void populateDataForEventEditObject(CalendarEventEdit eventEdit, SignupMeeting meeting,String title_suffix, - Date startTime, Date endTime ){ - TimeService timeService = getSakaiFacade().getTimeService(); - Time start = timeService.newTime(startTime.getTime()); - Time end = timeService.newTime(endTime.getTime()); - TimeRange timeRange = timeService.newTimeRange(start, end, true, false); - eventEdit.setRange(timeRange); - - String attendeeNamesMarkup = ""; - int num = 0; - - if(meeting.getSignupTimeSlots().size() > 0) { - // TODO: 'Attendees' needs internationalising - attendeeNamesMarkup += "

Attendees:
"; - } - - boolean displayAttendeeName = false; - for(SignupTimeslot ts : meeting.getSignupTimeSlots()) { - displayAttendeeName = ts.isDisplayAttendees();//just need one of TS, it is not fine-grained yet - //case: custom calender blocks, only print the related info - if((startTime.getTime() <= ts.getStartTime().getTime()) && endTime.getTime() >= ts.getEndTime().getTime()){ - num += ts.getAttendees().size(); - if(ts.isDisplayAttendees() && !ts.getAttendees().isEmpty()){ - //privacy issue - for(SignupAttendee attendee : ts.getAttendees()) { - attendeeNamesMarkup += ("" + sakaiFacade.getUserDisplayName(attendee.getAttendeeUserId()) + "
"); - } - } - } - } - - if(!displayAttendeeName || num < 1){ - attendeeNamesMarkup += (" Currently, " + num + " attendees have been signed up.
"); - } - - String desc = meeting.getDescription() + attendeeNamesMarkup; - eventEdit.setDescription(PlainTextFormat.convertFormattedHtmlTextToPlaintext(desc)); - eventEdit.setLocation(meeting.getLocation()); - // TODO: 'attendees' needs internationalising - eventEdit.setDisplayName(meeting.getTitle() + title_suffix + " (" + num + " attendees)"); - eventEdit.setRange(timeRange); - } - - private String retrieveCustomCalendarEventId(int blockNum, String eventIds){ - /*separate the eventIds token by '|' */ - StringTokenizer token = new StringTokenizer(eventIds,"|"); - int index=0; - while (token.hasMoreTokens()) { - if(blockNum == index++) - return token.nextToken().trim(); - else - token.nextToken(); - } - - return null; - } - - /** - * scan for existing meetings to see whether it has multiple calendar blocks - * @param meeting - * @return - */ - private boolean hasMeetingWithMultipleCalendarBlocks(SignupMeeting meeting){ - if(!CUSTOM_TIMESLOTS.equals(meeting.getMeetingType())){ - return false; - } - boolean hasMultipleBlocks = false; - List sites = meeting.getSignupSites(); - if (sites == null || sites.isEmpty()) - return false; - - for (SignupSite site : sites) { - String eventId = null; - if (site.isSiteScope()) { - eventId = site.getCalendarEventId(); - if(eventId !=null && eventId.contains("|")){ - return true; - } - } else { - List signupGroups = site.getSignupGroups(); - for (SignupGroup group : signupGroups) { - eventId = group.getCalendarEventId(); - if(eventId !=null && eventId.contains("|")){ - return true; - } - } - } - - } - return hasMultipleBlocks; - } - - private List scanDivideCalendarBlocks(SignupMeeting meeting){ - final int timeApart = 2*60*60*1000; // 2 hours - List tsList = new ArrayList(); - if(CUSTOM_TIMESLOTS.equals(meeting.getMeetingType()) && (meeting.isInMultipleCalendarBlocks() || hasMeetingWithMultipleCalendarBlocks(meeting))){ - List tsLs = meeting.getSignupTimeSlots(); - if(tsLs !=null && !tsLs.isEmpty()){ - /*The meetings timeslots are already sorted before coming here*/ - Date startTime= tsLs.get(0).getStartTime(); - int cursor=0; - for (int i = 0; i < tsLs.size()-1; i++) { - long firstBlockEndTime = tsLs.get(cursor).getEndTime().getTime(); - - //to see if next block is within first block - long secondBlockEndTime = tsLs.get(i+1).getEndTime().getTime(); - if(secondBlockEndTime - firstBlockEndTime >= 0){ - cursor = i+1;//advance to next block - } - - long nextBlockStartTime = tsLs.get(i+1).getStartTime().getTime(); - if(nextBlockStartTime - firstBlockEndTime > timeApart){ - SignupTimeslot newTs = new SignupTimeslot(); - newTs.setStartTime(startTime); - newTs.setEndTime(tsLs.get(i).getEndTime()); - tsList.add(newTs); - //reset start time - startTime = tsLs.get(i+1).getStartTime(); - } - - } - - /* add last block*/ - SignupTimeslot newTs = new SignupTimeslot(); - newTs.setStartTime(startTime); - newTs.setEndTime(meeting.getEndTime()); - tsList.add(newTs); - } - } - else{ - /*otherwise there is only one block in calendar*/ - SignupTimeslot newTs = new SignupTimeslot(); - newTs.setStartTime(meeting.getStartTime()); - newTs.setEndTime(meeting.getEndTime()); - tsList.add(newTs); - } - - return tsList; - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - public void removeCalendarEvents(List meetings) throws Exception { - if (meetings == null || meetings.isEmpty()) - return; - - for (SignupMeeting meeting : meetings) { - List sites = meeting.getSignupSites(); - if (sites == null || sites.isEmpty()) - continue; - - for (SignupSite site : sites) { - try { - Calendar calendar = chooseCalendar(site); - - if (calendar == null)// something went wrong when fetching the calendar - continue; - - String eventIds = null; - if (site.isSiteScope()) { - eventIds = site.getCalendarEventId(); - } else { - List signupGroups = site.getSignupGroups(); - for (SignupGroup group : signupGroups) { - eventIds = group.getCalendarEventId(); - break; - } - } - - if (eventIds == null || eventIds.trim().length() < 1) - continue; - - /*separate the eventIds token by '|' */ - StringTokenizer token = new StringTokenizer(eventIds,"|"); - List evtIds = new ArrayList(); - while (token.hasMoreTokens()) { - evtIds.add(token.nextToken().trim()); - } - - for (String evtId : evtIds) { - CalendarEventEdit eventEdit = calendar.getEditEvent(evtId, - org.sakaiproject.calendar.api.CalendarService.EVENT_REMOVE_CALENDAR); - if (eventEdit == null) - continue; - - if (!calendar.allowEditEvent(evtId)) - continue; - - calendar.removeEvent(eventEdit); - } - - } catch (PermissionException e) { - log.info("PermissionException for removal of calendar: " + e.getMessage()); - } - } - } - - } - - // See if additional calendar is deployed and ready to use. - // If not, we use the Sakai calendar tool by default. - private Calendar chooseCalendar(SignupSite site) throws PermissionException { - Calendar calendar = sakaiFacade.getAdditionalCalendar(site.getSiteId()); - if (calendar == null) { - calendar = sakaiFacade.getCalendar(site.getSiteId()); - } - return calendar; - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - public void removeCalendarEventsOnModifiedMeeting(List meetings) throws Exception { - - try{ - removeCalendarEvents(meetings); - - /*remove calendar info in the event object*/ - for (SignupMeeting sm : meetings) { - List sites = sm.getSignupSites(); - if(sites !=null && !sites.isEmpty()){ - for (SignupSite s : sites) { - if(s.getCalendarEventId() !=null){ - s.setCalendarEventId(null); - s.setCalendarId(null); - } - List grps = s.getSignupGroups(); - if(grps !=null && !grps.isEmpty()){ - for (SignupGroup g : grps) { - if(g.getCalendarEventId()!=null){ - g.setCalendarEventId(null); - g.setCalendarId(null); - } - } - } - } - } - - updateMeetingWithVersionHandling(sm); - } - }catch(Exception e){ - log.warn("Exception for removal of calendar and calendar info may not be removed from events objects: " + e.getMessage()); - } - } - - /* - * This method will create a skeleton event/meeting in the Scheduler tool - * in that site. It still needs to be committed. - */ - private CalendarEventEdit calendarEvent(Calendar calendar, SignupMeeting meeting, SignupSite site) - throws IdUnusedException, PermissionException { - CalendarEventEdit addEvent = calendar.addEvent(); - addEvent.setType("Meeting"); - if (!site.isSiteScope()) { - List groups = groupIds(site); - addEvent.setGroupAccess(groups, true); - } - - return addEvent; - } - - /* - * Main purpose is to update the calendarId and eventId into the related - * meeting site/groups - */ - private void updateMeetingWithVersionHandling(SignupMeeting meeting) throws Exception { - for (int i = 0; i < MAX_NUMBER_OF_RETRY; i++) { - try { - updateSignupMeeting(meeting, true); - return; - } catch (OptimisticLockingFailureException e) { - // nothing - } - } - throw new SignupUserActionException("Some one updated the meeting before your update. Please try again."); - } - - /** - * This will return a list of Group objects from the site - * - * @param site - * a unique id which represents the current site - * @return a list of Group objects from the site - */ - private List groupIds(SignupSite site) { - List groups = new ArrayList(); - List signupGroups = site.getSignupGroups(); - for (SignupGroup group : signupGroups) { - try { - groups.add(sakaiFacade.getGroup(site.getSiteId(), group.getGroupId())); - } catch (IdUnusedException e) { - log.info("IdUnusedException: " + e.getMessage()); - } - } - return groups; - } - - - /** - * {@inheritDoc} - */ - public void sendEmail(SignupMeeting signupMeeting, String messageType) throws Exception { - signupEmailFacade.sendEmailAllUsers(signupMeeting, messageType); - - } - - /** - * {@inheritDoc} - */ - public void sendEmailToOrganizer(SignupEventTrackingInfo signupEventTrackingInfo) throws Exception { - signupEmailFacade.sendEmailToOrganizer(signupEventTrackingInfo); - } - - /** - * {@inheritDoc} - */ - public void sendCancellationEmail(SignupEventTrackingInfo signupEventTrackingInfo) throws Exception { - signupEmailFacade.sendCancellationEmail(signupEventTrackingInfo); - } - - /** - * {@inheritDoc} - */ - public void sendUpdateCommentEmail(SignupEventTrackingInfo signupEventTrackingInfo) throws Exception { - signupEmailFacade.sendUpdateCommentEmail(signupEventTrackingInfo); - } - - /** - * {@inheritDoc} - */ - public void removeMeetings(List meetings) throws Exception { - signupMeetingDao.removeMeetings(meetings); - - for(SignupMeeting m: meetings) { - if(!m.isMeetingExpired()) { - log.info("Meeting is still available, email notifications will be sent"); - //SIGNUP-188 :If an event is cancelled, all the site members get an email - m.setSendEmailToSelectedPeopleOnly(SEND_EMAIL_ONLY_SIGNED_UP_ATTENDEES); - signupEmailFacade.sendEmailAllUsers(m, SignupMessageTypes.SIGNUP_CANCEL_MEETING); - } - } - } - - /** - * {@inheritDoc} - */ - public void sendEmailToParticipantsByOrganizerAction(SignupEventTrackingInfo signupEventTrackingInfo) - throws Exception { - signupEmailFacade.sendEmailToParticipantsByOrganizerAction(signupEventTrackingInfo); - - } - - /** - * {@inheritDoc} - */ - public boolean isEventExisted(Long eventId) { - return signupMeetingDao.isEventExisted(eventId); - } - - /** - * {@inheritDoc} - */ - public void sendEmailToAttendee(SignupEventTrackingInfo signupEventTrackingInfo) throws Exception { - signupEmailFacade.sendEmailToAttendee(signupEventTrackingInfo); - } - - @Override - public List getAllLocations(String siteId) throws Exception { - return signupMeetingDao.getAllLocations(siteId); - } - - @Override - public List getAllCategories(String siteId) throws Exception { - return signupMeetingDao.getAllCategories(siteId); - } - - - - -} +/* +* Licensed to The Apereo Foundation under one or more contributor license +* agreements. See the NOTICE file distributed with this work for +* additional information regarding copyright ownership. +* +* The Apereo Foundation licenses this file to you 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: +* +* http://opensource.org/licenses/ecl2.txt +* +* 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.sakaiproject.signup.logic; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.Iterator; +import java.util.List; +import java.util.StringTokenizer; + +import lombok.Getter; +import lombok.Setter; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sakaiproject.authz.api.SecurityAdvisor; +import org.sakaiproject.calendar.api.Calendar; +import org.sakaiproject.calendar.api.CalendarEventEdit; +import org.sakaiproject.calendaring.api.ExternalCalendaringService; +import org.sakaiproject.exception.IdUnusedException; +import org.sakaiproject.exception.PermissionException; +import org.sakaiproject.signup.dao.SignupMeetingDao; +import org.sakaiproject.signup.logic.messages.SignupEventTrackingInfo; +import org.sakaiproject.signup.model.MeetingTypes; +import org.sakaiproject.signup.model.SignupAttendee; +import org.sakaiproject.signup.model.SignupGroup; +import org.sakaiproject.signup.model.SignupMeeting; +import org.sakaiproject.signup.model.SignupSite; +import org.sakaiproject.signup.model.SignupTimeslot; +import org.sakaiproject.signup.restful.SignupTargetSiteEventInfo; +import org.sakaiproject.signup.util.PlainTextFormat; +import org.sakaiproject.site.api.Group; +import org.sakaiproject.site.api.Site; +import org.sakaiproject.time.api.Time; +import org.sakaiproject.time.api.TimeRange; +import org.sakaiproject.time.api.TimeService; +import org.springframework.dao.OptimisticLockingFailureException; + +/** + *

+ * SignupMeetingServiceImpl is an implementation of SignupMeetingService, which + * provides methods to manipulate the SignupMeeting object to the DB, send + * email, post/edit Calendar and check permission. + * + * @author Peter Liu + * + *

+ */ +public class SignupMeetingServiceImpl implements SignupMeetingService, Retry, MeetingTypes, SignupMessageTypes { + + private static Logger log = LoggerFactory.getLogger(SignupMeetingServiceImpl.class); + + @Getter @Setter + private SignupMeetingDao signupMeetingDao; + + @Getter @Setter + private SakaiFacade sakaiFacade; + + @Getter @Setter + private SignupCacheService signupCacheService; + + @Getter @Setter + private SignupEmailFacade signupEmailFacade; + + public void init() { + log.debug("init"); + } + + /** + * {@inheritDoc} + */ + public List getAllSignupMeetings(String currentSiteId, String userId) { + List meetings = signupMeetingDao.getAllSignupMeetings(currentSiteId); + + return screenAllowableMeetings(currentSiteId, userId, meetings); + + } + + /** + * {@inheritDoc} + */ + public List getSignupMeetings(String currentSiteId, String userId, Date searchEndDate) { + List meetings = signupMeetingDao.getSignupMeetings(currentSiteId, searchEndDate); + return screenAllowableMeetings(currentSiteId, userId, meetings); + } + + /** + * {@inheritDoc} + */ + public List getSignupMeetings(String currentSiteId, String userId, Date startDate, Date endDate) { + List meetings = signupMeetingDao.getSignupMeetings(currentSiteId, startDate, endDate); + return screenAllowableMeetings(currentSiteId, userId, meetings); + } + + /** + * {@inheritDoc} + */ + public List getSignupMeetingsInSiteWithCache(String siteId, Date startDate, int timeFrameInDays) { + List meetings = signupCacheService.getAllSignupMeetingsInSite(siteId, startDate, timeFrameInDays); + return meetings; + } + + /** + * {@inheritDoc} + */ + public List getSignupMeetingsInSitesWithCache(List siteIds, Date startDate, int timeFrameInDays) { + List meetings = signupCacheService.getAllSignupMeetingsInSites(siteIds, startDate, timeFrameInDays); + return meetings; + } + + /** + * {@inheritDoc} + */ + public List getSignupMeetingsInSite(String siteId, Date startDate, Date endDate) { + List meetings = signupMeetingDao.getSignupMeetingsInSite(siteId, startDate, endDate); + return meetings; + } + + /** + * {@inheritDoc} + */ + public List getSignupMeetingsInSites(List siteIds, Date startDate, Date endDate) { + List meetings = signupMeetingDao.getSignupMeetingsInSites(siteIds, startDate, endDate); + return meetings; + } + + /** + * {@inheritDoc} + */ + public List getRecurringSignupMeetings(String currentSiteId, String userId, Long recurrenceId, Date startDate) { + List meetings = signupMeetingDao.getRecurringSignupMeetings(currentSiteId, recurrenceId, startDate); + return screenAllowableMeetings(currentSiteId, userId, meetings); + } + + /** + * This method will return a list of meetings, which contain all the + * populated permission information + * + * @param currentSiteId + * a unique id which represents the current site + * @param userId + * the internal user id (not username) + * @param meetings + * a list of SignupMeeting objects + * @return a list of SignupMeeting object + */ + private List screenAllowableMeetings(String currentSiteId, String userId, + List meetings) { + List allowedMeetings = new ArrayList(); + + for (SignupMeeting meeting : meetings) { + if (isAllowedToView(meeting, userId, currentSiteId)) { + allowedMeetings.add(meeting); + } + } + updatePermissions(userId, currentSiteId, meetings); + + return allowedMeetings; + } + + /** + * This will obtain the permission for attend, update and delete + * + * @param userId + * a unique id which represents the current site + * @param siteId + * a unique id which represents the current site + * @param meetings + * a list of SignupMeeting objects + */ + private void updatePermissions(String userId, String siteId, List meetings) { + for (SignupMeeting meeting : meetings) { + boolean attend = isAllowToAttend(userId, siteId, meeting); + boolean update = isAllowToUpdate(userId, siteId, meeting); + boolean delete = isAllowToDelete(userId, siteId, meeting); + Permission permission = new Permission(attend, update, delete); + meeting.setPermission(permission); + } + + } + + private String assignPermission(String userId, String siteId, SignupMeeting meeting){ + String targetSiteId = siteId; + if(targetSiteId == null){ + targetSiteId = findSiteWithHighestPermissionLevel(userId, meeting); + } + + if(targetSiteId !=null){ + boolean attend = isAllowToAttend(userId, targetSiteId, meeting); + boolean update = isAllowToUpdate(userId, targetSiteId, meeting); + boolean delete = isAllowToDelete(userId, targetSiteId, meeting); + Permission permission = new Permission(attend, update, delete); + meeting.setPermission(permission); + } + + return targetSiteId; + } + + private String findSiteWithHighestPermissionLevel(String userId, SignupMeeting meeting){ + List sites = meeting.getSignupSites(); + + //look if user has update and delete permissions + for (SignupSite site : sites) { + String sId = site.getSiteId(); + boolean update = isAllowToUpdate(userId, sId, meeting); + boolean delete = isAllowToDelete(userId, sId, meeting); + if(update && delete){ + return sId; + } + } + //look if user has update permission + for (SignupSite site : sites) { + String sId = site.getSiteId(); + boolean update = isAllowToUpdate(userId, sId, meeting); + if(update){ + return sId; + } + } + + //look if user has attend permission + for (SignupSite site : sites) { + String sId = site.getSiteId(); + boolean attend = isAllowToAttend(userId, sId, meeting); + if(attend){ + return sId; + } + } + + return null; + } + + /* + * TODO Under what condition the organizer can delete the meeting? Have to + * have all level permission? across site + */ + private boolean isAllowToDelete(String userId, String siteId, SignupMeeting meeting) { + if (sakaiFacade.isUserAdmin(userId)) + return true; + + SignupSite site = currentSite(meeting, siteId); + if (site != null) { + if (site.isSiteScope()) {// GroupList is null or empty case + if (sakaiFacade.isAllowedSite(userId, SakaiFacade.SIGNUP_DELETE_SITE, site.getSiteId())) + return true; + else + return false; + } + + /* It's groups scope */ + if (sakaiFacade.isAllowedSite(userId, SakaiFacade.SIGNUP_DELETE_GROUP_ALL, site.getSiteId()) + || sakaiFacade.isAllowedSite(userId, SakaiFacade.SIGNUP_DELETE_SITE, site.getSiteId())) + return true; + + /* + * organizer has to have permission to delete every group in the + * list,otherwise can't delete + */ + boolean allowedTodelete = true; + List signupGroups = site.getSignupGroups(); + for (SignupGroup group : signupGroups) { + if (!(sakaiFacade.isAllowedGroup(userId, SakaiFacade.SIGNUP_DELETE_GROUP, site.getSiteId(), group.getGroupId()) + || sakaiFacade.isAllowedGroup(userId, SakaiFacade.SIGNUP_DELETE_GROUP_ALL, siteId, group.getGroupId()))) { + allowedTodelete = false; + break; + } + } + return allowedTodelete; + + } + return false; + + } + + /* check to see if the user has update permission at any level */ + private boolean isAllowToUpdate(String userId, String siteId, SignupMeeting meeting) { + if (sakaiFacade.isUserAdmin(userId)) + return true; + + SignupSite site = currentSite(meeting, siteId); + if (site != null) { + if (site.isSiteScope()) { + if (sakaiFacade.isAllowedSite(userId, SakaiFacade.SIGNUP_UPDATE_SITE, site.getSiteId())) + return true; + } + /* Do we allow people with a group.all permission to update the meeting with a site scope? + * currently we allow them to update + * */ + if (sakaiFacade.isAllowedSite(userId, SakaiFacade.SIGNUP_UPDATE_GROUP_ALL, site.getSiteId()) + || sakaiFacade.isAllowedSite(userId, SakaiFacade.SIGNUP_UPDATE_SITE, site.getSiteId())) + return true; + + List signupGroups = site.getSignupGroups(); + for (SignupGroup group : signupGroups) { + if (sakaiFacade.isAllowedGroup(userId, SakaiFacade.SIGNUP_UPDATE_GROUP, site.getSiteId(), group + .getGroupId()) + || sakaiFacade.isAllowedGroup(userId, SakaiFacade.SIGNUP_UPDATE_GROUP_ALL, siteId, group + .getGroupId())) + return true; + } + } + + return false; + + } + + /* check if the current user can attend all items (or is super user) */ + private boolean isAllowToAttend(String userId, String siteId, SignupMeeting meeting) { + if (sakaiFacade.isUserAdmin(userId)) + return true; + + if (sakaiFacade.isAllowedSite(userId, SakaiFacade.SIGNUP_ATTEND_ALL, siteId)) + return true; + + SignupSite site = currentSite(meeting, siteId); + if (site != null) { + if (site.isSiteScope()) + return sakaiFacade.isAllowedSite(userId, SakaiFacade.SIGNUP_ATTEND, siteId); + + List signupGroups = site.getSignupGroups(); + for (SignupGroup group : signupGroups) { + if (sakaiFacade.isAllowedGroup(userId, SakaiFacade.SIGNUP_ATTEND, siteId, group.getGroupId()) + || sakaiFacade + .isAllowedGroup(userId, SakaiFacade.SIGNUP_ATTEND_ALL, siteId, group.getGroupId())) + return true; + } + } + return false; + + } + + /* check if the current user can see all items (or is super user) */ + private boolean isAllowedToView(SignupMeeting meeting, String userId, String siteId) { + if (sakaiFacade.isUserAdmin(userId)) + return true; + + if (sakaiFacade.isAllowedSite(userId, SakaiFacade.SIGNUP_VIEW_ALL, siteId)) + return true; + + SignupSite site = currentSite(meeting, siteId); + if (site != null) { + if (site.isSiteScope()) + return sakaiFacade.isAllowedSite(userId, SakaiFacade.SIGNUP_VIEW, siteId); + + List signupGroups = site.getSignupGroups(); + for (SignupGroup group : signupGroups) { + if (sakaiFacade.isAllowedGroup(userId, SakaiFacade.SIGNUP_VIEW, siteId, group.getGroupId()) + || sakaiFacade.isAllowedGroup(userId, SakaiFacade.SIGNUP_VIEW_ALL, siteId, group.getGroupId())) + return true; + } + } + return false; + + } + + /* get SignupSite object for the site Id */ + private SignupSite currentSite(SignupMeeting meeting, String siteId) { + List signupSites = meeting.getSignupSites(); + for (SignupSite site : signupSites) { + if (site.getSiteId().equals(siteId)) + return site; + } + return null; + } + + /** + * {@inheritDoc} + */ + public Long saveMeeting(SignupMeeting signupMeeting, String userId) throws PermissionException { + if (isAllowedToCreate(userId, signupMeeting)) { + return signupMeetingDao.saveMeeting(signupMeeting); + } + throw new PermissionException(userId, "signup.create", "signup tool"); + } + + /** + * {@inheritDoc} + */ + public void saveMeetings(List signupMeetings, String userId) throws PermissionException { + if (signupMeetings ==null || signupMeetings.isEmpty()) + return; + + if (isAllowedToCreate(userId, signupMeetings.get(0))) { + signupMeetingDao.saveMeetings(signupMeetings); + } + else{ + throw new PermissionException(userId, "signup.create", "signup tool"); + } + } + + /* check to see if the user has create permission at any level */ + private boolean isAllowedToCreate(String userId, SignupMeeting signupMeeting) { + if (sakaiFacade.isUserAdmin(userId)) + return true; + + List signupSites = signupMeeting.getSignupSites(); + for (SignupSite site : signupSites) { + if (site.isSiteScope()) { + if (!sakaiFacade.isAllowedSite(userId, SakaiFacade.SIGNUP_CREATE_SITE, site.getSiteId())) + return false; + else { + continue; + } + } else { + if (sakaiFacade.isAllowedSite(userId, SakaiFacade.SIGNUP_CREATE_SITE, site.getSiteId()) + || sakaiFacade.isAllowedSite(userId, SakaiFacade.SIGNUP_CREATE_GROUP_ALL, site.getSiteId())) + continue; + + List signupGroups = site.getSignupGroups(); + for (SignupGroup group : signupGroups) { + if (!(sakaiFacade.isAllowedGroup(userId, SakaiFacade.SIGNUP_CREATE_GROUP, site.getSiteId(), group.getGroupId()) + || sakaiFacade.isAllowedGroup(userId, SakaiFacade.SIGNUP_CREATE_GROUP_ALL, site.getSiteId(), group.getGroupId()))) + return false; + } + } + } + + return true; + + } + + /** + * {@inheritDoc} + */ + public boolean isAllowedToCreateinGroup(String userId, String siteId, String groupId) { + return sakaiFacade.isAllowedSite(userId, SakaiFacade.SIGNUP_CREATE_GROUP_ALL, siteId) + || sakaiFacade.isAllowedGroup(userId, SakaiFacade.SIGNUP_CREATE_GROUP, siteId, groupId); + } + + /** + * {@inheritDoc} + */ + public boolean isAllowedToCreateinSite(String userId, String siteId) { + return sakaiFacade.isAllowedSite(userId, SakaiFacade.SIGNUP_CREATE_SITE, siteId); + } + + /** + * {@inheritDoc} + */ + public boolean isAllowedToCreateAnyInSite(String userId, String siteId) { + if (sakaiFacade.isUserAdmin(userId)) + return true; + + if (sakaiFacade.isAllowedSite(userId, SakaiFacade.SIGNUP_CREATE_SITE, siteId)) + return true; + + /* check groups */ + Site site = null; + try { + site = sakaiFacade.getSiteService().getSite(siteId); + } catch (IdUnusedException e) { + log.info("IdUnusedException for siteId: siteId -- " + e.getMessage()); + return false; + } + Collection groups = site.getGroups(); + if (groups == null || groups.isEmpty()) + return false; + + for (Iterator iter = groups.iterator(); iter.hasNext();) { + Group gp = (Group) iter.next(); + if (isAllowedToCreateinGroup(userId, siteId, gp.getId())) + return true; + + } + + return false; + } + + /** + * {@inheritDoc} + */ + public void updateSignupMeeting(SignupMeeting meeting, boolean isOrganizer) throws Exception { + Permission permission = meeting.getPermission(); + + /* + * if null, only consider an organizer-updating case (higher requirement + * level) + */ + if (permission == null) { + if (isAllowToUpdate(sakaiFacade.getCurrentUserId(), sakaiFacade.getCurrentLocationId(), meeting)) { + signupMeetingDao.updateMeeting(meeting); + return; + } + throw new PermissionException(sakaiFacade.getCurrentUserId(), "signup.update", "SignupTool"); + } + + if (isOrganizer) { + if (permission.isUpdate()) + signupMeetingDao.updateMeeting(meeting); + else + throw new PermissionException(sakaiFacade.getCurrentUserId(), "signup.update", "SignupTool"); + } else { + if (permission.isAttend()) + signupMeetingDao.updateMeeting(meeting); + else + throw new PermissionException(sakaiFacade.getCurrentUserId(), "signup.attend", "SignupTool"); + } + } + + /** + * {@inheritDoc} + */ + public void updateSignupMeetings(List meetings, boolean isOrganizer) throws Exception { + + if (meetings == null || meetings.isEmpty()) { + return; + } + + SignupMeeting oneMeeting = (SignupMeeting) meetings.get(0); + /* Here, assuming that organizer has the update permission for any one meeting, then he has the permissions for all */ + Permission permission = oneMeeting.getPermission(); + + /* + * if null, only consider an organizer-updating case (higher requirement + * level) + */ + if (permission == null) { + if (isAllowToUpdate(sakaiFacade.getCurrentUserId(), sakaiFacade.getCurrentLocationId(), oneMeeting)) { + signupMeetingDao.updateMeetings(meetings); + return; + } + throw new PermissionException(sakaiFacade.getCurrentUserId(), "signup.update", "SignupTool"); + } + + if (isOrganizer) { + if (permission.isUpdate()) + signupMeetingDao.updateMeetings(meetings); + else + throw new PermissionException(sakaiFacade.getCurrentUserId(), "signup.update", "SignupTool"); + } else { + if (permission.isAttend()) + signupMeetingDao.updateMeetings(meetings); + else + throw new PermissionException(sakaiFacade.getCurrentUserId(), "signup.attend", "SignupTool"); + } + } + + /** + * {@inheritDoc} + */ + public void updateModifiedMeetings(List meetings, List removedTimeslots, + boolean isOrganizer) throws Exception { + + if (meetings == null || meetings.isEmpty()) { + return; + } + + SignupMeeting oneMeeting = (SignupMeeting) meetings.get(0); + /* Here, assuming that organizer has the update permission for any one meeting, then he has the permissions for all */ + Permission permission = oneMeeting.getPermission(); + + /* + * if null, only consider an organizer-updating case (higher requirement + * level) + */ + if (permission == null) { + if (isAllowToUpdate(sakaiFacade.getCurrentUserId(), sakaiFacade.getCurrentLocationId(), oneMeeting)) { + signupMeetingDao.updateModifiedMeetings(meetings, removedTimeslots); + return; + } + throw new PermissionException(sakaiFacade.getCurrentUserId(), "signup.update", "SignupTool"); + } + + if (isOrganizer) { + if (permission.isUpdate()) + signupMeetingDao.updateModifiedMeetings(meetings, removedTimeslots); + else + throw new PermissionException(sakaiFacade.getCurrentUserId(), "signup.update", "SignupTool"); + } else { + if (permission.isAttend()) + signupMeetingDao.updateModifiedMeetings(meetings, removedTimeslots); + else + throw new PermissionException(sakaiFacade.getCurrentUserId(), "signup.attend", "SignupTool"); + } + } + + /** + * {@inheritDoc} + */ + public SignupMeeting loadSignupMeeting(Long meetingId, String userId, String siteId) { + SignupMeeting meeting = signupMeetingDao.loadSignupMeeting(meetingId); + List temp = new ArrayList(); + temp.add(meeting); + updatePermissions(userId, siteId, temp); + return meeting; + } + + /** + * {@inheritDoc} + */ + public SignupTargetSiteEventInfo loadSignupMeetingWithAutoSelectedSite(Long meetingId, String userId, String siteId) { + SignupMeeting meeting = signupMeetingDao.loadSignupMeeting(meetingId); + String sId = assignPermission(userId, siteId, meeting); + SignupTargetSiteEventInfo defaultSiteEvent = new SignupTargetSiteEventInfo(meeting,sId); + return defaultSiteEvent; + } + + /* TODO: attachments if any */ + /** + * {@inheritDoc} + */ + public void postToCalendar(SignupMeeting meeting) throws Exception { + modifyCalendar(meeting); + } + + /** + * {@inheritDoc} + */ + public void modifyCalendar(SignupMeeting meeting) throws Exception { + List signupSites = meeting.getSignupSites(); + boolean saveMeeting = false; + List calendarBlocks = scanDivideCalendarBlocks(meeting); + boolean hasMulptleBlock = calendarBlocks.size() > 1? true : false; + + /*we remove all the calendar events for custom-defined type to simplify process + * when existing meetings come here. New meeting don't have permission setting yet + * and it is null.*/ + if(meeting.getPermission() !=null && meeting.getPermission().isUpdate()){ + //only instructor or maintainer/TF can do this since they can create/delete/move new blocks + if(CUSTOM_TIMESLOTS.equals(meeting.getMeetingType())){ + List smList = new ArrayList(); + smList.add(meeting); + removeCalendarEvents(smList); + } + } + + int sequence = 1; + boolean firstBlockLoop = true; + /*only custom-defined events have multiple discontinued calendar blocks*/ + int calBlock =0; + for (SignupTimeslot calendarBlock : calendarBlocks) { + for (SignupSite site : signupSites) { + try { + Calendar calendar = chooseCalendar(site); + + if (calendar == null)// something went wrong when fetching the calendar + continue; + + String eventId = null; + if (site.isSiteScope()) { + eventId = site.getCalendarEventId(); + } else { + List signupGroups = site.getSignupGroups(); + for (SignupGroup group : signupGroups) { + eventId = group.getCalendarEventId(); + break; + } + } + CalendarEventEdit eventEdit = null; + + if(meeting.getPermission() !=null && !meeting.getPermission().isUpdate() && CUSTOM_TIMESLOTS.equals(meeting.getMeetingType())){ + /*Case: for customed Calendar blocks, we need to break down the eventIds and update one by one. + *only attendee can come here. Instructor/TF will first remove old Calendar blocks and create new ones again for simplicity!!! + */ + eventId = retrieveCustomCalendarEventId(calBlock,eventId); + } + else{ + /*make sure that instructor/TF will create new Calendar blocks since calendars is already removed*/ + if(CUSTOM_TIMESLOTS.equals(meeting.getMeetingType())) + eventId =null; + } + + boolean isNew = true; + /*for custom_ts type, TF/instructor has no modification here eventId is null*/ + if (eventId != null && eventId.trim().length() > 1) { + //allow attendee to update calendar + SecurityAdvisor advisor = sakaiFacade.pushAllowCalendarEdit(calendar); + + try { + eventEdit = calendar.getEditEvent(eventId, + org.sakaiproject.calendar.api.CalendarService.EVENT_MODIFY_CALENDAR); + isNew = false; + if (!calendar.allowEditEvent(eventId)) { + continue; + } + }catch (IdUnusedException e) { + log.debug("IdUnusedException: " + e.getMessage()); + // If the event was removed from the calendar. + eventEdit = calendarEvent(calendar, meeting, site); + } finally { + sakaiFacade.popSecurityAdvisor(advisor); + } + } else { + eventEdit = calendarEvent(calendar, meeting, site); + } + if (eventEdit == null) + continue; + + /* new time frame */ + String title_suffix = ""; + if(hasMulptleBlock){ + title_suffix = " (part " + sequence + ")"; + sequence++; + } + + populateDataForEventEditObject(eventEdit, meeting,title_suffix, calendarBlock.getStartTime(),calendarBlock.getEndTime()); + + calendar.commitEvent(eventEdit); + + if (isNew) { + saveMeeting = true; // Need to save these back + if (site.isSiteScope()) { + if(firstBlockLoop){ + site.setCalendarEventId(eventEdit.getId()); + site.setCalendarId(calendar.getId()); + }else{ + /*only custom-defined event type could come here*/ + String lastEventId = site.getCalendarEventId(); + //appending new one + site.setCalendarEventId(lastEventId + "|" + eventEdit.getId()); + } + } else { + List signupGroups = site.getSignupGroups(); + for (SignupGroup group : signupGroups) { + if(firstBlockLoop){ + group.setCalendarEventId(eventEdit.getId()); + group.setCalendarId(calendar.getId()); + }else{ + String lastEventId = group.getCalendarEventId(); + //appending new one + group.setCalendarEventId(lastEventId + "|" + eventEdit.getId()); + } + + } + } + } + } catch (PermissionException pe) { + log.info("PermissionException for calendar-modification: " + pe.getMessage()); + throw pe; + } + }//end-for + + firstBlockLoop = false; + calBlock++; + }//end-for + if (saveMeeting) { + updateMeetingWithVersionHandling(meeting); + } + + + } + + /** + * Only custom-defined event type has discontinued calendar blocks + * since the user can do anything with the time slots in discontinued way. + * It will make the calendar unreadable. + */ + private void populateDataForEventEditObject(CalendarEventEdit eventEdit, SignupMeeting meeting,String title_suffix, + Date startTime, Date endTime ){ + TimeService timeService = getSakaiFacade().getTimeService(); + Time start = timeService.newTime(startTime.getTime()); + Time end = timeService.newTime(endTime.getTime()); + TimeRange timeRange = timeService.newTimeRange(start, end, true, false); + eventEdit.setRange(timeRange); + + String attendeeNamesMarkup = ""; + int num = 0; + + if(meeting.getSignupTimeSlots().size() > 0) { + // TODO: 'Attendees' needs internationalising + attendeeNamesMarkup += "

Attendees:
"; + } + + boolean displayAttendeeName = false; + for(SignupTimeslot ts : meeting.getSignupTimeSlots()) { + displayAttendeeName = ts.isDisplayAttendees();//just need one of TS, it is not fine-grained yet + //case: custom calender blocks, only print the related info + if((startTime.getTime() <= ts.getStartTime().getTime()) && endTime.getTime() >= ts.getEndTime().getTime()){ + num += ts.getAttendees().size(); + if(ts.isDisplayAttendees() && !ts.getAttendees().isEmpty()){ + //privacy issue + for(SignupAttendee attendee : ts.getAttendees()) { + attendeeNamesMarkup += ("" + sakaiFacade.getUserDisplayName(attendee.getAttendeeUserId()) + "
"); + } + } + } + } + + if(!displayAttendeeName || num < 1){ + attendeeNamesMarkup += (" Currently, " + num + " attendees have been signed up.
"); + } + + String desc = meeting.getDescription() + attendeeNamesMarkup; + eventEdit.setDescription(PlainTextFormat.convertFormattedHtmlTextToPlaintext(desc)); + eventEdit.setLocation(meeting.getLocation()); + // TODO: 'attendees' needs internationalising + eventEdit.setDisplayName(meeting.getTitle() + title_suffix + " (" + num + " attendees)"); + eventEdit.setRange(timeRange); + } + + private String retrieveCustomCalendarEventId(int blockNum, String eventIds){ + /*separate the eventIds token by '|' */ + StringTokenizer token = new StringTokenizer(eventIds,"|"); + int index=0; + while (token.hasMoreTokens()) { + if(blockNum == index++) + return token.nextToken().trim(); + else + token.nextToken(); + } + + return null; + } + + /** + * scan for existing meetings to see whether it has multiple calendar blocks + * @param meeting + * @return + */ + private boolean hasMeetingWithMultipleCalendarBlocks(SignupMeeting meeting){ + if(!CUSTOM_TIMESLOTS.equals(meeting.getMeetingType())){ + return false; + } + boolean hasMultipleBlocks = false; + List sites = meeting.getSignupSites(); + if (sites == null || sites.isEmpty()) + return false; + + for (SignupSite site : sites) { + String eventId = null; + if (site.isSiteScope()) { + eventId = site.getCalendarEventId(); + if(eventId !=null && eventId.contains("|")){ + return true; + } + } else { + List signupGroups = site.getSignupGroups(); + for (SignupGroup group : signupGroups) { + eventId = group.getCalendarEventId(); + if(eventId !=null && eventId.contains("|")){ + return true; + } + } + } + + } + return hasMultipleBlocks; + } + + private List scanDivideCalendarBlocks(SignupMeeting meeting){ + final int timeApart = 2*60*60*1000; // 2 hours + List tsList = new ArrayList(); + if(CUSTOM_TIMESLOTS.equals(meeting.getMeetingType()) && (meeting.isInMultipleCalendarBlocks() || hasMeetingWithMultipleCalendarBlocks(meeting))){ + List tsLs = meeting.getSignupTimeSlots(); + if(tsLs !=null && !tsLs.isEmpty()){ + /*The meetings timeslots are already sorted before coming here*/ + Date startTime= tsLs.get(0).getStartTime(); + int cursor=0; + for (int i = 0; i < tsLs.size()-1; i++) { + long firstBlockEndTime = tsLs.get(cursor).getEndTime().getTime(); + + //to see if next block is within first block + long secondBlockEndTime = tsLs.get(i+1).getEndTime().getTime(); + if(secondBlockEndTime - firstBlockEndTime >= 0){ + cursor = i+1;//advance to next block + } + + long nextBlockStartTime = tsLs.get(i+1).getStartTime().getTime(); + if(nextBlockStartTime - firstBlockEndTime > timeApart){ + SignupTimeslot newTs = new SignupTimeslot(); + newTs.setStartTime(startTime); + newTs.setEndTime(tsLs.get(i).getEndTime()); + tsList.add(newTs); + //reset start time + startTime = tsLs.get(i+1).getStartTime(); + } + + } + + /* add last block*/ + SignupTimeslot newTs = new SignupTimeslot(); + newTs.setStartTime(startTime); + newTs.setEndTime(meeting.getEndTime()); + tsList.add(newTs); + } + } + else{ + /*otherwise there is only one block in calendar*/ + SignupTimeslot newTs = new SignupTimeslot(); + newTs.setStartTime(meeting.getStartTime()); + newTs.setEndTime(meeting.getEndTime()); + tsList.add(newTs); + } + + return tsList; + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public void removeCalendarEvents(List meetings) throws Exception { + if (meetings == null || meetings.isEmpty()) + return; + + for (SignupMeeting meeting : meetings) { + List sites = meeting.getSignupSites(); + if (sites == null || sites.isEmpty()) + continue; + + for (SignupSite site : sites) { + try { + Calendar calendar = chooseCalendar(site); + + if (calendar == null)// something went wrong when fetching the calendar + continue; + + String eventIds = null; + if (site.isSiteScope()) { + eventIds = site.getCalendarEventId(); + } else { + List signupGroups = site.getSignupGroups(); + for (SignupGroup group : signupGroups) { + eventIds = group.getCalendarEventId(); + break; + } + } + + if (eventIds == null || eventIds.trim().length() < 1) + continue; + + /*separate the eventIds token by '|' */ + StringTokenizer token = new StringTokenizer(eventIds,"|"); + List evtIds = new ArrayList(); + while (token.hasMoreTokens()) { + evtIds.add(token.nextToken().trim()); + } + + for (String evtId : evtIds) { + CalendarEventEdit eventEdit = calendar.getEditEvent(evtId, + org.sakaiproject.calendar.api.CalendarService.EVENT_REMOVE_CALENDAR); + if (eventEdit == null) + continue; + + if (!calendar.allowEditEvent(evtId)) + continue; + + calendar.removeEvent(eventEdit); + } + + } catch (PermissionException e) { + log.info("PermissionException for removal of calendar: " + e.getMessage()); + } + } + } + + } + + // See if additional calendar is deployed and ready to use. + // If not, we use the Sakai calendar tool by default. + private Calendar chooseCalendar(SignupSite site) throws PermissionException { + Calendar calendar = sakaiFacade.getAdditionalCalendar(site.getSiteId()); + if (calendar == null) { + calendar = sakaiFacade.getCalendar(site.getSiteId()); + } + return calendar; + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public void removeCalendarEventsOnModifiedMeeting(List meetings) throws Exception { + + try{ + removeCalendarEvents(meetings); + + /*remove calendar info in the event object*/ + for (SignupMeeting sm : meetings) { + List sites = sm.getSignupSites(); + if(sites !=null && !sites.isEmpty()){ + for (SignupSite s : sites) { + if(s.getCalendarEventId() !=null){ + s.setCalendarEventId(null); + s.setCalendarId(null); + } + List grps = s.getSignupGroups(); + if(grps !=null && !grps.isEmpty()){ + for (SignupGroup g : grps) { + if(g.getCalendarEventId()!=null){ + g.setCalendarEventId(null); + g.setCalendarId(null); + } + } + } + } + } + + updateMeetingWithVersionHandling(sm); + } + }catch(Exception e){ + log.warn("Exception for removal of calendar and calendar info may not be removed from events objects: " + e.getMessage()); + } + } + + /* + * This method will create a skeleton event/meeting in the Scheduler tool + * in that site. It still needs to be committed. + */ + private CalendarEventEdit calendarEvent(Calendar calendar, SignupMeeting meeting, SignupSite site) + throws IdUnusedException, PermissionException { + CalendarEventEdit addEvent = calendar.addEvent(); + addEvent.setType("Meeting"); + if (!site.isSiteScope()) { + List groups = groupIds(site); + addEvent.setGroupAccess(groups, true); + } + + return addEvent; + } + + /* + * Main purpose is to update the calendarId and eventId into the related + * meeting site/groups + */ + private void updateMeetingWithVersionHandling(SignupMeeting meeting) throws Exception { + for (int i = 0; i < MAX_NUMBER_OF_RETRY; i++) { + try { + updateSignupMeeting(meeting, true); + return; + } catch (OptimisticLockingFailureException e) { + // nothing + } + } + throw new SignupUserActionException("Some one updated the meeting before your update. Please try again."); + } + + /** + * This will return a list of Group objects from the site + * + * @param site + * a unique id which represents the current site + * @return a list of Group objects from the site + */ + private List groupIds(SignupSite site) { + List groups = new ArrayList(); + List signupGroups = site.getSignupGroups(); + for (SignupGroup group : signupGroups) { + try { + groups.add(sakaiFacade.getGroup(site.getSiteId(), group.getGroupId())); + } catch (IdUnusedException e) { + log.info("IdUnusedException: " + e.getMessage()); + } + } + return groups; + } + + + /** + * {@inheritDoc} + */ + public void sendEmail(SignupMeeting signupMeeting, String messageType) throws Exception { + signupEmailFacade.sendEmailAllUsers(signupMeeting, messageType); + + } + + /** + * {@inheritDoc} + */ + public void sendEmailToOrganizer(SignupEventTrackingInfo signupEventTrackingInfo) throws Exception { + signupEmailFacade.sendEmailToOrganizer(signupEventTrackingInfo); + } + + /** + * {@inheritDoc} + */ + public void sendCancellationEmail(SignupEventTrackingInfo signupEventTrackingInfo) throws Exception { + signupEmailFacade.sendCancellationEmail(signupEventTrackingInfo); + } + + /** + * {@inheritDoc} + */ + public void sendUpdateCommentEmail(SignupEventTrackingInfo signupEventTrackingInfo) throws Exception { + signupEmailFacade.sendUpdateCommentEmail(signupEventTrackingInfo); + } + + /** + * {@inheritDoc} + */ + public void removeMeetings(List meetings) throws Exception { + signupMeetingDao.removeMeetings(meetings); + + for(SignupMeeting m: meetings) { + if(!m.isMeetingExpired()) { + log.info("Meeting is still available, email notifications will be sent"); + //SIGNUP-188 :If an event is cancelled, all the site members get an email + m.setSendEmailToSelectedPeopleOnly(SEND_EMAIL_ONLY_SIGNED_UP_ATTENDEES); + signupEmailFacade.sendEmailAllUsers(m, SignupMessageTypes.SIGNUP_CANCEL_MEETING); + } + } + } + + /** + * {@inheritDoc} + */ + public void sendEmailToParticipantsByOrganizerAction(SignupEventTrackingInfo signupEventTrackingInfo) + throws Exception { + signupEmailFacade.sendEmailToParticipantsByOrganizerAction(signupEventTrackingInfo); + + } + + /** + * {@inheritDoc} + */ + public boolean isEventExisted(Long eventId) { + return signupMeetingDao.isEventExisted(eventId); + } + + /** + * {@inheritDoc} + */ + public void sendEmailToAttendee(SignupEventTrackingInfo signupEventTrackingInfo) throws Exception { + signupEmailFacade.sendEmailToAttendee(signupEventTrackingInfo); + } + + @Override + public List getAllLocations(String siteId) throws Exception { + return signupMeetingDao.getAllLocations(siteId); + } + + @Override + public List getAllCategories(String siteId) throws Exception { + return signupMeetingDao.getAllCategories(siteId); + } + + + + +} diff --git a/signup/impl/src/java/org/sakaiproject/signup/logic/SignupNotifyJob.java b/signup/impl/src/java/org/sakaiproject/signup/logic/SignupNotifyJob.java index 9941a9d7341f..5c3c336b17e5 100644 --- a/signup/impl/src/java/org/sakaiproject/signup/logic/SignupNotifyJob.java +++ b/signup/impl/src/java/org/sakaiproject/signup/logic/SignupNotifyJob.java @@ -24,8 +24,8 @@ import java.util.Date; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; @@ -48,7 +48,7 @@ */ public class SignupNotifyJob implements Job { - private static final Log LOGGER = LogFactory.getLog(SignupNotifyJob.class); + private static final Logger LOGGER = LoggerFactory.getLogger(SignupNotifyJob.class); private EmailService emailService; diff --git a/signup/impl/src/java/org/sakaiproject/signup/logic/messages/EmailDeliverer.java b/signup/impl/src/java/org/sakaiproject/signup/logic/messages/EmailDeliverer.java index 714cca26d080..a5375b94abbd 100644 --- a/signup/impl/src/java/org/sakaiproject/signup/logic/messages/EmailDeliverer.java +++ b/signup/impl/src/java/org/sakaiproject/signup/logic/messages/EmailDeliverer.java @@ -21,8 +21,8 @@ import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.email.api.EmailService; import org.sakaiproject.user.api.User; @@ -34,7 +34,7 @@ public class EmailDeliverer implements Runnable { private List sakaiUsers; private final EmailService emailService; - private Log logger = LogFactory.getLog(EmailDeliverer.class); + private Logger logger = LoggerFactory.getLogger(EmailDeliverer.class); private final List headers; private final String message; diff --git a/signup/tool/src/java/org/sakaiproject/signup/tool/SignupServlet.java b/signup/tool/src/java/org/sakaiproject/signup/tool/SignupServlet.java index fff188c76838..554d45519144 100644 --- a/signup/tool/src/java/org/sakaiproject/signup/tool/SignupServlet.java +++ b/signup/tool/src/java/org/sakaiproject/signup/tool/SignupServlet.java @@ -1,378 +1,378 @@ -/* -* Licensed to The Apereo Foundation under one or more contributor license -* agreements. See the NOTICE file distributed with this work for -* additional information regarding copyright ownership. -* -* The Apereo Foundation licenses this file to you 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: -* -* http://opensource.org/licenses/ecl2.txt -* -* 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.sakaiproject.signup.tool; - -import java.io.IOException; -import java.io.Serializable; -import java.util.Enumeration; - -import javax.faces.FactoryFinder; -import javax.faces.application.Application; -import javax.faces.application.ApplicationFactory; -import javax.faces.context.FacesContext; -import javax.faces.context.FacesContextFactory; -import javax.faces.lifecycle.Lifecycle; -import javax.faces.lifecycle.LifecycleFactory; -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.sakaiproject.jsf.util.HelperAwareJsfTool; -import org.sakaiproject.jsf.util.JsfTool; -import org.sakaiproject.signup.tool.jsf.attachment.AttachmentHandler; -import org.sakaiproject.tool.api.ActiveTool; -import org.sakaiproject.tool.api.Tool; -import org.sakaiproject.tool.api.ToolException; -import org.sakaiproject.tool.api.ToolSession; -import org.sakaiproject.tool.cover.ActiveToolManager; -import org.sakaiproject.tool.cover.SessionManager; -import org.sakaiproject.util.Web; - -/** - *

- * This Servlet class will enable the path to javaScript and image files in - * Signup tool and it will also enable the ajax call later in the future. For - * Sakai 2.5, it will not pick up the CSS file via the 'sakai.html.head'. and we - * take this out. - *

- */ -@SuppressWarnings("serial") -public class SignupServlet extends JsfTool { - - private String headerPreContent; - - private ServletContext servletContext = null; - - private static final String HELPER_EXT = ".helper"; - - private static final String HELPER_SESSION_PREFIX = "session."; - - /** the alternate next view */ - public static final String ALTERNATE_DONE_URL = "altDoneURL"; - - /** the set of alternate views */ - public static final String ALTERNATE_DONE_URL_MAP = "altDoneURLSet"; - - private static Log M_log = LogFactory.getLog(HelperAwareJsfTool.class); - - /** - * Initialize the Servlet class. - */ - public void init(ServletConfig servletConfig) throws ServletException { - super.init(servletConfig); - // headerPreContent = - // servletConfig.getInitParameter("headerPreContent"); - this.servletContext = servletConfig.getServletContext(); - } - - protected void doPost(HttpServletRequest request, - HttpServletResponse response) throws ServletException, IOException { - // addPrecontent(request); - - // if(ajax request) - // else call the super doPost - super.doPost(request, response); - } - - protected void doGet(HttpServletRequest request, - HttpServletResponse response) throws ServletException, IOException { - // addPrecontent(request); - // if(ajax request) - // else call the super doGet - super.doGet(request, response); - } - - protected void dispatch(HttpServletRequest req, HttpServletResponse res) - throws ServletException, IOException { - - ToolSession session = null; - String target = req.getPathInfo(); - - // see if we have a helper request - if (sendToHelper(req, res, target)) { - return; - } - - // see if we have a resource request - i.e. a path with an extension, - // and one that is not the JSF_EXT - if (isResourceRequest(target)) { - // get a dispatcher to the path - RequestDispatcher resourceDispatcher = getServletContext().getRequestDispatcher(target); - if (resourceDispatcher != null) { - resourceDispatcher.forward(req, res); - return; - } - } - - if ("Title".equals(req.getParameter("panel"))) { - // This allows only one Title JSF for each tool - target = "/title.jsf"; - } - - else { - session = SessionManager.getCurrentToolSession(); - - if (target == null || "/".equals(target) || target.length() == 0) { - if (!m_defaultToLastView) { - // make sure tool session is clean - session.clearAttributes(); - } - - target = computeDefaultTarget(); - - // make sure it's a valid path - if (!target.startsWith("/")) { - target = "/" + target; - } - - // now that we've messed with the URL, send a redirect to make - // it official - res.sendRedirect(Web.returnUrl(req, target)); - return; - } - - // see if we want to change the specifically requested view - String newTarget = redirectRequestedTarget(target); - - // make sure it's a valid path - if (!newTarget.startsWith("/")) { - newTarget = "/" + newTarget; - } - - if (!newTarget.equals(target)) { - // now that we've messed with the URL, send a redirect to make - // it official - res.sendRedirect(Web.returnUrl(req, newTarget)); - return; - } - target = newTarget; - - // store this - session.setAttribute(LAST_VIEW_VISITED, target); - } - - // add the configured folder root and extension (if missing) - target = m_path + target; - - // add the default JSF extension (if we have no extension) - int lastSlash = target.lastIndexOf("/"); - int lastDot = target.lastIndexOf("."); - if (lastDot < 0 || lastDot < lastSlash) { - target += JSF_EXT; - } - - // set the information that can be removed from return URLs - req.setAttribute(URL_PATH, m_path); - req.setAttribute(URL_EXT, ".jsp"); - - // set the sakai request object wrappers to provide the native, not - // Sakai set up, URL information - // - this assures that the FacesServlet can dispatch to the proper view - // based on the path info - req.setAttribute(Tool.NATIVE_URL, Tool.NATIVE_URL); - - // TODO: Should setting the HTTP headers be moved up to the portal level - // as well? - res.setContentType("text/html; charset=UTF-8"); - res.addDateHeader("Expires", System.currentTimeMillis() - - (1000L * 60L * 60L * 24L * 365L)); - res.addDateHeader("Last-Modified", System.currentTimeMillis()); - res.addHeader("Cache-Control", - "no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0"); - res.addHeader("Pragma", "no-cache"); - - if (session != null && ("true").equals(session.getAttribute("SENT_TO_FILEPICKER_HELPER"))) { - AttachmentHandler bean = (AttachmentHandler) lookupBeanFromExternalServlet("AttachmentHandler", req, res); - bean.setAttachmentItems(); - session.removeAttribute("SENT_TO_FILEPICKER_HELPER"); - } - - // dispatch to the target - M_log.debug("dispatching path: " + req.getPathInfo() + " to: " + target - + " context: " + getServletContext().getServletContextName()); - RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(target); - dispatcher.forward(req, res); - - // restore the request object - req.removeAttribute(Tool.NATIVE_URL); - req.removeAttribute(URL_PATH); - req.removeAttribute(URL_EXT); - - // see if we have a helper request - if (!sendToHelper(req, res, "")) { - ToolSession toolSession = SessionManager.getCurrentToolSession(); - if (("true").equals(toolSession.getAttribute("SENT_TO_FILEPICKER_HELPER"))) { - AttachmentHandler bean = (AttachmentHandler) lookupBeanFromExternalServlet("AttachmentHandler", req, res); - bean.setAttachmentItems(); - toolSession.removeAttribute("SENT_TO_FILEPICKER_HELPER"); - } - } - } - - protected boolean sendToHelper(HttpServletRequest req, HttpServletResponse res, String target) { - String path = req.getPathInfo(); - if (path == null) - path = "/"; - - // 0 parts means the path was just "/", otherwise parts[0] = "", - // parts[1] = item id, parts[2] if present is "edit"... - String[] parts = path.split("/"); - - if (parts.length < 2) { - return false; - } - - String helperPath = null; - String toolPath = ""; - /* - * e.g. helper url in Signup can be - * /jsf/signup/newMeeting/sakai.filepicker.helper/tool or - * /sakai.filepicker.helper - */ - if (parts.length > 2) { - helperPath = parts[parts.length - 2]; - toolPath = parts[parts.length - 1]; - } else if (parts.length == 2) { - helperPath = parts[1]; - } else - return false; - - if (!helperPath.endsWith(HELPER_EXT)) - return false; - - ToolSession toolSession = SessionManager.getCurrentToolSession(); - - Enumeration params = req.getParameterNames(); - while (params.hasMoreElements()) { - String paramName = (String) params.nextElement(); - if (paramName.startsWith(HELPER_SESSION_PREFIX)) { - String attributeName = paramName.substring(HELPER_SESSION_PREFIX.length()); - toolSession.setAttribute(attributeName, req.getParameter(paramName)); - } - } - - // calc helper id - int posEnd = helperPath.lastIndexOf("."); - - String helperId = helperPath.substring(0, posEnd); - ActiveTool helperTool = ActiveToolManager.getActiveTool(helperId); - - // get the current location (if one doesn't exist) and save it for when - // we return from the helper - if (toolSession.getAttribute(helperTool.getId() + Tool.HELPER_DONE_URL) == null) { - toolSession.setAttribute(helperTool.getId() + Tool.HELPER_DONE_URL, - req.getContextPath() + req.getServletPath() + computeDefaultTarget(true)); - } - toolSession.setAttribute(helperTool.getId() + "thetoolPath", req.getContextPath() - + req.getServletPath()); - - if (helperPath.endsWith("sakai.filepicker.helper")) - toolSession.setAttribute("SENT_TO_FILEPICKER_HELPER", "true");// flag - // for - // filePicker - - // saves the alternate done url map into a tool specific attribute - if (toolSession.getAttribute(helperTool.getId() + ALTERNATE_DONE_URL) == null) { - toolSession.setAttribute(helperTool.getId() + ALTERNATE_DONE_URL, - toolSession.getAttribute(ALTERNATE_DONE_URL)); - toolSession.setAttribute(helperTool.getId() - + ALTERNATE_DONE_URL_MAP, toolSession.getAttribute(ALTERNATE_DONE_URL_MAP)); - toolSession.removeAttribute(ALTERNATE_DONE_URL); - toolSession.removeAttribute(ALTERNATE_DONE_URL_MAP); - } - - String context = req.getContextPath() + req.getServletPath() + "/"+ helperPath; - try { - helperTool.help(req, res, context, "/" + toolPath); - } catch (ToolException e) { - throw new RuntimeException(e); - } - - return true; // was handled as helper call - } - - /** - * Helper method to look up backing bean, when OUTSIDE faces in a servlet. - * Don't forget to cast! e.g. (TemplateBean) - * ContextUtil.lookupBean("template") - * - * @param beanName - * @param request - * servlet request - * @param response - * servlet response - * @return the backing bean - */ - public Serializable lookupBeanFromExternalServlet(String beanName, - HttpServletRequest request, HttpServletResponse response) { - // prepare lifecycle - LifecycleFactory lFactory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY); - Lifecycle lifecycle = lFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE); - - FacesContextFactory fcFactory = (FacesContextFactory) FactoryFinder - .getFactory(FactoryFinder.FACES_CONTEXT_FACTORY); - - // in the integrated environment, we can't get the ServletContext from - // the - // HttpSession of the request - because the HttpSession is - // webcontainer-wide, - // its not tied to a particular servlet. - - if (this.servletContext == null) { - servletContext = request.getSession().getServletContext(); - } - - FacesContext facesContext = fcFactory.getFacesContext(servletContext, - request, response, lifecycle); - - ApplicationFactory factory = (ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY); - Application application = factory.getApplication(); - Serializable bean = (Serializable) application.getVariableResolver().resolveVariable(facesContext, beanName); - return bean; - } - - protected String computeDefaultTarget(boolean lastVisited) { - // setup for the default view as configured - String target = "/" + m_default; - - // if we are doing lastVisit and there's a last-visited view, for this - // tool placement / user, use that - if (lastVisited) { - ToolSession session = SessionManager.getCurrentToolSession(); - String last = (String) session.getAttribute(LAST_VIEW_VISITED); - if (last != null) { - target = last; - } - } - - return target; - } - - /* - * private void addPrecontent(HttpServletRequest request) { String - * sakaiHeader = (String) request.getAttribute("sakai.html.head"); - * request.setAttribute("sakai.html.head", sakaiHeader + headerPreContent); } - */ -} +/* +* Licensed to The Apereo Foundation under one or more contributor license +* agreements. See the NOTICE file distributed with this work for +* additional information regarding copyright ownership. +* +* The Apereo Foundation licenses this file to you 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: +* +* http://opensource.org/licenses/ecl2.txt +* +* 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.sakaiproject.signup.tool; + +import java.io.IOException; +import java.io.Serializable; +import java.util.Enumeration; + +import javax.faces.FactoryFinder; +import javax.faces.application.Application; +import javax.faces.application.ApplicationFactory; +import javax.faces.context.FacesContext; +import javax.faces.context.FacesContextFactory; +import javax.faces.lifecycle.Lifecycle; +import javax.faces.lifecycle.LifecycleFactory; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletConfig; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sakaiproject.jsf.util.HelperAwareJsfTool; +import org.sakaiproject.jsf.util.JsfTool; +import org.sakaiproject.signup.tool.jsf.attachment.AttachmentHandler; +import org.sakaiproject.tool.api.ActiveTool; +import org.sakaiproject.tool.api.Tool; +import org.sakaiproject.tool.api.ToolException; +import org.sakaiproject.tool.api.ToolSession; +import org.sakaiproject.tool.cover.ActiveToolManager; +import org.sakaiproject.tool.cover.SessionManager; +import org.sakaiproject.util.Web; + +/** + *

+ * This Servlet class will enable the path to javaScript and image files in + * Signup tool and it will also enable the ajax call later in the future. For + * Sakai 2.5, it will not pick up the CSS file via the 'sakai.html.head'. and we + * take this out. + *

+ */ +@SuppressWarnings("serial") +public class SignupServlet extends JsfTool { + + private String headerPreContent; + + private ServletContext servletContext = null; + + private static final String HELPER_EXT = ".helper"; + + private static final String HELPER_SESSION_PREFIX = "session."; + + /** the alternate next view */ + public static final String ALTERNATE_DONE_URL = "altDoneURL"; + + /** the set of alternate views */ + public static final String ALTERNATE_DONE_URL_MAP = "altDoneURLSet"; + + private static Logger M_log = LoggerFactory.getLogger(HelperAwareJsfTool.class); + + /** + * Initialize the Servlet class. + */ + public void init(ServletConfig servletConfig) throws ServletException { + super.init(servletConfig); + // headerPreContent = + // servletConfig.getInitParameter("headerPreContent"); + this.servletContext = servletConfig.getServletContext(); + } + + protected void doPost(HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + // addPrecontent(request); + + // if(ajax request) + // else call the super doPost + super.doPost(request, response); + } + + protected void doGet(HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + // addPrecontent(request); + // if(ajax request) + // else call the super doGet + super.doGet(request, response); + } + + protected void dispatch(HttpServletRequest req, HttpServletResponse res) + throws ServletException, IOException { + + ToolSession session = null; + String target = req.getPathInfo(); + + // see if we have a helper request + if (sendToHelper(req, res, target)) { + return; + } + + // see if we have a resource request - i.e. a path with an extension, + // and one that is not the JSF_EXT + if (isResourceRequest(target)) { + // get a dispatcher to the path + RequestDispatcher resourceDispatcher = getServletContext().getRequestDispatcher(target); + if (resourceDispatcher != null) { + resourceDispatcher.forward(req, res); + return; + } + } + + if ("Title".equals(req.getParameter("panel"))) { + // This allows only one Title JSF for each tool + target = "/title.jsf"; + } + + else { + session = SessionManager.getCurrentToolSession(); + + if (target == null || "/".equals(target) || target.length() == 0) { + if (!m_defaultToLastView) { + // make sure tool session is clean + session.clearAttributes(); + } + + target = computeDefaultTarget(); + + // make sure it's a valid path + if (!target.startsWith("/")) { + target = "/" + target; + } + + // now that we've messed with the URL, send a redirect to make + // it official + res.sendRedirect(Web.returnUrl(req, target)); + return; + } + + // see if we want to change the specifically requested view + String newTarget = redirectRequestedTarget(target); + + // make sure it's a valid path + if (!newTarget.startsWith("/")) { + newTarget = "/" + newTarget; + } + + if (!newTarget.equals(target)) { + // now that we've messed with the URL, send a redirect to make + // it official + res.sendRedirect(Web.returnUrl(req, newTarget)); + return; + } + target = newTarget; + + // store this + session.setAttribute(LAST_VIEW_VISITED, target); + } + + // add the configured folder root and extension (if missing) + target = m_path + target; + + // add the default JSF extension (if we have no extension) + int lastSlash = target.lastIndexOf("/"); + int lastDot = target.lastIndexOf("."); + if (lastDot < 0 || lastDot < lastSlash) { + target += JSF_EXT; + } + + // set the information that can be removed from return URLs + req.setAttribute(URL_PATH, m_path); + req.setAttribute(URL_EXT, ".jsp"); + + // set the sakai request object wrappers to provide the native, not + // Sakai set up, URL information + // - this assures that the FacesServlet can dispatch to the proper view + // based on the path info + req.setAttribute(Tool.NATIVE_URL, Tool.NATIVE_URL); + + // TODO: Should setting the HTTP headers be moved up to the portal level + // as well? + res.setContentType("text/html; charset=UTF-8"); + res.addDateHeader("Expires", System.currentTimeMillis() + - (1000L * 60L * 60L * 24L * 365L)); + res.addDateHeader("Last-Modified", System.currentTimeMillis()); + res.addHeader("Cache-Control", + "no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0"); + res.addHeader("Pragma", "no-cache"); + + if (session != null && ("true").equals(session.getAttribute("SENT_TO_FILEPICKER_HELPER"))) { + AttachmentHandler bean = (AttachmentHandler) lookupBeanFromExternalServlet("AttachmentHandler", req, res); + bean.setAttachmentItems(); + session.removeAttribute("SENT_TO_FILEPICKER_HELPER"); + } + + // dispatch to the target + M_log.debug("dispatching path: " + req.getPathInfo() + " to: " + target + + " context: " + getServletContext().getServletContextName()); + RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(target); + dispatcher.forward(req, res); + + // restore the request object + req.removeAttribute(Tool.NATIVE_URL); + req.removeAttribute(URL_PATH); + req.removeAttribute(URL_EXT); + + // see if we have a helper request + if (!sendToHelper(req, res, "")) { + ToolSession toolSession = SessionManager.getCurrentToolSession(); + if (("true").equals(toolSession.getAttribute("SENT_TO_FILEPICKER_HELPER"))) { + AttachmentHandler bean = (AttachmentHandler) lookupBeanFromExternalServlet("AttachmentHandler", req, res); + bean.setAttachmentItems(); + toolSession.removeAttribute("SENT_TO_FILEPICKER_HELPER"); + } + } + } + + protected boolean sendToHelper(HttpServletRequest req, HttpServletResponse res, String target) { + String path = req.getPathInfo(); + if (path == null) + path = "/"; + + // 0 parts means the path was just "/", otherwise parts[0] = "", + // parts[1] = item id, parts[2] if present is "edit"... + String[] parts = path.split("/"); + + if (parts.length < 2) { + return false; + } + + String helperPath = null; + String toolPath = ""; + /* + * e.g. helper url in Signup can be + * /jsf/signup/newMeeting/sakai.filepicker.helper/tool or + * /sakai.filepicker.helper + */ + if (parts.length > 2) { + helperPath = parts[parts.length - 2]; + toolPath = parts[parts.length - 1]; + } else if (parts.length == 2) { + helperPath = parts[1]; + } else + return false; + + if (!helperPath.endsWith(HELPER_EXT)) + return false; + + ToolSession toolSession = SessionManager.getCurrentToolSession(); + + Enumeration params = req.getParameterNames(); + while (params.hasMoreElements()) { + String paramName = (String) params.nextElement(); + if (paramName.startsWith(HELPER_SESSION_PREFIX)) { + String attributeName = paramName.substring(HELPER_SESSION_PREFIX.length()); + toolSession.setAttribute(attributeName, req.getParameter(paramName)); + } + } + + // calc helper id + int posEnd = helperPath.lastIndexOf("."); + + String helperId = helperPath.substring(0, posEnd); + ActiveTool helperTool = ActiveToolManager.getActiveTool(helperId); + + // get the current location (if one doesn't exist) and save it for when + // we return from the helper + if (toolSession.getAttribute(helperTool.getId() + Tool.HELPER_DONE_URL) == null) { + toolSession.setAttribute(helperTool.getId() + Tool.HELPER_DONE_URL, + req.getContextPath() + req.getServletPath() + computeDefaultTarget(true)); + } + toolSession.setAttribute(helperTool.getId() + "thetoolPath", req.getContextPath() + + req.getServletPath()); + + if (helperPath.endsWith("sakai.filepicker.helper")) + toolSession.setAttribute("SENT_TO_FILEPICKER_HELPER", "true");// flag + // for + // filePicker + + // saves the alternate done url map into a tool specific attribute + if (toolSession.getAttribute(helperTool.getId() + ALTERNATE_DONE_URL) == null) { + toolSession.setAttribute(helperTool.getId() + ALTERNATE_DONE_URL, + toolSession.getAttribute(ALTERNATE_DONE_URL)); + toolSession.setAttribute(helperTool.getId() + + ALTERNATE_DONE_URL_MAP, toolSession.getAttribute(ALTERNATE_DONE_URL_MAP)); + toolSession.removeAttribute(ALTERNATE_DONE_URL); + toolSession.removeAttribute(ALTERNATE_DONE_URL_MAP); + } + + String context = req.getContextPath() + req.getServletPath() + "/"+ helperPath; + try { + helperTool.help(req, res, context, "/" + toolPath); + } catch (ToolException e) { + throw new RuntimeException(e); + } + + return true; // was handled as helper call + } + + /** + * Helper method to look up backing bean, when OUTSIDE faces in a servlet. + * Don't forget to cast! e.g. (TemplateBean) + * ContextUtil.lookupBean("template") + * + * @param beanName + * @param request + * servlet request + * @param response + * servlet response + * @return the backing bean + */ + public Serializable lookupBeanFromExternalServlet(String beanName, + HttpServletRequest request, HttpServletResponse response) { + // prepare lifecycle + LifecycleFactory lFactory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY); + Lifecycle lifecycle = lFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE); + + FacesContextFactory fcFactory = (FacesContextFactory) FactoryFinder + .getFactory(FactoryFinder.FACES_CONTEXT_FACTORY); + + // in the integrated environment, we can't get the ServletContext from + // the + // HttpSession of the request - because the HttpSession is + // webcontainer-wide, + // its not tied to a particular servlet. + + if (this.servletContext == null) { + servletContext = request.getSession().getServletContext(); + } + + FacesContext facesContext = fcFactory.getFacesContext(servletContext, + request, response, lifecycle); + + ApplicationFactory factory = (ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY); + Application application = factory.getApplication(); + Serializable bean = (Serializable) application.getVariableResolver().resolveVariable(facesContext, beanName); + return bean; + } + + protected String computeDefaultTarget(boolean lastVisited) { + // setup for the default view as configured + String target = "/" + m_default; + + // if we are doing lastVisit and there's a last-visited view, for this + // tool placement / user, use that + if (lastVisited) { + ToolSession session = SessionManager.getCurrentToolSession(); + String last = (String) session.getAttribute(LAST_VIEW_VISITED); + if (last != null) { + target = last; + } + } + + return target; + } + + /* + * private void addPrecontent(HttpServletRequest request) { String + * sakaiHeader = (String) request.getAttribute("sakai.html.head"); + * request.setAttribute("sakai.html.head", sakaiHeader + headerPreContent); } + */ +} diff --git a/signup/tool/src/java/org/sakaiproject/signup/tool/downloadEvents/DownloadEventBean.java b/signup/tool/src/java/org/sakaiproject/signup/tool/downloadEvents/DownloadEventBean.java index e03c8ece7c94..b9d41cdf83ff 100644 --- a/signup/tool/src/java/org/sakaiproject/signup/tool/downloadEvents/DownloadEventBean.java +++ b/signup/tool/src/java/org/sakaiproject/signup/tool/downloadEvents/DownloadEventBean.java @@ -30,8 +30,8 @@ import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.poi.ss.usermodel.Workbook; import org.sakaiproject.signup.tool.jsf.SignupMeetingWrapper; import org.sakaiproject.signup.tool.jsf.SignupMeetingsBean; @@ -49,7 +49,7 @@ */ public class DownloadEventBean extends SignupMeetingsBean { - private static Log log = LogFactory.getLog(DownloadEventBean.class); + private static Logger log = LoggerFactory.getLogger(DownloadEventBean.class); private static final String DOWNLOAD_ACT_URL = "downloadEvents"; diff --git a/signup/tool/src/java/org/sakaiproject/signup/tool/entityproviders/CopyFileProcessor.java b/signup/tool/src/java/org/sakaiproject/signup/tool/entityproviders/CopyFileProcessor.java index 684f61f7117d..58ad8a58d52d 100644 --- a/signup/tool/src/java/org/sakaiproject/signup/tool/entityproviders/CopyFileProcessor.java +++ b/signup/tool/src/java/org/sakaiproject/signup/tool/entityproviders/CopyFileProcessor.java @@ -1,152 +1,152 @@ -/* -* Licensed to The Apereo Foundation under one or more contributor license -* agreements. See the NOTICE file distributed with this work for -* additional information regarding copyright ownership. -* -* The Apereo Foundation licenses this file to you 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: -* -* http://opensource.org/licenses/ecl2.txt -* -* 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.sakaiproject.signup.tool.entityproviders; - -import java.text.Format; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.List; -import java.util.Stack; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.sakaiproject.content.api.ContentResource; -import org.sakaiproject.entity.api.Reference; -import org.sakaiproject.entity.cover.EntityManager; -import org.sakaiproject.exception.IdUnusedException; -import org.sakaiproject.exception.PermissionException; -import org.sakaiproject.exception.TypeException; -import org.sakaiproject.signup.logic.SakaiFacade; -import org.sakaiproject.signup.logic.SignupMeetingService; -import org.sakaiproject.signup.model.SignupAttachment; -import org.sakaiproject.signup.model.SignupMeeting; -import org.sakaiproject.signup.model.SignupTimeslot; -import org.sakaiproject.signup.tool.jsf.attachment.AttachmentHandler; -import org.sakaiproject.signup.tool.jsf.attachment.RemoveAttachment; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class CopyFileProcessor extends AttachmentHandler{ - - private static Log log = LogFactory.getLog(CopyFileProcessor.class); - - public CopyFileProcessor(SakaiFacade sakaiFacade, SignupMeetingService signupMeetingService){ - setSakaiFacade(sakaiFacade); - setSignupMeetingService(signupMeetingService); - } - - public String processAddAttachRedirect(List attachList, SignupMeeting sMeeting, - boolean isOrganizer) { - //overwrites original method. unavailable - return null; - } - public SignupAttachment copySignupAttachment(SignupMeeting sMeeting, boolean isOrganizer, - SignupAttachment attach, String fromContext, String toContext) { - SignupAttachment newAttach = null; - ContentResource cr = null; - ContentResource newCr = null; - if (attach == null || attach.getResourceId().trim().length() < 1) - return null; - - String newResourceId = attach.getResourceId(); - if(newResourceId != null){ - newResourceId = newResourceId.replaceAll(fromContext, toContext); - } - try { - cr = getSakaiFacade().getContentHostingService().getResource(attach.getResourceId()); - if (cr != null) { - String protocol = getSakaiFacade().getServerConfigurationService().getServerUrl(); - newResourceId = getSakaiFacade().getContentHostingService().copy( - attach.getResourceId(), newResourceId); - newCr = getSakaiFacade().getContentHostingService().getResource(newResourceId); - Reference ref = EntityManager.newReference(newCr.getReference()); - if (ref != null) { - newAttach = createSignupAttachment(ref.getId(), ref.getProperties() - .getProperty(ref.getProperties().getNamePropDisplayName()), protocol); - - /* Case: for cross-sites, make it to public view */ - determineAndAssignPublicView(sMeeting, newAttach); - } - } - } catch (PermissionException e) { - log.warn("ContentHostingService.getResource() throws PermissionException=" - + e.getMessage()); - } catch (IdUnusedException e) { - log.warn("ContentHostingService.getResource() throws IdUnusedException=" - + e.getMessage()); - /* - * If the attachment somehow get removed from CHS and it's a broken - * link - */ - RemoveAttachment removeAttach = new RemoveAttachment(getSignupMeetingService(), getSakaiFacade() - .getCurrentUserId(), getSakaiFacade().getCurrentLocationId(), isOrganizer); - removeAttach.removeAttachment(sMeeting, attach); - } catch (TypeException e) { - log.warn("ContentHostingService.getResource() throws TypeException=" + e.getMessage()); - } catch (Exception e) { - log.warn("ContentHostingService.getResource() throws Exception=" + e.getMessage()); - } - - return newAttach; - } - - public Element toXml(String element, Document doc, Stack stack) { - Element ele = doc.createElement(element); - - if (stack.isEmpty()){ - doc.appendChild(ele); - } - else{ - ((Element) stack.peek()).appendChild(ele); - } - - stack.push(ele); - stack.pop(); - - return ele; - } - - public static Element timeslotToXml(SignupTimeslot timeslot, Document doc, Stack stack) { - Element element = doc.createElement("timeslot"); - - if (stack.isEmpty()){ - doc.appendChild(element); - } - else { - ((Element) stack.peek()).appendChild(element); - } - - stack.push(element); - - Date startTime = timeslot.getStartTime(); - Date endTime = timeslot.getEndTime(); - Format formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - String strStartTime = formatter.format(startTime); - String strEndTime = formatter.format(endTime); - - element.setAttribute("endTime", strEndTime); - element.setAttribute("startTime", strStartTime); - - stack.pop(); - - return element; - } -} - +/* +* Licensed to The Apereo Foundation under one or more contributor license +* agreements. See the NOTICE file distributed with this work for +* additional information regarding copyright ownership. +* +* The Apereo Foundation licenses this file to you 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: +* +* http://opensource.org/licenses/ecl2.txt +* +* 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.sakaiproject.signup.tool.entityproviders; + +import java.text.Format; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.Stack; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sakaiproject.content.api.ContentResource; +import org.sakaiproject.entity.api.Reference; +import org.sakaiproject.entity.cover.EntityManager; +import org.sakaiproject.exception.IdUnusedException; +import org.sakaiproject.exception.PermissionException; +import org.sakaiproject.exception.TypeException; +import org.sakaiproject.signup.logic.SakaiFacade; +import org.sakaiproject.signup.logic.SignupMeetingService; +import org.sakaiproject.signup.model.SignupAttachment; +import org.sakaiproject.signup.model.SignupMeeting; +import org.sakaiproject.signup.model.SignupTimeslot; +import org.sakaiproject.signup.tool.jsf.attachment.AttachmentHandler; +import org.sakaiproject.signup.tool.jsf.attachment.RemoveAttachment; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +public class CopyFileProcessor extends AttachmentHandler{ + + private static Logger log = LoggerFactory.getLogger(CopyFileProcessor.class); + + public CopyFileProcessor(SakaiFacade sakaiFacade, SignupMeetingService signupMeetingService){ + setSakaiFacade(sakaiFacade); + setSignupMeetingService(signupMeetingService); + } + + public String processAddAttachRedirect(List attachList, SignupMeeting sMeeting, + boolean isOrganizer) { + //overwrites original method. unavailable + return null; + } + public SignupAttachment copySignupAttachment(SignupMeeting sMeeting, boolean isOrganizer, + SignupAttachment attach, String fromContext, String toContext) { + SignupAttachment newAttach = null; + ContentResource cr = null; + ContentResource newCr = null; + if (attach == null || attach.getResourceId().trim().length() < 1) + return null; + + String newResourceId = attach.getResourceId(); + if(newResourceId != null){ + newResourceId = newResourceId.replaceAll(fromContext, toContext); + } + try { + cr = getSakaiFacade().getContentHostingService().getResource(attach.getResourceId()); + if (cr != null) { + String protocol = getSakaiFacade().getServerConfigurationService().getServerUrl(); + newResourceId = getSakaiFacade().getContentHostingService().copy( + attach.getResourceId(), newResourceId); + newCr = getSakaiFacade().getContentHostingService().getResource(newResourceId); + Reference ref = EntityManager.newReference(newCr.getReference()); + if (ref != null) { + newAttach = createSignupAttachment(ref.getId(), ref.getProperties() + .getProperty(ref.getProperties().getNamePropDisplayName()), protocol); + + /* Case: for cross-sites, make it to public view */ + determineAndAssignPublicView(sMeeting, newAttach); + } + } + } catch (PermissionException e) { + log.warn("ContentHostingService.getResource() throws PermissionException=" + + e.getMessage()); + } catch (IdUnusedException e) { + log.warn("ContentHostingService.getResource() throws IdUnusedException=" + + e.getMessage()); + /* + * If the attachment somehow get removed from CHS and it's a broken + * link + */ + RemoveAttachment removeAttach = new RemoveAttachment(getSignupMeetingService(), getSakaiFacade() + .getCurrentUserId(), getSakaiFacade().getCurrentLocationId(), isOrganizer); + removeAttach.removeAttachment(sMeeting, attach); + } catch (TypeException e) { + log.warn("ContentHostingService.getResource() throws TypeException=" + e.getMessage()); + } catch (Exception e) { + log.warn("ContentHostingService.getResource() throws Exception=" + e.getMessage()); + } + + return newAttach; + } + + public Element toXml(String element, Document doc, Stack stack) { + Element ele = doc.createElement(element); + + if (stack.isEmpty()){ + doc.appendChild(ele); + } + else{ + ((Element) stack.peek()).appendChild(ele); + } + + stack.push(ele); + stack.pop(); + + return ele; + } + + public static Element timeslotToXml(SignupTimeslot timeslot, Document doc, Stack stack) { + Element element = doc.createElement("timeslot"); + + if (stack.isEmpty()){ + doc.appendChild(element); + } + else { + ((Element) stack.peek()).appendChild(element); + } + + stack.push(element); + + Date startTime = timeslot.getStartTime(); + Date endTime = timeslot.getEndTime(); + Format formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String strStartTime = formatter.format(startTime); + String strEndTime = formatter.format(endTime); + + element.setAttribute("endTime", strEndTime); + element.setAttribute("startTime", strStartTime); + + stack.pop(); + + return element; + } +} + diff --git a/signup/tool/src/java/org/sakaiproject/signup/tool/entityproviders/EventProcessHandler.java b/signup/tool/src/java/org/sakaiproject/signup/tool/entityproviders/EventProcessHandler.java index 8b9c53f1225f..126bc4338b5c 100644 --- a/signup/tool/src/java/org/sakaiproject/signup/tool/entityproviders/EventProcessHandler.java +++ b/signup/tool/src/java/org/sakaiproject/signup/tool/entityproviders/EventProcessHandler.java @@ -24,8 +24,8 @@ import java.util.Date; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.signup.logic.SakaiFacade; import org.sakaiproject.signup.logic.SignupEventTypes; import org.sakaiproject.signup.logic.SignupMeetingService; @@ -62,7 +62,7 @@ public class EventProcessHandler implements SignupBeanConstants { protected SignupRESTfulSessionManager signupRESTfulSessionManager; - protected Log logger = LogFactory.getLog(EventProcessHandler.class); + protected Logger logger = LoggerFactory.getLogger(EventProcessHandler.class); public SignupEvent getSignupEvent(Long eventId, String siteId, String userId, boolean mustAccessDB) { SignupEvent event = null; diff --git a/signup/tool/src/java/org/sakaiproject/signup/tool/entityproviders/SignupEntityProducer.java b/signup/tool/src/java/org/sakaiproject/signup/tool/entityproviders/SignupEntityProducer.java index 1930d6481bcd..93046e552d40 100644 --- a/signup/tool/src/java/org/sakaiproject/signup/tool/entityproviders/SignupEntityProducer.java +++ b/signup/tool/src/java/org/sakaiproject/signup/tool/entityproviders/SignupEntityProducer.java @@ -1,471 +1,471 @@ -/* -* Licensed to The Apereo Foundation under one or more contributor license -* agreements. See the NOTICE file distributed with this work for -* additional information regarding copyright ownership. -* -* The Apereo Foundation licenses this file to you 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: -* -* http://opensource.org/licenses/ecl2.txt -* -* 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.sakaiproject.signup.tool.entityproviders; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.Stack; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.sakaiproject.component.cover.ComponentManager; -import org.sakaiproject.entity.api.Entity; -import org.sakaiproject.entity.api.EntityManager; -import org.sakaiproject.entity.api.EntityProducer; -import org.sakaiproject.entity.api.EntityTransferrer; -import org.sakaiproject.entity.api.HttpAccess; -import org.sakaiproject.entity.api.Reference; -import org.sakaiproject.entity.api.ResourceProperties; -import org.sakaiproject.exception.PermissionException; -import org.sakaiproject.signup.logic.SakaiFacade; -import org.sakaiproject.signup.logic.SignupMeetingService; -import org.sakaiproject.signup.model.MeetingTypes; -import org.sakaiproject.signup.model.SignupAttachment; -import org.sakaiproject.signup.model.SignupAttendee; -import org.sakaiproject.signup.model.SignupGroup; -import org.sakaiproject.signup.model.SignupMeeting; -import org.sakaiproject.signup.model.SignupSite; -import org.sakaiproject.signup.model.SignupTimeslot; -import org.sakaiproject.signup.tool.jsf.organizer.CopyMeetingSignupMBean; -import org.sakaiproject.signup.tool.jsf.organizer.action.CreateMeetings; -import org.sakaiproject.signup.tool.util.Utilities; -import org.sakaiproject.site.api.SiteService; -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.support.DefaultListableBeanFactory; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.context.ConfigurableApplicationContext; - -public class SignupEntityProducer implements MeetingTypes, EntityProducer, EntityTransferrer, - ApplicationContextAware { - - private static Log log = LogFactory.getLog(SignupEntityProducer.class); - - public static final String SIGNUP = "signup"; - public static final String REFERENCE_ROOT = Entity.SEPARATOR + SIGNUP; - - private EntityManager entityManager; - private SakaiFacade sakaiFacade; - ApplicationContext applicationContext; - private CopyFileProcessor copyFileProcessor; - private static boolean DEFAULT_ARCHIVE_SUPPORT = "true".equalsIgnoreCase(Utilities.getSignupConfigParamVal("signup.isarchive.support", "false")) ? true : false; - - public void init() { - if (log.isDebugEnabled()) log.debug("signup EP.init()"); - try { - entityManager.registerEntityProducer(this, REFERENCE_ROOT); - log.info("Registered kaltura entity producer as: "+ REFERENCE_ROOT); - - // get the main sakai AC (it will be the parent of our AC) - ApplicationContext sakaiAC = applicationContext.getParent(); - if (sakaiAC != null && sakaiAC instanceof ConfigurableApplicationContext) { - // only ConfigurableApplicationContext - or higher - can register singletons - Object currentKEP = ComponentManager.get(SignupEntityProducer.class.getName()); - // check if something is already registered - if (currentKEP != null) { - log.info("Found existing "+SignupEntityProducer.class.getName()+" in the ComponentManager: "+currentKEP); - // attempt to unregister the existing bean (otherwise the register call will fail) - try { - // only DefaultListableBeanFactory - or higher - can unregister singletons - DefaultListableBeanFactory dlbf = (DefaultListableBeanFactory) sakaiAC.getAutowireCapableBeanFactory(); - dlbf.destroySingleton(SignupEntityProducer.class.getName()); - log.info("Removed existing "+SignupEntityProducer.class.getName()+" from the ComponentManager"); - } catch (Exception e) { - log.warn("FAILED attempted removal of signup bean: "+e); - } - } - // register this EP with the sakai AC - ((ConfigurableApplicationContext)sakaiAC).getBeanFactory().registerSingleton(SignupEntityProducer.class.getName(), this); - } - // now verify if we are good to go - if (ComponentManager.get(SignupEntityProducer.class.getName()) != null) { - log.info("Found "+SignupEntityProducer.class.getName()+" in the ComponentManager"); - } else { - log.warn("FAILED to insert and lookup "+SignupEntityProducer.class.getName()+" in the Sakai ComponentManager, archive imports for signup will not work"); - } - } catch (Exception ex) { - log.warn("signup EP.init(): "+ex, ex); - } - this.copyFileProcessor = new CopyFileProcessor(getSakaiFacade(), getSignupMeetingService()); - } - - //get current user - public SakaiFacade getSakaiFacade() { - return sakaiFacade; - } - - public void setSakaiFacade(SakaiFacade sakaiFacade) { - this.sakaiFacade = sakaiFacade; - } - - public SignupMeetingService getSignupMeetingService() { - return signupMeetingService; - } - - public void setSignupMeetingService(SignupMeetingService signupMeetingService) { - this.signupMeetingService = signupMeetingService; - } - - private SignupMeetingService signupMeetingService; - private CreateMeetings createMeetings; - private CopyMeetingSignupMBean copyMeetingSignupMBean; - private SignupMeeting signupMeeting; - - private String currentUserID = null; - private boolean sendEmail = true; - private boolean assignParticatpantsToFirstOne = false; - private boolean assignParticitpantsToAllEvents = false; - - CreateMeetings createMeeting = new CreateMeetings(signupMeeting, sendEmail, assignParticatpantsToFirstOne, assignParticitpantsToAllEvents, sakaiFacade, signupMeetingService, currentUserID ); - - public CopyMeetingSignupMBean getCopyMeetingSignupMBean() { - return copyMeetingSignupMBean; - } - - public void setCopyMeetingSignupMBean(CopyMeetingSignupMBean copyMeetingSignupMBean) { - this.copyMeetingSignupMBean = copyMeetingSignupMBean; - } - - public CreateMeetings getCreateMeetings() { - return createMeetings; - } - - public void setCreateMeetings(CreateMeetings createMeetings) { - this.createMeetings = createMeetings; - } - - public EntityManager getEntityManager() { - return entityManager; - } - - public void setEntityManager(EntityManager entityManager) { - this.entityManager = entityManager; - } - - public void setApplicationContext(ApplicationContext applicationContext) - throws BeansException { - this.applicationContext = applicationContext; - } - - @Override - //this method is for merge data - public void transferCopyEntities(String fromContext, String toContext, List ids) { - - String currentUserId = getSakaiFacade().getCurrentUserId(); - List allMeetings = getSignupMeetingService().getAllSignupMeetings(fromContext, currentUserId); - List newMeetings = new ArrayList(); - SignupMeeting copiedMeeting = new SignupMeeting(); - SignupMeeting meetingTemp = new SignupMeeting(); - ArrayList recurIDs = new ArrayList(); - int skip = 0; //for when recurring meetings are removed - - if (!allMeetings.isEmpty()){ - for(int i = 0; i < allMeetings.size(); i++){ - meetingTemp = allMeetings.get(i); //holds each meeting - - if(meetingTemp.getRecurrenceId() != null && !recurIDs.contains(meetingTemp.getRecurrenceId())){ - recurIDs.add(meetingTemp.getRecurrenceId()); //add recurID to the list - copiedMeeting = createMeeting.prepareDeepCopy(meetingTemp, 0); //copies each meeting (meetingTemp) - copiedMeeting.setCoordinatorIds(currentUserId); //changes organizer to currentUserId - copiedMeeting.getSignupSites().get(0).setSiteId(toContext); - copiedMeeting.setRepeatType(ONCE_ONLY); - - //copy attachments - List newOnes = new ArrayList(); - List olds = meetingTemp.getSignupAttachments(); - if (olds != null){ - for (SignupAttachment old : olds) { - SignupAttachment newOne = this.copyFileProcessor.copySignupAttachment(meetingTemp, true, old, - fromContext, toContext); - newOnes.add(newOne); - } - } - copiedMeeting.setSignupAttachments(newOnes); - newMeetings.add((i - skip), copiedMeeting); //a list of copied signup meetings - } - else if(recurIDs.contains(meetingTemp.getRecurrenceId())){ - skip++; - } - else { - copiedMeeting = createMeeting.prepareDeepCopy(meetingTemp, 0); //copies each meeting (meetingTemp) - copiedMeeting.setCoordinatorIds(currentUserId); //changes organizer to currentUserId - copiedMeeting.getSignupSites().get(0).setSiteId(toContext); - copiedMeeting.setRepeatType(ONCE_ONLY); - - List newOnes = new ArrayList(); - List olds = meetingTemp.getSignupAttachments(); - if (olds != null){ //copied attachments with correct siteId - for (SignupAttachment old : olds) { - SignupAttachment newOne = this.copyFileProcessor.copySignupAttachment(meetingTemp, true, old, - fromContext, toContext); - newOnes.add(newOne); - } - } - copiedMeeting.setSignupAttachments(newOnes); - newMeetings.add((i - skip), copiedMeeting); //a list of copied signup meetings - } - } //for end - try { - getSignupMeetingService().saveMeetings(newMeetings, currentUserId); - } catch (PermissionException e) { - log.warn("permission issue:" + e.getMessage()); - } - } //if end - } - - @Override - public String[] myToolIds() { - return new String[] {"sakai.signup"}; - } - - @Override - //this method is for replace data - public void transferCopyEntities(String fromContext, String toContext, List ids, boolean cleanup) { - // TODO Auto-generated method stub - String currentUserId = getSakaiFacade().getCurrentUserId(); - List oldMeetings = getSignupMeetingService().getAllSignupMeetings(toContext, currentUserId); - - //removes meetings before adding new ones - try { - getSignupMeetingService().removeMeetings(oldMeetings); - } catch (Exception e1) { - log.warn("remove oldmeeting error:" + e1.getMessage()); - } - transferCopyEntities(fromContext, toContext, ids); - } - - @Override - public String getLabel() { - return SIGNUP; - } - - @Override - public boolean willArchiveMerge() { - return DEFAULT_ARCHIVE_SUPPORT; - } - - @SuppressWarnings("unchecked") - @Override - public String archive(String siteId, Document doc, Stack stack, String archivePath, List attachments) { - - String currentUserId = getSakaiFacade().getCurrentUserId(); - StringBuilder results = new StringBuilder(); - - results.append("archiving " + getLabel() + Entity.SEPARATOR + siteId - + Entity.SEPARATOR + SiteService.MAIN_CONTAINER + ".\n"); - - Element rootElement = doc.createElement(SignupMeetingService.class.getName()); - ((Element) stack.peek()).appendChild(rootElement); // - stack.push(rootElement); - - List allMeetings = getSignupMeetingService().getAllSignupMeetings(siteId, currentUserId); - - if(allMeetings.size() > 0){ - Element meetingListElement = this.copyFileProcessor.toXml("meetingList", doc, stack); // - - //adds meetings - for(int i = 0; allMeetings.size() > i; i++) { - try { - SignupMeeting meeting = allMeetings.get(i); - - Element meetingElement = this.copyFileProcessor.toXml("meeting", doc, stack); // - Element titleElement = this.copyFileProcessor.toXml("title", doc, stack); // - Element locElement = this.copyFileProcessor.toXml("location", doc, stack); //<location> - Element descElement = this.copyFileProcessor.toXml("description", doc, stack); //<description> - Element meetingTypeElement = this.copyFileProcessor.toXml("meetingType", doc, stack); //<meetingType> - Element creatorIdElement = this.copyFileProcessor.toXml("creatorId", doc, stack); //<creatorId> - - titleElement.appendChild(doc.createTextNode(meeting.getTitle())); //title - locElement.appendChild(doc.createTextNode(meeting.getLocation())); //location - descElement.appendChild(doc.createTextNode(meeting.getDescription())); //description - meetingTypeElement.appendChild(doc.createTextNode(meeting.getMeetingType())); //meetingType - creatorIdElement.appendChild(doc.createTextNode(meeting.getCreatorUserId())); //creatorId - - meetingElement.appendChild(titleElement); - meetingElement.appendChild(locElement); - meetingElement.appendChild(descElement); - meetingElement.appendChild(meetingTypeElement); - meetingElement.appendChild(creatorIdElement); - - if(meeting.isRecurredMeeting()){ - Element recurElement = this.copyFileProcessor.toXml("recurrenceType", doc, stack); //<recurrenceType> - recurElement.appendChild(doc.createTextNode(meeting.getRepeatType())); //recurrence - meetingElement.appendChild(recurElement); - } - - Element timeslotListElement = this.copyFileProcessor.toXml("timeslotList", doc, stack); //<timeslotList> - meetingElement.appendChild(timeslotListElement); - - List<SignupTimeslot> timeslots = meeting.getSignupTimeSlots(); //get the timeslots - - //adds timeslots to timeslotList - for (int j = 0; j < timeslots.size(); j++) { - SignupTimeslot timeslot = timeslots.get(j); - List<SignupAttendee> attendees = timeslot.getAttendees(); - - Element timeslotElement = CopyFileProcessor.timeslotToXml(timeslot, doc, stack); //<timeslot> - timeslotListElement.appendChild(timeslotElement); - - if(attendees.size() > 0){ - Element attendeeListElement = this.copyFileProcessor.toXml("attendeeList", doc, stack); //<attendeeList> - timeslotElement.appendChild(attendeeListElement); - - //adds attendees and attendeeIds - for (int q = 0; q < attendees.size(); q++){ - SignupAttendee attendee = (SignupAttendee) attendees.get(q); - Element attendeeElement = this.copyFileProcessor.toXml("attendee", doc, stack); //<attendee> - Element attendeeIdElement = this.copyFileProcessor.toXml("attendeeId", doc, stack); //<attendeeId> - Element attendeeSiteIdElement = this.copyFileProcessor.toXml("attendeeSiteId", doc, stack); //<attendeeSiteId> - - attendeeIdElement.appendChild(doc.createTextNode(attendee.getAttendeeUserId())); - attendeeSiteIdElement.appendChild(doc.createTextNode(attendee.getSignupSiteId())); - attendeeElement.appendChild(attendeeIdElement); - attendeeElement.appendChild(attendeeSiteIdElement); - attendeeListElement.appendChild(attendeeElement); - } //attendee loop end - } //if any attendee end - } //timeslot loop end - - //if there are any attachments - if(meeting.hasSignupAttachments()){ - Element attachmentListElement = this.copyFileProcessor.toXml("attachmentList", doc, stack); //<attachmentList> - List<SignupAttachment> allAttachments = meeting.getSignupAttachments(); - meetingElement.appendChild(attachmentListElement); - - //adds attachments - for(int m = 0; m < allAttachments.size(); m++){ - SignupAttachment attachment = allAttachments.get(m); - - Element attachmentElement = this.copyFileProcessor.toXml("attachment", doc, stack); //<attachment> - Element attachmentUrlElement = this.copyFileProcessor.toXml("attachmentUrl", doc, stack); //<attachmentUrl> - Element attachmentName = this.copyFileProcessor.toXml("attachmentName", doc, stack); //<attachmentName> - attachmentUrlElement.appendChild(doc.createTextNode(attachment.getResourceId())); - attachmentName.appendChild(doc.createTextNode(attachment.getFilename())); - attachmentElement.appendChild(attachmentUrlElement); - attachmentElement.appendChild(attachmentName); - attachmentListElement.appendChild(attachmentElement); - } - } - - List<SignupSite> allSitesInMeeting = meeting.getSignupSites(); - - Element availableToElement = this.copyFileProcessor.toXml("availableTo", doc, stack); //<availableTo> - Element siteListElement = this.copyFileProcessor.toXml("siteList", doc, stack); //<siteList> - availableToElement.appendChild(siteListElement); - meetingElement.appendChild(availableToElement); - - for(int n = 0; n < allSitesInMeeting.size(); n++){ - SignupSite site = allSitesInMeeting.get(n); - - Element siteElement = this.copyFileProcessor.toXml("site", doc, stack); //<site> - Element siteIdElement = this.copyFileProcessor.toXml("siteId", doc, stack); //<siteId> - siteIdElement.appendChild(doc.createTextNode(site.getSiteId())); - siteElement.appendChild(siteIdElement); - siteListElement.appendChild(siteElement); - - //if there are groups - if(site.getSignupGroups().size() > 0){ - List<SignupGroup> allGroupsInSite = site.getSignupGroups(); - Element groupListElement = this.copyFileProcessor.toXml("groupList", doc, stack); //<groupList> - siteElement.appendChild(groupListElement); - - //adds groups - for(int g = 0; g < allGroupsInSite.size(); g++){ - SignupGroup group = allGroupsInSite.get(g); - - Element groupElement = this.copyFileProcessor.toXml("group", doc, stack); //<group> - Element groupIdElement = this.copyFileProcessor.toXml("groupId", doc, stack); //<groupId> - - groupIdElement.appendChild(doc.createTextNode(group.getGroupId())); - groupElement.appendChild(groupIdElement); - groupListElement.appendChild(groupElement); - } - } //signupGroups if end - } //allSites for-loop end - - //add meetings to root - meetingListElement.appendChild(meetingElement); - rootElement.appendChild(meetingListElement); - - } catch (Exception e) { - log.warn(e.getMessage()); - } - } //main for-loop end - } - stack.pop(); - return results.toString(); - } //archive end - - @Override - public String merge(String siteId, Element root, String archivePath, - String fromSiteId, Map attachmentNames, Map userIdTrans, - Set userListAllowImport) { - log.warn("Currently, Sign-up tool site archive will not support merging functionality from archive data into a site"); - return null; - } - - @Override - public boolean parseEntityReference(String reference, Reference ref) { - // TODO Auto-generated method stub - return false; - } - - @Override - public String getEntityDescription(Reference ref) { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResourceProperties getEntityResourceProperties(Reference ref) { - // TODO Auto-generated method stub - return null; - } - - @Override - public Entity getEntity(Reference ref) { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getEntityUrl(Reference ref) { - // TODO Auto-generated method stub - return null; - } - - @Override - public Collection getEntityAuthzGroups(Reference ref, String userId) { - // TODO Auto-generated method stub - return null; - } - - @Override - public HttpAccess getHttpAccess() { - // TODO Auto-generated method stub - return null; - } - -} +/* +* Licensed to The Apereo Foundation under one or more contributor license +* agreements. See the NOTICE file distributed with this work for +* additional information regarding copyright ownership. +* +* The Apereo Foundation licenses this file to you 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: +* +* http://opensource.org/licenses/ecl2.txt +* +* 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.sakaiproject.signup.tool.entityproviders; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Stack; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sakaiproject.component.cover.ComponentManager; +import org.sakaiproject.entity.api.Entity; +import org.sakaiproject.entity.api.EntityManager; +import org.sakaiproject.entity.api.EntityProducer; +import org.sakaiproject.entity.api.EntityTransferrer; +import org.sakaiproject.entity.api.HttpAccess; +import org.sakaiproject.entity.api.Reference; +import org.sakaiproject.entity.api.ResourceProperties; +import org.sakaiproject.exception.PermissionException; +import org.sakaiproject.signup.logic.SakaiFacade; +import org.sakaiproject.signup.logic.SignupMeetingService; +import org.sakaiproject.signup.model.MeetingTypes; +import org.sakaiproject.signup.model.SignupAttachment; +import org.sakaiproject.signup.model.SignupAttendee; +import org.sakaiproject.signup.model.SignupGroup; +import org.sakaiproject.signup.model.SignupMeeting; +import org.sakaiproject.signup.model.SignupSite; +import org.sakaiproject.signup.model.SignupTimeslot; +import org.sakaiproject.signup.tool.jsf.organizer.CopyMeetingSignupMBean; +import org.sakaiproject.signup.tool.jsf.organizer.action.CreateMeetings; +import org.sakaiproject.signup.tool.util.Utilities; +import org.sakaiproject.site.api.SiteService; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.context.ConfigurableApplicationContext; + +public class SignupEntityProducer implements MeetingTypes, EntityProducer, EntityTransferrer, + ApplicationContextAware { + + private static Logger log = LoggerFactory.getLogger(SignupEntityProducer.class); + + public static final String SIGNUP = "signup"; + public static final String REFERENCE_ROOT = Entity.SEPARATOR + SIGNUP; + + private EntityManager entityManager; + private SakaiFacade sakaiFacade; + ApplicationContext applicationContext; + private CopyFileProcessor copyFileProcessor; + private static boolean DEFAULT_ARCHIVE_SUPPORT = "true".equalsIgnoreCase(Utilities.getSignupConfigParamVal("signup.isarchive.support", "false")) ? true : false; + + public void init() { + if (log.isDebugEnabled()) log.debug("signup EP.init()"); + try { + entityManager.registerEntityProducer(this, REFERENCE_ROOT); + log.info("Registered kaltura entity producer as: "+ REFERENCE_ROOT); + + // get the main sakai AC (it will be the parent of our AC) + ApplicationContext sakaiAC = applicationContext.getParent(); + if (sakaiAC != null && sakaiAC instanceof ConfigurableApplicationContext) { + // only ConfigurableApplicationContext - or higher - can register singletons + Object currentKEP = ComponentManager.get(SignupEntityProducer.class.getName()); + // check if something is already registered + if (currentKEP != null) { + log.info("Found existing "+SignupEntityProducer.class.getName()+" in the ComponentManager: "+currentKEP); + // attempt to unregister the existing bean (otherwise the register call will fail) + try { + // only DefaultListableBeanFactory - or higher - can unregister singletons + DefaultListableBeanFactory dlbf = (DefaultListableBeanFactory) sakaiAC.getAutowireCapableBeanFactory(); + dlbf.destroySingleton(SignupEntityProducer.class.getName()); + log.info("Removed existing "+SignupEntityProducer.class.getName()+" from the ComponentManager"); + } catch (Exception e) { + log.warn("FAILED attempted removal of signup bean: "+e); + } + } + // register this EP with the sakai AC + ((ConfigurableApplicationContext)sakaiAC).getBeanFactory().registerSingleton(SignupEntityProducer.class.getName(), this); + } + // now verify if we are good to go + if (ComponentManager.get(SignupEntityProducer.class.getName()) != null) { + log.info("Found "+SignupEntityProducer.class.getName()+" in the ComponentManager"); + } else { + log.warn("FAILED to insert and lookup "+SignupEntityProducer.class.getName()+" in the Sakai ComponentManager, archive imports for signup will not work"); + } + } catch (Exception ex) { + log.warn("signup EP.init(): "+ex, ex); + } + this.copyFileProcessor = new CopyFileProcessor(getSakaiFacade(), getSignupMeetingService()); + } + + //get current user + public SakaiFacade getSakaiFacade() { + return sakaiFacade; + } + + public void setSakaiFacade(SakaiFacade sakaiFacade) { + this.sakaiFacade = sakaiFacade; + } + + public SignupMeetingService getSignupMeetingService() { + return signupMeetingService; + } + + public void setSignupMeetingService(SignupMeetingService signupMeetingService) { + this.signupMeetingService = signupMeetingService; + } + + private SignupMeetingService signupMeetingService; + private CreateMeetings createMeetings; + private CopyMeetingSignupMBean copyMeetingSignupMBean; + private SignupMeeting signupMeeting; + + private String currentUserID = null; + private boolean sendEmail = true; + private boolean assignParticatpantsToFirstOne = false; + private boolean assignParticitpantsToAllEvents = false; + + CreateMeetings createMeeting = new CreateMeetings(signupMeeting, sendEmail, assignParticatpantsToFirstOne, assignParticitpantsToAllEvents, sakaiFacade, signupMeetingService, currentUserID ); + + public CopyMeetingSignupMBean getCopyMeetingSignupMBean() { + return copyMeetingSignupMBean; + } + + public void setCopyMeetingSignupMBean(CopyMeetingSignupMBean copyMeetingSignupMBean) { + this.copyMeetingSignupMBean = copyMeetingSignupMBean; + } + + public CreateMeetings getCreateMeetings() { + return createMeetings; + } + + public void setCreateMeetings(CreateMeetings createMeetings) { + this.createMeetings = createMeetings; + } + + public EntityManager getEntityManager() { + return entityManager; + } + + public void setEntityManager(EntityManager entityManager) { + this.entityManager = entityManager; + } + + public void setApplicationContext(ApplicationContext applicationContext) + throws BeansException { + this.applicationContext = applicationContext; + } + + @Override + //this method is for merge data + public void transferCopyEntities(String fromContext, String toContext, List ids) { + + String currentUserId = getSakaiFacade().getCurrentUserId(); + List<SignupMeeting> allMeetings = getSignupMeetingService().getAllSignupMeetings(fromContext, currentUserId); + List<SignupMeeting> newMeetings = new ArrayList<SignupMeeting>(); + SignupMeeting copiedMeeting = new SignupMeeting(); + SignupMeeting meetingTemp = new SignupMeeting(); + ArrayList<Long> recurIDs = new ArrayList<Long>(); + int skip = 0; //for when recurring meetings are removed + + if (!allMeetings.isEmpty()){ + for(int i = 0; i < allMeetings.size(); i++){ + meetingTemp = allMeetings.get(i); //holds each meeting + + if(meetingTemp.getRecurrenceId() != null && !recurIDs.contains(meetingTemp.getRecurrenceId())){ + recurIDs.add(meetingTemp.getRecurrenceId()); //add recurID to the list + copiedMeeting = createMeeting.prepareDeepCopy(meetingTemp, 0); //copies each meeting (meetingTemp) + copiedMeeting.setCoordinatorIds(currentUserId); //changes organizer to currentUserId + copiedMeeting.getSignupSites().get(0).setSiteId(toContext); + copiedMeeting.setRepeatType(ONCE_ONLY); + + //copy attachments + List<SignupAttachment> newOnes = new ArrayList<SignupAttachment>(); + List<SignupAttachment> olds = meetingTemp.getSignupAttachments(); + if (olds != null){ + for (SignupAttachment old : olds) { + SignupAttachment newOne = this.copyFileProcessor.copySignupAttachment(meetingTemp, true, old, + fromContext, toContext); + newOnes.add(newOne); + } + } + copiedMeeting.setSignupAttachments(newOnes); + newMeetings.add((i - skip), copiedMeeting); //a list of copied signup meetings + } + else if(recurIDs.contains(meetingTemp.getRecurrenceId())){ + skip++; + } + else { + copiedMeeting = createMeeting.prepareDeepCopy(meetingTemp, 0); //copies each meeting (meetingTemp) + copiedMeeting.setCoordinatorIds(currentUserId); //changes organizer to currentUserId + copiedMeeting.getSignupSites().get(0).setSiteId(toContext); + copiedMeeting.setRepeatType(ONCE_ONLY); + + List<SignupAttachment> newOnes = new ArrayList<SignupAttachment>(); + List<SignupAttachment> olds = meetingTemp.getSignupAttachments(); + if (olds != null){ //copied attachments with correct siteId + for (SignupAttachment old : olds) { + SignupAttachment newOne = this.copyFileProcessor.copySignupAttachment(meetingTemp, true, old, + fromContext, toContext); + newOnes.add(newOne); + } + } + copiedMeeting.setSignupAttachments(newOnes); + newMeetings.add((i - skip), copiedMeeting); //a list of copied signup meetings + } + } //for end + try { + getSignupMeetingService().saveMeetings(newMeetings, currentUserId); + } catch (PermissionException e) { + log.warn("permission issue:" + e.getMessage()); + } + } //if end + } + + @Override + public String[] myToolIds() { + return new String[] {"sakai.signup"}; + } + + @Override + //this method is for replace data + public void transferCopyEntities(String fromContext, String toContext, List ids, boolean cleanup) { + // TODO Auto-generated method stub + String currentUserId = getSakaiFacade().getCurrentUserId(); + List<SignupMeeting> oldMeetings = getSignupMeetingService().getAllSignupMeetings(toContext, currentUserId); + + //removes meetings before adding new ones + try { + getSignupMeetingService().removeMeetings(oldMeetings); + } catch (Exception e1) { + log.warn("remove oldmeeting error:" + e1.getMessage()); + } + transferCopyEntities(fromContext, toContext, ids); + } + + @Override + public String getLabel() { + return SIGNUP; + } + + @Override + public boolean willArchiveMerge() { + return DEFAULT_ARCHIVE_SUPPORT; + } + + @SuppressWarnings("unchecked") + @Override + public String archive(String siteId, Document doc, Stack stack, String archivePath, List attachments) { + + String currentUserId = getSakaiFacade().getCurrentUserId(); + StringBuilder results = new StringBuilder(); + + results.append("archiving " + getLabel() + Entity.SEPARATOR + siteId + + Entity.SEPARATOR + SiteService.MAIN_CONTAINER + ".\n"); + + Element rootElement = doc.createElement(SignupMeetingService.class.getName()); + ((Element) stack.peek()).appendChild(rootElement); //<org.sakaiproject> + stack.push(rootElement); + + List<SignupMeeting> allMeetings = getSignupMeetingService().getAllSignupMeetings(siteId, currentUserId); + + if(allMeetings.size() > 0){ + Element meetingListElement = this.copyFileProcessor.toXml("meetingList", doc, stack); //<meetingList> + + //adds meetings + for(int i = 0; allMeetings.size() > i; i++) { + try { + SignupMeeting meeting = allMeetings.get(i); + + Element meetingElement = this.copyFileProcessor.toXml("meeting", doc, stack); //<meeting> + Element titleElement = this.copyFileProcessor.toXml("title", doc, stack); //<title> + Element locElement = this.copyFileProcessor.toXml("location", doc, stack); //<location> + Element descElement = this.copyFileProcessor.toXml("description", doc, stack); //<description> + Element meetingTypeElement = this.copyFileProcessor.toXml("meetingType", doc, stack); //<meetingType> + Element creatorIdElement = this.copyFileProcessor.toXml("creatorId", doc, stack); //<creatorId> + + titleElement.appendChild(doc.createTextNode(meeting.getTitle())); //title + locElement.appendChild(doc.createTextNode(meeting.getLocation())); //location + descElement.appendChild(doc.createTextNode(meeting.getDescription())); //description + meetingTypeElement.appendChild(doc.createTextNode(meeting.getMeetingType())); //meetingType + creatorIdElement.appendChild(doc.createTextNode(meeting.getCreatorUserId())); //creatorId + + meetingElement.appendChild(titleElement); + meetingElement.appendChild(locElement); + meetingElement.appendChild(descElement); + meetingElement.appendChild(meetingTypeElement); + meetingElement.appendChild(creatorIdElement); + + if(meeting.isRecurredMeeting()){ + Element recurElement = this.copyFileProcessor.toXml("recurrenceType", doc, stack); //<recurrenceType> + recurElement.appendChild(doc.createTextNode(meeting.getRepeatType())); //recurrence + meetingElement.appendChild(recurElement); + } + + Element timeslotListElement = this.copyFileProcessor.toXml("timeslotList", doc, stack); //<timeslotList> + meetingElement.appendChild(timeslotListElement); + + List<SignupTimeslot> timeslots = meeting.getSignupTimeSlots(); //get the timeslots + + //adds timeslots to timeslotList + for (int j = 0; j < timeslots.size(); j++) { + SignupTimeslot timeslot = timeslots.get(j); + List<SignupAttendee> attendees = timeslot.getAttendees(); + + Element timeslotElement = CopyFileProcessor.timeslotToXml(timeslot, doc, stack); //<timeslot> + timeslotListElement.appendChild(timeslotElement); + + if(attendees.size() > 0){ + Element attendeeListElement = this.copyFileProcessor.toXml("attendeeList", doc, stack); //<attendeeList> + timeslotElement.appendChild(attendeeListElement); + + //adds attendees and attendeeIds + for (int q = 0; q < attendees.size(); q++){ + SignupAttendee attendee = (SignupAttendee) attendees.get(q); + Element attendeeElement = this.copyFileProcessor.toXml("attendee", doc, stack); //<attendee> + Element attendeeIdElement = this.copyFileProcessor.toXml("attendeeId", doc, stack); //<attendeeId> + Element attendeeSiteIdElement = this.copyFileProcessor.toXml("attendeeSiteId", doc, stack); //<attendeeSiteId> + + attendeeIdElement.appendChild(doc.createTextNode(attendee.getAttendeeUserId())); + attendeeSiteIdElement.appendChild(doc.createTextNode(attendee.getSignupSiteId())); + attendeeElement.appendChild(attendeeIdElement); + attendeeElement.appendChild(attendeeSiteIdElement); + attendeeListElement.appendChild(attendeeElement); + } //attendee loop end + } //if any attendee end + } //timeslot loop end + + //if there are any attachments + if(meeting.hasSignupAttachments()){ + Element attachmentListElement = this.copyFileProcessor.toXml("attachmentList", doc, stack); //<attachmentList> + List<SignupAttachment> allAttachments = meeting.getSignupAttachments(); + meetingElement.appendChild(attachmentListElement); + + //adds attachments + for(int m = 0; m < allAttachments.size(); m++){ + SignupAttachment attachment = allAttachments.get(m); + + Element attachmentElement = this.copyFileProcessor.toXml("attachment", doc, stack); //<attachment> + Element attachmentUrlElement = this.copyFileProcessor.toXml("attachmentUrl", doc, stack); //<attachmentUrl> + Element attachmentName = this.copyFileProcessor.toXml("attachmentName", doc, stack); //<attachmentName> + attachmentUrlElement.appendChild(doc.createTextNode(attachment.getResourceId())); + attachmentName.appendChild(doc.createTextNode(attachment.getFilename())); + attachmentElement.appendChild(attachmentUrlElement); + attachmentElement.appendChild(attachmentName); + attachmentListElement.appendChild(attachmentElement); + } + } + + List<SignupSite> allSitesInMeeting = meeting.getSignupSites(); + + Element availableToElement = this.copyFileProcessor.toXml("availableTo", doc, stack); //<availableTo> + Element siteListElement = this.copyFileProcessor.toXml("siteList", doc, stack); //<siteList> + availableToElement.appendChild(siteListElement); + meetingElement.appendChild(availableToElement); + + for(int n = 0; n < allSitesInMeeting.size(); n++){ + SignupSite site = allSitesInMeeting.get(n); + + Element siteElement = this.copyFileProcessor.toXml("site", doc, stack); //<site> + Element siteIdElement = this.copyFileProcessor.toXml("siteId", doc, stack); //<siteId> + siteIdElement.appendChild(doc.createTextNode(site.getSiteId())); + siteElement.appendChild(siteIdElement); + siteListElement.appendChild(siteElement); + + //if there are groups + if(site.getSignupGroups().size() > 0){ + List<SignupGroup> allGroupsInSite = site.getSignupGroups(); + Element groupListElement = this.copyFileProcessor.toXml("groupList", doc, stack); //<groupList> + siteElement.appendChild(groupListElement); + + //adds groups + for(int g = 0; g < allGroupsInSite.size(); g++){ + SignupGroup group = allGroupsInSite.get(g); + + Element groupElement = this.copyFileProcessor.toXml("group", doc, stack); //<group> + Element groupIdElement = this.copyFileProcessor.toXml("groupId", doc, stack); //<groupId> + + groupIdElement.appendChild(doc.createTextNode(group.getGroupId())); + groupElement.appendChild(groupIdElement); + groupListElement.appendChild(groupElement); + } + } //signupGroups if end + } //allSites for-loop end + + //add meetings to root + meetingListElement.appendChild(meetingElement); + rootElement.appendChild(meetingListElement); + + } catch (Exception e) { + log.warn(e.getMessage()); + } + } //main for-loop end + } + stack.pop(); + return results.toString(); + } //archive end + + @Override + public String merge(String siteId, Element root, String archivePath, + String fromSiteId, Map attachmentNames, Map userIdTrans, + Set userListAllowImport) { + log.warn("Currently, Sign-up tool site archive will not support merging functionality from archive data into a site"); + return null; + } + + @Override + public boolean parseEntityReference(String reference, Reference ref) { + // TODO Auto-generated method stub + return false; + } + + @Override + public String getEntityDescription(Reference ref) { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResourceProperties getEntityResourceProperties(Reference ref) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Entity getEntity(Reference ref) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getEntityUrl(Reference ref) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Collection getEntityAuthzGroups(Reference ref, String userId) { + // TODO Auto-generated method stub + return null; + } + + @Override + public HttpAccess getHttpAccess() { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/HtmlSortHeaderRenderer.java b/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/HtmlSortHeaderRenderer.java index abf419841208..9744a9f67e2f 100644 --- a/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/HtmlSortHeaderRenderer.java +++ b/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/HtmlSortHeaderRenderer.java @@ -1,108 +1,107 @@ -/* -* Licensed to The Apereo Foundation under one or more contributor license -* agreements. See the NOTICE file distributed with this work for -* additional information regarding copyright ownership. -* -* The Apereo Foundation licenses this file to you 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: -* -* http://opensource.org/licenses/ecl2.txt -* -* 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.sakaiproject.signup.tool.jsf; - -import java.io.IOException; - -import javax.faces.component.UIComponent; -import javax.faces.component.html.HtmlGraphicImage; -import javax.faces.context.FacesContext; -import javax.faces.context.ResponseWriter; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.myfaces.component.UserRoleUtils; -import org.apache.myfaces.component.html.ext.HtmlDataTable; -import org.apache.myfaces.custom.sortheader.HtmlCommandSortHeader; -import org.apache.myfaces.shared_tomahawk.renderkit.html.HTML; -import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlLinkRendererBase; - -/** - * Based on org.apache.myfaces.custom.sortheader.HtmlSortHeaderRenderer. - * Modified to better distinguish the current sort column and to use an image file - * to indicate direction. - */ -public class HtmlSortHeaderRenderer extends HtmlLinkRendererBase { - private static final Log log = LogFactory - .getLog(HtmlSortHeaderRenderer.class); - public final static String CURRENT_SORT_STYLE = "currentSort"; - public final static String NOT_CURRENT_SORT_STYLE = "notCurrentSort"; - - public void encodeBegin(FacesContext facesContext, UIComponent component) - throws IOException { - // If this is a currently sorted sort header, always give it the "currentSort" CSS style class - if (component instanceof HtmlCommandSortHeader) { - HtmlCommandSortHeader sortHeader = (HtmlCommandSortHeader)component; - String styleClass = StringUtils.trimToNull(getStyleClass(facesContext, component)); - String newStyleClass; - String unStyleClass; - if (sortHeader.findParentDataTable().getSortColumn().equals(sortHeader.getColumnName())) { - newStyleClass = CURRENT_SORT_STYLE; - unStyleClass = NOT_CURRENT_SORT_STYLE; - } else { - newStyleClass = NOT_CURRENT_SORT_STYLE; - unStyleClass = CURRENT_SORT_STYLE; - } - if (StringUtils.indexOf(styleClass, newStyleClass) == -1) { - if (StringUtils.indexOf(styleClass, unStyleClass) != -1) { - styleClass = StringUtils.replace(styleClass, unStyleClass, newStyleClass); - } else if (styleClass != null) { - styleClass = (new StringBuilder(styleClass)).append(' ').append(newStyleClass).toString(); - } else { - styleClass = newStyleClass; - } - sortHeader.setStyleClass(styleClass); - } - } - super.encodeBegin(facesContext, component); //check for NP - } - - public void encodeEnd(FacesContext facesContext, UIComponent component) - throws IOException { - if (log.isDebugEnabled()) log.debug("encodeEnd rendering " + component); - if (!UserRoleUtils.isEnabledOnUserRole(component)) { - super.encodeEnd(facesContext, component); - } else { - HtmlCommandSortHeader sortHeader = (HtmlCommandSortHeader) component; - HtmlDataTable dataTable = sortHeader.findParentDataTable(); - - if (sortHeader.isArrow() && sortHeader.getColumnName().equals(dataTable.getSortColumn())) { - ResponseWriter writer = facesContext.getResponseWriter(); - - writer.write(HTML.NBSP_ENTITY); - - HtmlGraphicImage image = new HtmlGraphicImage(); - if (dataTable.isSortAscending()) { - image.setValue("/library/image/sakai/sortascending.gif"); - } else { - image.setValue("/library/image/sakai/sortdescending.gif"); - } - - writer.startElement(HTML.IMG_ELEM, image); - writer.writeURIAttribute("src", image.getValue(), null); - writer.endElement(HTML.IMG_ELEM); - } - super.encodeEnd(facesContext, component); - } - } -} - - +/* +* Licensed to The Apereo Foundation under one or more contributor license +* agreements. See the NOTICE file distributed with this work for +* additional information regarding copyright ownership. +* +* The Apereo Foundation licenses this file to you 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: +* +* http://opensource.org/licenses/ecl2.txt +* +* 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.sakaiproject.signup.tool.jsf; + +import java.io.IOException; + +import javax.faces.component.UIComponent; +import javax.faces.component.html.HtmlGraphicImage; +import javax.faces.context.FacesContext; +import javax.faces.context.ResponseWriter; + +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.apache.myfaces.component.UserRoleUtils; +import org.apache.myfaces.component.html.ext.HtmlDataTable; +import org.apache.myfaces.custom.sortheader.HtmlCommandSortHeader; +import org.apache.myfaces.shared_tomahawk.renderkit.html.HTML; +import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlLinkRendererBase; + +/** + * Based on org.apache.myfaces.custom.sortheader.HtmlSortHeaderRenderer. + * Modified to better distinguish the current sort column and to use an image file + * to indicate direction. + */ +public class HtmlSortHeaderRenderer extends HtmlLinkRendererBase { + private static final Logger log = LoggerFactory.getLogger(HtmlSortHeaderRenderer.class); + public final static String CURRENT_SORT_STYLE = "currentSort"; + public final static String NOT_CURRENT_SORT_STYLE = "notCurrentSort"; + + public void encodeBegin(FacesContext facesContext, UIComponent component) + throws IOException { + // If this is a currently sorted sort header, always give it the "currentSort" CSS style class + if (component instanceof HtmlCommandSortHeader) { + HtmlCommandSortHeader sortHeader = (HtmlCommandSortHeader)component; + String styleClass = StringUtils.trimToNull(getStyleClass(facesContext, component)); + String newStyleClass; + String unStyleClass; + if (sortHeader.findParentDataTable().getSortColumn().equals(sortHeader.getColumnName())) { + newStyleClass = CURRENT_SORT_STYLE; + unStyleClass = NOT_CURRENT_SORT_STYLE; + } else { + newStyleClass = NOT_CURRENT_SORT_STYLE; + unStyleClass = CURRENT_SORT_STYLE; + } + if (StringUtils.indexOf(styleClass, newStyleClass) == -1) { + if (StringUtils.indexOf(styleClass, unStyleClass) != -1) { + styleClass = StringUtils.replace(styleClass, unStyleClass, newStyleClass); + } else if (styleClass != null) { + styleClass = (new StringBuilder(styleClass)).append(' ').append(newStyleClass).toString(); + } else { + styleClass = newStyleClass; + } + sortHeader.setStyleClass(styleClass); + } + } + super.encodeBegin(facesContext, component); //check for NP + } + + public void encodeEnd(FacesContext facesContext, UIComponent component) + throws IOException { + if (log.isDebugEnabled()) log.debug("encodeEnd rendering " + component); + if (!UserRoleUtils.isEnabledOnUserRole(component)) { + super.encodeEnd(facesContext, component); + } else { + HtmlCommandSortHeader sortHeader = (HtmlCommandSortHeader) component; + HtmlDataTable dataTable = sortHeader.findParentDataTable(); + + if (sortHeader.isArrow() && sortHeader.getColumnName().equals(dataTable.getSortColumn())) { + ResponseWriter writer = facesContext.getResponseWriter(); + + writer.write(HTML.NBSP_ENTITY); + + HtmlGraphicImage image = new HtmlGraphicImage(); + if (dataTable.isSortAscending()) { + image.setValue("/library/image/sakai/sortascending.gif"); + } else { + image.setValue("/library/image/sakai/sortdescending.gif"); + } + + writer.startElement(HTML.IMG_ELEM, image); + writer.writeURIAttribute("src", image.getValue(), null); + writer.endElement(HTML.IMG_ELEM); + } + super.encodeEnd(facesContext, component); + } + } +} + + diff --git a/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/NewSignupMeetingBean.java b/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/NewSignupMeetingBean.java index 2e7199473c3a..42d2792b01de 100644 --- a/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/NewSignupMeetingBean.java +++ b/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/NewSignupMeetingBean.java @@ -1,2198 +1,2198 @@ -/* -* Licensed to The Apereo Foundation under one or more contributor license -* agreements. See the NOTICE file distributed with this work for -* additional information regarding copyright ownership. -* -* The Apereo Foundation licenses this file to you 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: -* -* http://opensource.org/licenses/ecl2.txt -* -* 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.sakaiproject.signup.tool.jsf; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.List; - -import javax.faces.component.UIData; -import javax.faces.component.UIInput; -import javax.faces.component.html.HtmlInputHidden; -import javax.faces.event.ActionEvent; -import javax.faces.event.ValueChangeEvent; -import javax.faces.model.SelectItem; -import javax.faces.context.FacesContext; -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.sakaiproject.exception.IdUnusedException; -import org.sakaiproject.exception.PermissionException; -import org.sakaiproject.signup.logic.SakaiFacade; -import org.sakaiproject.signup.logic.SignupMeetingService; -import org.sakaiproject.signup.logic.SignupMessageTypes; -import org.sakaiproject.signup.logic.SignupUser; -import org.sakaiproject.signup.model.MeetingTypes; -import org.sakaiproject.signup.model.SignupAttachment; -import org.sakaiproject.signup.model.SignupAttendee; -import org.sakaiproject.signup.model.SignupMeeting; -import org.sakaiproject.signup.model.SignupSite; -import org.sakaiproject.signup.model.SignupTimeslot; -import org.sakaiproject.signup.tool.jsf.attachment.AttachmentHandler; -import org.sakaiproject.signup.tool.jsf.organizer.UserDefineTimeslotBean; -import org.sakaiproject.signup.tool.jsf.organizer.action.CreateMeetings; -import org.sakaiproject.signup.tool.jsf.organizer.action.CreateSitesGroups; -import org.sakaiproject.signup.tool.util.SignupBeanConstants; -import org.sakaiproject.signup.tool.util.Utilities; -import org.sakaiproject.site.api.Site; -import org.sakaiproject.user.api.User; -import org.sakaiproject.user.api.UserNotDefinedException; - -/** - * <p> - * This JSF UIBean class will handle the creation of different types of - * event/meeting by Organizer It provides all the necessary business logic for - * this process. - * - * @author Peter Liu - * - * </P> - */ -public class NewSignupMeetingBean implements MeetingTypes, SignupMessageTypes, SignupBeanConstants { - - private SignupMeetingService signupMeetingService; - - private SignupMeeting signupMeeting; - - private SakaiFacade sakaiFacade; - - private HtmlInputHidden currentStepHiddenInfo; - - private boolean unlimited; - - private int numberOfSlots; - - private int numberOfAttendees; - - private int maxOfAttendees; - - private int timeSlotDuration; - - private boolean recurrence; - - private String signupBeginsType; - - //Location selected from the dropdown - private String selectedLocation; - - //New Location added in the editable field - private String customLocation; - - private List<SelectItem> locations=null; - - //Category selected from the dropdown - private String selectedCategory; - - //New Category added in the editable field - private String customCategory; - - private List<SelectItem> categories = null; - - private String repeatType; - - private Date repeatUntil; - - /* 0 for num of repeat, 1 for date choice*/ - private String recurLengthChoice; - - private int occurrences; - - private boolean assignParicitpantsToAllRecurEvents = false; - - /* sign up can start before this minutes/hours/days */ - private int signupBegins; - - private String deadlineTimeType; - - /* sign up deadline before this minutes/hours/days */ - - private int deadlineTime; - - private SignupSiteWrapper currentSite; - - private List<SignupSiteWrapper> otherSites; - - private static boolean DEFAULT_SEND_EMAIL = "true".equalsIgnoreCase(Utilities.getSignupConfigParamVal("signup.default.email.notification", "true")) ? true : false; - - protected boolean sendEmail = DEFAULT_SEND_EMAIL; - - private boolean receiveEmail; - - private boolean sendEmailByOwner; - - private static boolean DEFAULT_ALLOW_WAITLIST = "true".equalsIgnoreCase(Utilities.getSignupConfigParamVal("signup.default.allow.waitlist", "true")) ? true : false; - - private static boolean DEFAULT_ALLOW_COMMENT = "true".equalsIgnoreCase(Utilities.getSignupConfigParamVal("signup.default.allow.comment", "true")) ? true : false; - - private static boolean DEFAULT_AUTO_RIMINDER = "true".equalsIgnoreCase(Utilities.getSignupConfigParamVal("signup.event.default.auto.reminder", "true")) ? true : false; - - private static boolean DEFAULT_AUTO_RMINDER_OPTION_CHOICE = "true".equalsIgnoreCase(Utilities.getSignupConfigParamVal("signup.autoRiminder.option.choice.setting", "true")) ? true : false; - - private static boolean DEFAULT_USERID_INPUT_MODE_OPTION_CHOICE = "true".equalsIgnoreCase(Utilities.getSignupConfigParamVal("signup.userId.inputMode.choiceOption.setting", "true")) ? true : false; - - private static boolean DEFAULT_EXPORT_TO_CALENDAR_TOOL = "true".equalsIgnoreCase(Utilities.getSignupConfigParamVal("signup.default.export.to.calendar.setting", "true")) ? true : false; - - private static boolean DEFAULT_CREATE_GROUPS = "true".equalsIgnoreCase(Utilities.getSignupConfigParamVal("signup.default.create.groups.setting", "true")) ? true : false; - - protected static boolean NEW_MEETING_SEND_EMAIL = "true".equalsIgnoreCase(Utilities.getSignupConfigParamVal( - "signup.email.notification.mandatory.for.newMeeting", "true")) ? true : false; - - private boolean mandatorySendEmail = NEW_MEETING_SEND_EMAIL; - - private String sendEmailToSelectedPeopleOnly = SEND_EMAIL_ONLY_ORGANIZER_COORDINATORS; - - private boolean publishToCalendar = DEFAULT_EXPORT_TO_CALENDAR_TOOL; - - private boolean createGroups = DEFAULT_CREATE_GROUPS; - - private boolean allowWaitList = DEFAULT_ALLOW_WAITLIST; - - private boolean allowComment = DEFAULT_ALLOW_COMMENT; - - private boolean autoReminder = DEFAULT_AUTO_RIMINDER; - - private boolean autoReminderOptionChoice = DEFAULT_AUTO_RMINDER_OPTION_CHOICE; - - private boolean userIdInputModeOptionChoice = DEFAULT_USERID_INPUT_MODE_OPTION_CHOICE; - - private List<TimeslotWrapper> timeSlotWrappers; - - private List<SelectItem> meetingTypeRadioBttns; - - List<SignupUser> allSignupUsers; - - List<SignupUser> allPossibleCoordinators; - - private List<SelectItem> allAttendees; - - private UIInput newAttendeeInput; - - /* proxy param */ - private String eidOrEmailInputByUser; - - private UIData timeslotWrapperTable; - - private boolean showParticipants; - - private boolean validationError; - - private boolean eidInputMode = false; - - private Boolean publishedSite; - - private boolean endTimeAutoAdjusted=false; - - private List<SignupAttachment> attachments; - - private AttachmentHandler attachmentHandler; - - private UserDefineTimeslotBean userDefineTimeslotBean; - - //discontinued time slots case - private List<TimeslotWrapper> customTimeSlotWrpList; - - private boolean otherSitesAvailability; - - private boolean userDefinedTS=false; - - private String creatorUserId; - - private int maxSlots; - - private int maxAttendeesPerSlot; - - private Log logger = LogFactory.getLog(getClass()); - - /* used for jsf parameter passing */ - private final static String PARAM_NAME_FOR_ATTENDEE_USERID = "attendeeUserId"; - - /* to remember the number of the meeting slots */ - private int maxNumOfSlots; - /* Used for populate the drop down box for the allowed number of meeting slots */ - private List<SelectItem> slots; - - public int getMaxNumOfSlots() { - return maxNumOfSlots; - } - - public void setMaxNumOfSlots(int preferredSlot) { - this.maxNumOfSlots = preferredSlot; - } - - public List<SelectItem> getSlots(){ - - slots = new ArrayList<SelectItem>(); - for (int i =1; i <= numberOfSlots;i++) slots.add(new SelectItem(i, i+"")); - return slots; - } - - public String getCurrentUserDisplayName() { - return sakaiFacade.getUserDisplayName(sakaiFacade.getCurrentUserId()); - } - - public String getselectedLocation() { - return selectedLocation; - } - - public void setselectedLocation(String selectedLocation) { - this.selectedLocation = selectedLocation; - } - - public String getcustomLocation() { - return customLocation; - } - - public void setcustomLocation(String customLocation) { - this.customLocation = customLocation; - } - - public String getselectedCategory() { - return selectedCategory; - } - - public void setselectedCategory(String selectedCategory) { - this.selectedCategory = selectedCategory; - } - - public String getcustomCategory() { - return customCategory; - } - - public void setcustomCategory(String customCategory) { - this.customCategory = customCategory; - } - - public String getCreatorUserId() { - if(this.creatorUserId ==null){ - //set current user as default meeting organizer if case people forget to select one - return sakaiFacade.getCurrentUserId(); - } - return creatorUserId; - } - - public void setCreatorUserId(String creatorUserId) { - this.creatorUserId = creatorUserId; - } - - public boolean isOtherSitesAvailability() { - - //checking for tool property, if it doesn't exist,take value as default - String toolProperty = sakaiFacade.getToolManager().getCurrentPlacement().getConfig().getProperty("signup.other.sites.availability", "default"); - if (toolProperty.equals("default")) { - //If tool property is not set, then consider sakai property - String sakaiProperty = Boolean.valueOf(sakaiFacade.getServerConfigurationService().getBoolean("signup.otherSitesAvailability", true)).toString(); - toolProperty = sakaiProperty; - } - //tool property would take precedence over sakai property - otherSitesAvailability= "false".equalsIgnoreCase(toolProperty)? false : true; - return otherSitesAvailability; - } - - public void setOtherSitesAvailability(boolean otherSitesAvailability) { - this.otherSitesAvailability = otherSitesAvailability; - } - - /** - * @return the maxSlots - */ - public int getMaxSlots() { - String maxSlotsStringVal = Utilities.getSignupConfigParamVal("signup.maxSlots", "500"); - try{ - maxSlots = Integer.parseInt(maxSlotsStringVal); - } - catch (Exception e){ - maxSlots = 500; - } - return maxSlots; - } - - /** - * @param maxSlots the maxSlots to set - */ - public void setMaxSlots(int maxSlots) { - this.maxSlots = maxSlots; - } - - /** - * @return the maxAttendeesPerSlot - */ - public int getMaxAttendeesPerSlot() { - String maxAttendeesStringVal = Utilities.getSignupConfigParamVal("signup.maxAttendeesPerSlot", "500"); - try{ - maxAttendeesPerSlot = Integer.parseInt(maxAttendeesStringVal); - } - catch(Exception e){ - maxAttendeesPerSlot=500; - } - return maxAttendeesPerSlot; - } - - /** - * @param maxAttendeesPerSlot the maxAttendeesPerSlot to set - */ - public void setMaxAttendeesPerSlot(int maxAttendeesPerSlot) { - this.maxAttendeesPerSlot = maxAttendeesPerSlot; - } - - - /** - * The default Constructor. It will initialize all the required variables. - * - */ - public NewSignupMeetingBean() { - init(); - } - - public String getRepeatType() { - return repeatType; - } - - public Date getRepeatUntil() { - return repeatUntil; - } - - public void setRepeatType(String repeatType) { - this.repeatType = repeatType; - } - - public void setRepeatUntil(Date repeatUntil) { - this.repeatUntil = repeatUntil; - } - - /** Initialize all the default setting for creating new events. */ - private void init() { - - signupMeeting = new SignupMeeting(); - signupMeeting.setMeetingType(INDIVIDUAL); - - Date date = new Date(); - Calendar startCal = Calendar.getInstance(); - startCal.setTime(date); - startCal.set(Calendar.MINUTE, 0); - startCal.set(Calendar.SECOND, 0); - startCal.set(Calendar.MILLISECOND, 0); - signupMeeting.setStartTime(startCal.getTime()); - - Calendar endCal = startCal; - endCal.add(Calendar.HOUR, 1); - signupMeeting.setEndTime(endCal.getTime()); - - unlimited = false; - recurrence = false; - assignParicitpantsToAllRecurEvents = false; - numberOfSlots = 4; - numberOfAttendees = 1; - maxOfAttendees = 10; - timeSlotDuration = 0; // minutes - signupBegins = 6; - deadlineTime = 1; - signupBeginsType = Utilities.DAYS; - deadlineTimeType = Utilities.HOURS; - validationError = false; - sendEmail = DEFAULT_SEND_EMAIL; - if(NEW_MEETING_SEND_EMAIL){ - sendEmail = NEW_MEETING_SEND_EMAIL; - } - sendEmailToSelectedPeopleOnly=SEND_EMAIL_ONLY_ORGANIZER_COORDINATORS; - receiveEmail = false; - sendEmailByOwner= DEFAULT_SEND_EMAIL; /*will be inherited per meeting basis*/ - allowComment = DEFAULT_ALLOW_COMMENT; - allowWaitList = DEFAULT_ALLOW_WAITLIST; - autoReminder = DEFAULT_AUTO_RIMINDER; - publishToCalendar= DEFAULT_EXPORT_TO_CALENDAR_TOOL; - createGroups = DEFAULT_CREATE_GROUPS; - currentStepHiddenInfo = null; - eidInputMode = false; - repeatType = ONCE_ONLY; - repeatUntil = startCal.getTime(); - recurLengthChoice="1";//0 for num of repeat, 1 for date choice - occurrences=0; - this.publishedSite = null; - //Custom defined time slots allocation - userDefinedTS=false; - customTimeSlotWrpList=null; - otherSitesAvailability = true; - creatorUserId = null; - - /*cleanup unused attachments in CHS*/ - if(this.attachments !=null && this.attachments.size()>0){ - for (SignupAttachment attach : attachments) { - getAttachmentHandler().removeAttachmentInContentHost(attach); - } - this.attachments.clear(); - } - else - this.attachments = new ArrayList<SignupAttachment>(); - } - - public void reset() { - init(); - signupBeginsType = Utilities.DAYS; - deadlineTimeType = Utilities.HOURS; - signupBegins = 6; - deadlineTime = 1; - timeSlotWrappers = null; - currentSite = null; - otherSites = null; - /* for main meetingpage */ - Utilities.resetMeetingList(); - this.eidOrEmailInputByUser = null; - this.selectedLocation=null; - this.customLocation=""; - this.selectedCategory=null; - this.customCategory=""; - this.creatorUserId=null; - this.locations=null; - this.categories=null; - /*clean up everything in getUserDefineTimeslotBean*/ - getUserDefineTimeslotBean().reset(UserDefineTimeslotBean.NEW_MEETING); - } - - /** - * This method is called to get all locations to populate the dropdown, for new signup creation. - * - * @return list of allLocations - */ - public List<SelectItem> getAllLocations(){ - if(locations ==null){ - locations = new ArrayList<SelectItem>(); - locations.addAll(Utilities.getSignupMeetingsBean().getAllLocations()); - locations.add(0, new SelectItem(Utilities.rb.getString("select_location"))); - } - - return locations; - } - - /** - * This method is called to get all categories to populate the dropdown, for new signup creation. - * - * @return list of categories - */ - public List<SelectItem> getAllCategories(){ - if(categories ==null){ - categories = new ArrayList<SelectItem>(); - categories.addAll(Utilities.getSignupMeetingsBean().getAllCategories()); - categories.remove(0);//remove the 'All' default value from the list - categories.add(0, new SelectItem(Utilities.rb.getString("select_category"))); - } - return categories; - } - - /** - * This is a JSF action call method by UI to navigate to the next page. - * - * @return an action outcome string. - */ - public String goNext() { - if (validationError) { - validationError = false; - return ADD_MEETING_STEP1_PAGE_URL; - } - - String step = (String) currentStepHiddenInfo.getValue(); - if (step.equals("step1")) { - /* - * let recalculate the duration just in case of meeting endTime - * changes - */ - setTimeSlotDuration(0); - if(isUserDefinedTS()){ - /*get the timeslots schedules for further process*/ - if(!Utilities.isDataIntegritySafe(isUserDefinedTS(),UserDefineTimeslotBean.NEW_MEETING,getUserDefineTimeslotBean())) - return ADD_MEETING_STEP1_PAGE_URL; - - this.customTimeSlotWrpList=getUserDefineTimeslotBean().getDestTSwrpList(); - } - - return ADD_MEETING_STEP2_PAGE_URL; - } - - return ADD_MEETING_STEP1_PAGE_URL; - } - - /** - * This method is called by JSP page for adding/removing attachments action. - * @return null. - */ - public String addRemoveAttachments(){ - getAttachmentHandler().processAddAttachRedirect(this.attachments, this.signupMeeting,true); - return null; - } - - /** - * Create a new time slot blocks - * @return String object for the next page url - */ - public String createUserDefTimeSlots(){ - /* initially get the data from automatic time-slot creation as default*/ - this.timeSlotDuration = 0;//reset the value - this.customTimeSlotWrpList = timeSlotWrappers(); - getUserDefineTimeslotBean().init(this.signupMeeting, ADD_MEETING_STEP1_PAGE_URL,this.customTimeSlotWrpList, UserDefineTimeslotBean.NEW_MEETING); - return CUSTOM_DEFINED_TIMESLOT_PAGE_URL; - } - - /** - * Modify the existing time slot blocks - * @return String object for next page url - */ - public String editUserDefTimeSlots(){ - if(!Utilities.isDataIntegritySafe(isUserDefinedTS(),UserDefineTimeslotBean.NEW_MEETING,getUserDefineTimeslotBean())){ - reset(); - return ADD_MEETING_STEP1_PAGE_URL; - } - - this.customTimeSlotWrpList = getUserDefineTimeslotBean().getDestTSwrpList(); - getUserDefineTimeslotBean().init(this.signupMeeting, ADD_MEETING_STEP1_PAGE_URL,this.customTimeSlotWrpList, UserDefineTimeslotBean.NEW_MEETING); - return CUSTOM_DEFINED_TIMESLOT_PAGE_URL; - } - - /*Make sure the start/end time input fields have values.*/ - public boolean getPrePopulateValues(){ - if (this.signupMeeting.getStartTime() == null && isUserDefinedTS()){ - this.signupMeeting.setStartTime(getUserDefineTimeslotBean().getEventStartTime()); - this.signupMeeting.setEndTime(getUserDefineTimeslotBean().getEventEndTime()); - } - return false; - } - - /** - * This is a validator to make sure that the event/meeting starting time is - * before ending time. - * - * @param e - * an ActionEvent object. - */ - - public void validateNewMeeting(ActionEvent e) { - if(currentStepHiddenInfo == null) - return; - - String step = (String) currentStepHiddenInfo.getValue(); - - if (step.equals("step1")) { - - boolean locationSet = false; - - //Set Location - if (StringUtils.isNotBlank(customLocation)){ - logger.debug("custom location set: " + customLocation); - this.signupMeeting.setLocation(customLocation); - locationSet = true; - } - - if (!locationSet && StringUtils.isNotBlank(selectedLocation) && !StringUtils.equals(selectedLocation, Utilities.rb.getString("select_location"))){ - this.signupMeeting.setLocation(selectedLocation); - logger.debug("chose a location: " + selectedLocation); - locationSet = true; - } - - if(!locationSet) { - validationError = true; - Utilities.addErrorMessage(Utilities.rb.getString("event.location_not_assigned")); - return; - } - - - //Set Category - //custom - if (StringUtils.isNotBlank(customCategory)){ - this.signupMeeting.setCategory(customCategory); - } - else{ - //or from the dropdown, but if we don't choose one or left it as the 'choose category method' then don't set it - if (!StringUtils.equals(selectedCategory, Utilities.rb.getString("select_category"))){ - this.signupMeeting.setCategory(selectedCategory); - } - } - - //set instructor - this.signupMeeting.setCreatorUserId(creatorUserId); - - Date eventEndTime = signupMeeting.getEndTime(); - Date eventStartTime = signupMeeting.getStartTime(); - /*user defined own TS case*/ - if(isUserDefinedTS()){ - eventEndTime= getUserDefineTimeslotBean().getEventEndTime(); - eventStartTime = getUserDefineTimeslotBean().getEventStartTime(); - /*pass the value since they are null*/ - this.signupMeeting.setStartTime(eventStartTime); - this.signupMeeting.setEndTime(eventEndTime); - - if(getUserDefineTimeslotBean().getDestTSwrpList()==null || getUserDefineTimeslotBean().getDestTSwrpList().isEmpty()){ - validationError = true; - Utilities.addErrorMessage(Utilities.rb.getString("event.create_custom_defined_TS_blocks")); - return; - } - - } - - if (eventEndTime.before(eventStartTime) || eventStartTime.equals(eventEndTime)) { - validationError = true; - Utilities.addErrorMessage(Utilities.rb.getString("event.endTime_should_after_startTime")); - // signupMeeting.setMeetingType(null); - return; - } - - setRecurrence(false); - if (!(getRepeatType().equals(ONCE_ONLY))) { - int repeatNum = getOccurrences(); - if("1".equals(getRecurLengthChoice())){ - repeatNum = CreateMeetings.getNumOfRecurrence(getRepeatType(), eventStartTime, - getRepeatUntil()); - } - - if ((DAILY.equals(getRepeatType()) || WEEKDAYS.equals(getRepeatType())) && isMeetingOverRepeatPeriod(eventStartTime, eventEndTime, 1)) { - validationError = true; - Utilities.addErrorMessage(Utilities.rb.getString("crossDay.event.repeat.daily.problem")); - return; - } - - if (WEEKLY.equals(getRepeatType()) && isMeetingOverRepeatPeriod(eventStartTime, eventEndTime, 7)) { - validationError = true; - Utilities.addErrorMessage(Utilities.rb.getString("crossDay.event.repeat.weekly.problem")); - return; - } - - if (BIWEEKLY.equals(getRepeatType()) && isMeetingOverRepeatPeriod(eventStartTime, eventEndTime, 14)) { - validationError = true; - Utilities.addErrorMessage(Utilities.rb.getString("crossDay.event.repeat.biweekly.problem")); - return; - } - // TODO need to check for weekly too? - - if (repeatNum < 1) { - validationError = true; - if("1".equals(getRecurLengthChoice())) - Utilities.addErrorMessage(Utilities.rb.getString("event.repeatbeforestart")); - else - Utilities.addErrorMessage(Utilities.rb.getString("event.repeatNnum.bigger.than.one")); - - return; - } - setRecurrence(true); - } - - warnMeetingAccrossTwoDates(eventEndTime, eventStartTime); - - if (!CreateSitesGroups.isAtleastASiteOrGroupSelected(this.getCurrentSite(), this.getOtherSites())) { - validationError = true; - Utilities.addErrorMessage(Utilities.rb.getString("select.atleast.oneGroup")); - - } - - if (signupMeeting.getMeetingType() == null) { - validationError = true; - Utilities.addErrorMessage(Utilities.rb.getString("signup.validator.selectMeetingType")); - // signupMeeting.setMeetingType(null); - - } - - /*give warning to user in the next page if the event ending time get auto adjusted due to not even-division - * and it's not the case for custom defined time slot*/ - setEndTimeAutoAdjusted(false); - if(!isUserDefinedTS()){ - if (isIndividualType() && getNumberOfSlots()!=0) { - double duration = (double)(getSignupMeeting().getEndTime().getTime() - getSignupMeeting().getStartTime().getTime()) - / (double)(MINUTE_IN_MILLISEC * getNumberOfSlots()); - if (duration != Math.floor(duration)){ - setEndTimeAutoAdjusted(true); - Utilities.addErrorMessage(Utilities.rb.getString("event_endtime_auto_adjusted_warning")); - } - } - } - - /*for custom time slot case*/ - if(!validationError && isUserDefinedTS()){ - this.signupMeeting.setStartTime(eventStartTime); - this.signupMeeting.setEndTime(eventEndTime); - this.signupMeeting.setMeetingType(CUSTOM_TIMESLOTS); - } - /*reset meetingType for step1 */ - if(!isUserDefinedTS() && CUSTOM_TIMESLOTS.equals(this.signupMeeting.getMeetingType())){ - this.signupMeeting.setMeetingType(INDIVIDUAL); - } - - /*pre-load all possible coordinators for step2*/ - signupMeeting.setSignupSites(CreateSitesGroups.getSelectedSignupSites(getCurrentSite(), getOtherSites())); - this.allPossibleCoordinators = this.sakaiFacade.getAllPossbileCoordinatorsOnFastTrack(this.signupMeeting); - - // tick the creator by default (SIGNUP-216) - for(SignupUser u: this.allPossibleCoordinators) { - if(StringUtils.equals(u.getInternalUserId(), this.creatorUserId)) { - u.setChecked(true); - } - } - - } - } - - private void warnMeetingAccrossTwoDates(Date endTime, Date startTime) { - Calendar calendar = Calendar.getInstance(); - calendar.setTime(startTime); - int startYear = calendar.get(Calendar.YEAR); - int startMonth = calendar.get(Calendar.MONTH); - int startDay = calendar.get(Calendar.DATE); - - calendar.setTime(endTime); - int endYear = calendar.get(Calendar.YEAR); - int endMonth = calendar.get(Calendar.MONTH); - int endDay = calendar.get(Calendar.DATE); - if (startYear != endYear){ - Utilities.addInfoMessage(Utilities.rb.getString("warning.event.crossed_twoYears")); - return; - } - if (startMonth != endMonth){ - Utilities.addInfoMessage(Utilities.rb.getString("warning.event.crossed_twoMonths")); - return; - } - if (startDay != endDay){ - Utilities.addInfoMessage(Utilities.rb.getString("warning.event.crossed_twoDays")); - return; - } - - } - - /*private boolean isMeetingLengthOver24Hours(SignupMeeting sm){ - long duration= sm.getEndTime().getTime()- sm.getStartTime().getTime(); - if( 24 - duration /(MINUTE_IN_MILLISEC * Hour_In_MINUTES) >= 0 ) - return false; - - return true; - }*/ - - private boolean isMeetingOverRepeatPeriod(Date startTime, Date endTime, int repeatPeriodInDays){ - long duration= endTime.getTime()- startTime.getTime(); - if( 24*repeatPeriodInDays - duration /(MINUTE_IN_MILLISEC * Hour_In_MINUTES) >= 0 ) - return false; - - return true; - } - - /** - * This is a JSF action call method by UI to let user navigate one page - * back. - * - * @return an action outcome string. - */ - public String goBack() { - if(currentStepHiddenInfo == null){ - //it is rarely happening if any - Utilities.addErrorMessage(Utilities.rb.getString("publish.withAttendee.exception")); - //recover this from "assignAttendee" step case too - //reset to remove timeslots info with attendees - timeSlotWrappers = null; - assignParicitpantsToAllRecurEvents = false; - //reset warning for ending time auto-adjustment - setEndTimeAutoAdjusted(false); - return ADD_MEETING_STEP1_PAGE_URL; - } - - String step = (String) currentStepHiddenInfo.getValue(); - - if (step.equals("step2")) { - return ADD_MEETING_STEP1_PAGE_URL; - } - if (step.equals("assignAttendee")) { - timeSlotWrappers = null; // reset to remove timeslots info with attendees - assignParicitpantsToAllRecurEvents = false; - //reset warning for ending time auto-adjustment - setEndTimeAutoAdjusted(false); - //reset who should receive emails - //setSendEmailAttendeeOnly(false); - sendEmailToSelectedPeopleOnly = SEND_EMAIL_ONLY_ORGANIZER_COORDINATORS;//reset - - return ADD_MEETING_STEP2_PAGE_URL; - } - - return ADD_MEETING_STEP1_PAGE_URL; - } - - /** - * This is a JSF action call method by UI to let user cancel the action. - * - * @return an action outcome string. - */ - public String processCancel() { - reset(); - return CANCEL_ADD_MEETING_PAGE_URL; - } - - /** - * This is a ValueChange Listener to watch the meeting type selection by - * user. - * - * @param vce - * a ValuechangeEvent object. - * @return a outcome string. - */ - public String processSelectedType(ValueChangeEvent vce) { - String newMeetingType = (String) vce.getNewValue(); - signupMeeting.setMeetingType(newMeetingType); - if(!INDIVIDUAL.equals(newMeetingType)){ - setUserDefinedTS(false); - //this.timeSlotWrappers = null;//reset - } - - return ""; - - } - - /** - * This is a ValueChange Listener to watch changes on the selection of - * 'unlimited attendee' choice by user. - * - * @param vce - * a ValuechangeEvent object. - * @return a outcome string. - */ - public String processGroup(ValueChangeEvent vce) { - Boolean changeValue = (Boolean) vce.getNewValue(); - if (changeValue != null) { - unlimited = changeValue.booleanValue(); - if (unlimited) - maxOfAttendees = 10; - - } - - return ""; - - } - - /** - * This is a JSF action call method by UI to let user to save and create a - * new event/meeting. - * - * @return an action outcome string. - */ - public String processSave() { - if(!Utilities.isDataIntegritySafe(isUserDefinedTS(),UserDefineTimeslotBean.NEW_MEETING,getUserDefineTimeslotBean())){ - reset(); - return ADD_MEETING_STEP1_PAGE_URL; - } - - preSaveAction(); - processSaveMeetings(); - reset(); - return MAIN_EVENTS_LIST_PAGE_URL; - } - - /* Prepare the data for saving action */ - private void preSaveAction() { - //SignupSite sSite = new SignupSite(); - //String currentLocationId = sakaiFacade.getCurrentLocationId(); - //sSite.setSiteId(currentLocationId); - //sSite.setTitle(sakaiFacade.getLocationTitle(currentLocationId)); - //List<SignupSite> signupSites = new ArrayList<SignupSite>(); - //signupSites.add(sSite); - //signupMeeting.setSignupSites(signupSites); - List<SignupTimeslot> slots = timeslots(); - signupMeeting.setSignupTimeSlots(slots); - - Date sBegin = Utilities.subTractTimeToDate(signupMeeting.getStartTime(), getSignupBegins(), - getSignupBeginsType()); - Date sDeadline = Utilities.subTractTimeToDate(signupMeeting.getEndTime(), getDeadlineTime(), - getDeadlineTimeType()); - - // TODO need a better way to warn people? - /* - * if (sBegin.before(new Date())) { // a warning for user - * Utilities.addErrorMessage(Utilities.rb.getString("warning.your.event.singup.begin.time.passed.today.time")); } - */ - signupMeeting.setSignupBegins(sBegin); - // TODO need validate and handle error for case: deadline is before - // sBegin - signupMeeting.setSignupDeadline(sDeadline); - //maybe duplicated, it is already set up after 'step1' - signupMeeting.setSignupSites(CreateSitesGroups.getSelectedSignupSites(getCurrentSite(), getOtherSites())); - - signupMeeting.setCreatorUserId(this.creatorUserId); - signupMeeting.setReceiveEmailByOwner(receiveEmail); - signupMeeting.setSendEmailByOwner(sendEmailByOwner); - signupMeeting.setAllowWaitList(this.allowWaitList); - signupMeeting.setAllowComment(this.allowComment); - signupMeeting.setAutoReminder(this.autoReminder); - signupMeeting.setEidInputMode(this.eidInputMode); - signupMeeting.setMaxNumOfSlots(new Integer(this.maxNumOfSlots)); - signupMeeting.setCoordinatorIds(Utilities.getSelectedCoordinators(this.allPossibleCoordinators,this.creatorUserId)); - /* add attachments */ - signupMeeting.setSignupAttachments(this.attachments); - - signupMeeting.setCreateGroups(this.createGroups); - - } - - /** - * This is a JSF action call method by UI to let user to go to next page, - * which will allow user to pre-assign the attendees into the event/meeting. - * - * @return an action outcome string. - */ - public String proceesPreAssignAttendee() { - if(!Utilities.isDataIntegritySafe(isUserDefinedTS(),UserDefineTimeslotBean.NEW_MEETING,getUserDefineTimeslotBean())){ - reset(); - return ADD_MEETING_STEP1_PAGE_URL; - } - - preSaveAction(); - loadAllAttendees(this.getSignupMeeting()); - return PRE_ASSIGN_ATTENDEE_PAGE_URL; - } - - /** - * This is a JSF action call method by UI to let user to save and publish - * the new event/meeting with pre-assigned attendees. - * - * @return an action outcome string. - */ - public String processAssignStudentsAndPublish() { - preSaveAction(); - processSaveMeetings(); - reset(); - return MAIN_EVENTS_LIST_PAGE_URL; - } - - /** - * This is a JSF action call method by UI to let user add an attendee into - * the page. - * - * @return an action outcome string. - */ - public String addAttendee() { - TimeslotWrapper timeslotWrapper = (TimeslotWrapper) timeslotWrapperTable.getRowData(); - - String attendeeEidOrEmail = null; - if (isEidInputMode()) { - attendeeEidOrEmail = getEidOrEmailInputByUser(); - } else { - attendeeEidOrEmail = (String) newAttendeeInput.getValue(); - } - - if(attendeeEidOrEmail ==null || attendeeEidOrEmail.length() <1) - return PRE_ASSIGN_ATTENDEE_PAGE_URL; - - //check if there are multiple email addresses associated with input - List<String> associatedEids = getEidsForEmail(attendeeEidOrEmail.trim()); - if(associatedEids.size() > 1) { - Utilities.addErrorMessage(MessageFormat.format(Utilities.rb.getString("exception.multiple.eids"), new Object[] {attendeeEidOrEmail, StringUtils.join(associatedEids, ", ")})); - return PRE_ASSIGN_ATTENDEE_PAGE_URL; - } - - String attendeeUserId = getUserIdForEidOrEmail(attendeeEidOrEmail.trim()); - if(StringUtils.isBlank(attendeeEidOrEmail)){ - Utilities.addErrorMessage(Utilities.rb.getString("exception.no.such.user") + attendeeEidOrEmail); - return PRE_ASSIGN_ATTENDEE_PAGE_URL; - } - - SignupUser attendeeSignUser = getSakaiFacade().getSignupUser(this.signupMeeting, attendeeUserId); - if(attendeeSignUser ==null){ - Utilities.addErrorMessage(MessageFormat.format(Utilities.rb.getString("user.has.no.permission.attend"), new Object[] {attendeeEidOrEmail})); - return PRE_ASSIGN_ATTENDEE_PAGE_URL; - } - - SignupAttendee attendee = new SignupAttendee(attendeeUserId, attendeeSignUser.getMainSiteId()); - - if (isDuplicateAttendee(timeslotWrapper.getTimeSlot(), attendee)) { - Utilities.addErrorMessage(Utilities.rb.getString("attendee.already.in.timeslot")); - } else { - timeslotWrapper.addAttendee(attendee, sakaiFacade.getUserDisplayLastFirstName(attendeeUserId)); - } - - return PRE_ASSIGN_ATTENDEE_PAGE_URL; - } - - /** - * This is a JSF action call method by UI to let user remove an attendee - * from the page. - * - * @return an action outcome string. - */ - public String removeAttendee() { - TimeslotWrapper timeslotWrapper = (TimeslotWrapper) timeslotWrapperTable.getRowData(); - String attendeeUserId = Utilities.getRequestParam(PARAM_NAME_FOR_ATTENDEE_USERID); - - timeslotWrapper.removeAttendee(attendeeUserId); - - return ""; - } - - private boolean isDuplicateAttendee(SignupTimeslot timeslot, SignupAttendee newAttendee) { - List<SignupAttendee> attendees = timeslot.getAttendees(); - if (attendees != null && !attendees.isEmpty()) { - for (SignupAttendee attendee : attendees) { - if (attendee.getAttendeeUserId().equals(newAttendee.getAttendeeUserId())) - return true; - } - } - return false; - } - - private List<SignupTimeslot> timeslots() { - List<SignupTimeslot> slots = new ArrayList<SignupTimeslot>(); - List<TimeslotWrapper> timeSlotWrappers = getTimeSlotWrappers(); - - if (timeSlotWrappers == null) - return null;// for Announcement type - - for (TimeslotWrapper wrapper : timeSlotWrappers) { - SignupTimeslot slot = wrapper.getTimeSlot(); - slots.add(slot); - } - return slots; - } - - /** - * This is a getter method for UI. - * - * @return a list of TimeslotWrapper objects. - */ - public List<TimeslotWrapper> getTimeSlotWrappers() { - if (timeSlotWrappers == null) - timeSlotWrappers = timeSlotWrappers(); - - return timeSlotWrappers; - - } - - /* construct the TimeslotWrapper list from the raw data */ - private List<TimeslotWrapper> timeSlotWrappers() { - String meetingType = signupMeeting.getMeetingType(); - Calendar calendar = Calendar.getInstance(); - calendar.setTime(signupMeeting.getStartTime()); - - List<TimeslotWrapper> timeSlotWrappers = new ArrayList<TimeslotWrapper>(); - if (meetingType.equals(INDIVIDUAL)) { - for (int i = 0; i < numberOfSlots; i++) { - SignupTimeslot slot = new SignupTimeslot(); - slot.setMaxNoOfAttendees(numberOfAttendees); - slot.setStartTime(calendar.getTime()); - calendar.add(Calendar.MINUTE, getTimeSlotDuration()); - slot.setEndTime(calendar.getTime()); - slot.setDisplayAttendees(isShowParticipants()); - - TimeslotWrapper wrapper = new TimeslotWrapper(slot); - wrapper.setPositionInTSlist(i); - timeSlotWrappers.add(wrapper); - } - /* set endTime for meeting */ - getMeetingEndTime(); - return timeSlotWrappers; - } - - if (meetingType.equals(GROUP)) { - SignupTimeslot slot = new SignupTimeslot(); - slot.setMaxNoOfAttendees(unlimited ? SignupTimeslot.UNLIMITED : maxOfAttendees); - slot.setStartTime(signupMeeting.getStartTime()); - slot.setEndTime(signupMeeting.getEndTime()); - slot.setDisplayAttendees(isShowParticipants()); - - TimeslotWrapper wrapper = new TimeslotWrapper(slot); - timeSlotWrappers.add(wrapper); - return timeSlotWrappers; - } - - if(meetingType.equals(CUSTOM_TIMESLOTS)){ - List<TimeslotWrapper> tmpTSList = new ArrayList<TimeslotWrapper>(this.customTimeSlotWrpList); - for (TimeslotWrapper tsWrp : tmpTSList) { - tsWrp.getTimeSlot().setDisplayAttendees(isShowParticipants()); - } - return tmpTSList; - } - return null; - } - - /** - * This is a getter method for UI and it provides the time for Signup-begin. - * - * @return a Date object. - */ - public Date getSignupBeginInDate() { - return Utilities.subTractTimeToDate(signupMeeting.getStartTime(), signupBegins, signupBeginsType); - } - - /** - * This is a getter method for UI and it provides the time for - * Signup-Deadline. - * - * @return a Date object. - */ - public Date getSignupDeadlineInDate() { - return Utilities.subTractTimeToDate(signupMeeting.getEndTime(), deadlineTime, deadlineTimeType); - } - - /** - * This is a getter method for UI and it calculates the meeting ending time - * according to meeting type - * - * @return a Date object. - */ - /* */ - public Date getMeetingEndTime() { - if (signupMeeting.getMeetingType().equals(INDIVIDUAL)) { - Calendar calendar = Calendar.getInstance(); - calendar.setTime(signupMeeting.getStartTime()); - int internval = getTimeSlotDuration() * numberOfSlots; - calendar.add(Calendar.MINUTE, internval); - signupMeeting.setEndTime(calendar.getTime()); - return calendar.getTime(); - } - - return signupMeeting.getEndTime(); - } - - /** - * This is a getter method. - * - * @return a SakaiFacade object. - */ - public SakaiFacade getSakaiFacade() { - return sakaiFacade; - } - - /** - * This is a setter. - * - * @param sakaiFacade - * a SakaiFacade object. - */ - public void setSakaiFacade(SakaiFacade sakaiFacade) { - this.sakaiFacade = sakaiFacade; - } - - /** - * This is a getter method. - * - * @return a SignupMeetingService object. - */ - public SignupMeetingService getSignupMeetingService() { - return signupMeetingService; - } - - /** - * This is a setter. - * - * @param signupMeetingService - * a SignupMeetingService object. - */ - public void setSignupMeetingService(SignupMeetingService signupMeetingService) { - this.signupMeetingService = signupMeetingService; - } - - /** - * This is a getter method for UI. - * - * @return a SignupMeeting object. - */ - public SignupMeeting getSignupMeeting() { - return signupMeeting; - } - - /** - * This is a setter for UI. - * - * @param signupMeeting - * a SignupMeeting object. - */ - public void setSignupMeeting(SignupMeeting signupMeeting) { - this.signupMeeting = signupMeeting; - } - - /** - * This is a getter method for UI. - * - * @return a HtmlInputHidden object. - */ - public HtmlInputHidden getCurrentStepHiddenInfo() { - return currentStepHiddenInfo; - } - - /** - * This is a setter for UI. - * - * @param htmlInputHidden - * a HtmlInputHidden object. - */ - public void setCurrentStepHiddenInfo(HtmlInputHidden htmlInputHidden) { - this.currentStepHiddenInfo = htmlInputHidden; - } - - /** - * This is a getter method for UI and check if the event/meeting is - * recurred. - * - * @return true if the event/meeting is recurred. - */ - public boolean isRecurrence() { - return recurrence; - } - - /** - * This is a setter for UI. - * - * @param recurrence - * a boolean value. - */ - public void setRecurrence(boolean recurrence) { - this.recurrence = recurrence; - } - - /** - * This is a getter method for UI. - * - * @return an int value. - */ - public int getMaxOfAttendees() { - if (unlimited) - return SignupTimeslot.UNLIMITED; - - return maxOfAttendees; - } - - /** - * This is a setter for UI. - * - * @param maxOfAttendees - * an int value - */ - public void setMaxOfAttendees(int maxOfAttendees) { - this.maxOfAttendees = maxOfAttendees; - } - - /** - * This is a getter method for UI. - * - * @return a HtmlInputHidden object. - */ - public int getNumberOfSlots() { - return numberOfSlots; - } - - /** - * This is a setter method for UI. - * - * @param numberOfSlots - * an int value - */ - public void setNumberOfSlots(int numberOfSlots) { - this.numberOfSlots = numberOfSlots; - } - - /** - * This is a getter method for UI. - * - * @return a HtmlInputHidden object. - */ - public int getTimeSlotDuration() { - if (this.timeSlotDuration == 0) {// first time - long duration = (getSignupMeeting().getEndTime().getTime() - getSignupMeeting().getStartTime().getTime()) - / (MINUTE_IN_MILLISEC * getNumberOfSlots()); - - setTimeSlotDuration((int) duration); - } - return this.timeSlotDuration; - } - - public void setTimeSlotDuration(int timeSlotDuration) { - this.timeSlotDuration = timeSlotDuration; - } - - /** - * This is a getter method for UI. - * - * @return an int value. - */ - public int getNumberOfAttendees() { - return numberOfAttendees; - } - - /** - * This is a setter for UI. - * - * @param numberOfAttendees - * an int value. - */ - public void setNumberOfAttendees(int numberOfAttendees) { - this.numberOfAttendees = numberOfAttendees; - } - - /** - * This is a getter method and it checks if the number of attendees is - * limited. - * - * @return true if the number of attendees is unlimited. - */ - public boolean isUnlimited() { - return unlimited; - } - - /** - * This is a setter for UI. - * - * @param unlimited - * a boolean value. - */ - public void setUnlimited(boolean unlimited) { - this.unlimited = unlimited; - } - - /** - * This is a getter method for UI. - * - * @return an int value. - */ - public int getSignupBegins() { - return signupBegins; - } - - /** - * This is a setter for UI. - * - * @param bookingTime - * an int value. - */ - public void setSignupBegins(int bookingTime) { - this.signupBegins = bookingTime; - } - - /** - * This is a getter method for UI. - * - * @return a string value. - */ - public String getSignupBeginsType() { - return signupBeginsType; - } - - /** - * This is a setter for UI. - * - * @param bookingTimeType - * a string value. - */ - public void setSignupBeginsType(String bookingTimeType) { - this.signupBeginsType = bookingTimeType; - } - - /** - * This is a getter method for UI. - * - * @return an int value. - */ - public int getDeadlineTime() { - return deadlineTime; - } - - /** - * This is a setter for UI. - * - * @param deadlineTime - * an int value. - */ - public void setDeadlineTime(int deadlineTime) { - this.deadlineTime = deadlineTime; - } - - /** - * This is a getter method for UI. - * - * @return a string value. - */ - public String getDeadlineTimeType() { - return deadlineTimeType; - } - - /** - * This is a setter for UI. - * - * @param deadlineTimeType - * a string value. - */ - public void setDeadlineTimeType(String deadlineTimeType) { - this.deadlineTimeType = deadlineTimeType; - } - - /** - * This is a getter method for UI. - * - * @return a list of SignupSiteWrapper objects. - */ - public List<SignupSiteWrapper> getOtherSites() { - if (this.currentSite == null) { - getAvailableSiteGroups(); - } - return otherSites; - } - - /** - * This is a setter method for UI. - * - * @param signupSiteWrapperList - * a list of SignupSiteWrapper object. - */ - public void setOtherSites(List<SignupSiteWrapper> signupSiteWrapperList) { - this.otherSites = signupSiteWrapperList; - } - - /** - * This is a getter method for UI. - * - * @return a SignupSiteWrapper object. - */ - public SignupSiteWrapper getCurrentSite() { - if (this.currentSite == null) { - getAvailableSiteGroups(); - } - return currentSite; - } - - /* - * Due to Authz bug, we have to share the same CreateSitesGroups object. It - * will much simple if Authz bug is fixed. - */ - private void getAvailableSiteGroups() { - Utilities.getSignupMeetingsBean().getCreateSitesGroups().resetSiteGroupCheckboxMark(); - currentSite = Utilities.getSignupMeetingsBean().getCreateSitesGroups().getCurrentSite(); - otherSites = Utilities.getSignupMeetingsBean().getCreateSitesGroups().getOtherSites(); - } - - /** - * This is a setter for UI. - * - * @param currentSite - * a SignupSiteWrapper object. - */ - public void setCurrentSite(SignupSiteWrapper currentSite) { - this.currentSite = currentSite; - } - - /** - * This is a getter method for UI. - * - * @return true if email notification will be sent away. - */ - public boolean getSendEmail() { - if (!getPublishedSite()) - sendEmail = false;// no email notification - - return sendEmail; - } - - - /** - * This is a setter for UI. - * - * @param sendEmail - * a boolean value. - */ - public void setSendEmail(boolean sendEmail) { - this.sendEmail = sendEmail; - } - - /** - * This is a getter method for UI. - * - * @return true if email notification will be the default value. - */ - public boolean getSendEmailByOwner() { - return sendEmailByOwner; - } - - /** - * This is a getter method for UI. - * - * @return a constant string. - */ - public void setSendEmailByOwner(boolean sendEmailByOwner) { - this.sendEmailByOwner = sendEmailByOwner; - } - - /** - * This is a getter method for UI. - * - * @return a constant string. - */ - public String getIndividual() { - return INDIVIDUAL; - } - - /** - * This is a getter method for UI. - * - * @return a constant string. - */ - public String getGroup() { - return GROUP; - } - - /** - * This is a getter method for UI. - * - * @return a constant string. - */ - public String getAnnouncement() { - return ANNOUNCEMENT; - } - - /** - * This is a getter method for UI. - * - * @return a list of SelectItem objects. - */ - public List<SelectItem> getAllAttendees() { - return allAttendees; - } - - /** - * This is a setter. - * - * @param allAttendees - * a list of SelectItem objects. - */ - public void setAllAttendees(List<SelectItem> allAttendees) { - this.allAttendees = allAttendees; - } - - /** - * This is a getter method for UI. - * - * @return true if the name of attendees will be made public. - */ - public boolean isShowParticipants() { - return showParticipants; - } - - /** - * This is a setter for UI. - * - * @param showParticipants - * a boolean value. - */ - public void setShowParticipants(boolean showParticipants) { - this.showParticipants = showParticipants; - } - - private void loadAllAttendees(SignupMeeting meeting) { - if(isEidInputMode()) - return; - - try { - Site site = getSakaiFacade().getSiteService().getSite(getSakaiFacade().getCurrentLocationId()); - if(site !=null){ - int allMemeberSize = site.getMembers()!=null? site.getMembers().size() : 0; - /* - * due to efficiency, user has to input EID instead of using dropdown - * user name list - */ - /*First check to avoid load all site member up if there is ten of thousends*/ - if(allMemeberSize > MAX_NUM_PARTICIPANTS_FOR_DROPDOWN_BEFORE_AUTO_SWITCH_TO_EID_INPUT_MODE){ - setEidInputMode(true); - return; - } - } - } catch (IdUnusedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - this.allSignupUsers = sakaiFacade.getAllPossibleAttendees(meeting); - - if (allSignupUsers != null - && allSignupUsers.size() > MAX_NUM_PARTICIPANTS_FOR_DROPDOWN_BEFORE_AUTO_SWITCH_TO_EID_INPUT_MODE) { - setEidInputMode(true); - return; - } - - setEidInputMode(false); - this.allAttendees = new ArrayList<SelectItem>(); - SelectItem sItem = new SelectItem("", " " + Utilities.rb.getString("label.select.attendee")); - allAttendees.add(sItem); - String previous_displayName =""; - int index = 0; - for (SignupUser user : allSignupUsers) { - if(user.getDisplayName().equals(previous_displayName)){ - allAttendees.add(new SelectItem(user.getEid(), user.getDisplayName()+ "(" + user.getEid() +")")); - SelectItem prev_sItem = allAttendees.get(index); - //checking: not already has eid for triple duplicates case - if(!prev_sItem.getLabel().contains("(")){ - prev_sItem.setLabel(prev_sItem.getLabel() + " (" + prev_sItem.getValue() +")"); - } - - }else { - allAttendees.add(new SelectItem(user.getEid(), user.getDisplayName())); - } - - previous_displayName = user.getDisplayName(); - index++; - } - } - - /** - * This is a getter method for UI. - * - * @return an UIInput object. - */ - public UIInput getNewAttendeeInput() { - return newAttendeeInput; - } - - /** - * This is a setter for UI. - * - * @param newAttendeeInput - * an UIInput object. - */ - public void setNewAttendeeInput(UIInput newAttendeeInput) { - this.newAttendeeInput = newAttendeeInput; - } - - /** - * This is a getter method for UI. - * - * @return an UIData object. - */ - public UIData getTimeslotWrapperTable() { - return timeslotWrapperTable; - } - - /** - * This is a setter for UI. - * - * @param timeslotWrapperTable - * an UIData object. - */ - public void setTimeslotWrapperTable(UIData timeslotWrapperTable) { - this.timeslotWrapperTable = timeslotWrapperTable; - } - - /** - * This is a getter method for UI. - * - * @return true if the organizer want to receive email notification from - * attendees. - */ - public boolean isReceiveEmail() { - return receiveEmail; - } - - /** - * This is a setter for UI. - * - * @param receiveEmail - * a boolean value. - */ - public void setReceiveEmail(boolean receiveEmail) { - this.receiveEmail = receiveEmail; - } - - /** - * This is a getter method for UI. - * - * @return a constant string value. - */ - public String getAttendeeUserId() { - return PARAM_NAME_FOR_ATTENDEE_USERID; - } - - /** - * This is a getter method for UI. - * - * @return true if it's an announcement event/meeting type. - */ - public boolean isAnnouncementType() { - return ANNOUNCEMENT.equals(getSignupMeeting().getMeetingType()); - } - - /** - * This is a getter method for UI. - * - * @return true if it's an group event/meeting type. - */ - public boolean isGroupType() { - return GROUP.equals(getSignupMeeting().getMeetingType()); - } - - /** - * This is a getter method for UI. - * - * @return true if it's an individual event/meeting type. - */ - public boolean isIndividualType() { - return INDIVIDUAL.equals(getSignupMeeting().getMeetingType()); - } - - /** - * This is a getter method for UI. - * - * @return true if it's an individual event/meeting type. - */ - public boolean isCustomTimeslotType() { - return CUSTOM_TIMESLOTS.equals(getSignupMeeting().getMeetingType()); - } - - /** - * This is for UI purpose and it displays the meeting type, which user can - * redefine in message bundle - * - * @return a meeting display type - */ - public String getDisplayCurrentMeetingType() { - String mType = ""; - if (isIndividualType()) - mType = Utilities.rb.getString("label_individaul"); - else if (isGroupType()) - mType = Utilities.rb.getString("label_group"); - else if (isAnnouncementType()) - mType = Utilities.rb.getString("label_announcement"); - else if (isUserDefinedTS()) - mType = Utilities.rb.getString("label_custom_timeslots"); - - return mType; - } - - /** - * This is a getter method for UI. - * - * @return true if it's in the eid-input mode. - */ - public boolean isEidInputMode() { - return eidInputMode; - } - - /** - * This is a setter. - * - * @param eidInputMode - * a boolean value. - */ - public void setEidInputMode(boolean eidInputMode) { - this.eidInputMode = eidInputMode; - } - - /** - * This is for Javascript UI only. - * - * @return empty string. - */ - public String getUserInputEidOrEmail() { - return ""; - } - - /** - * This is for Javascript UI only. - * - * @param value - * eid or email for the user - */ - public void setUserInputEidOrEmail(String value) { - if (StringUtils.isNotBlank(value)) { - this.eidOrEmailInputByUser = value; - } - } - - /* Proxy method */ - private String getEidOrEmailInputByUser() { - String eid = this.eidOrEmailInputByUser; - this.eidOrEmailInputByUser = null;// reset for use once only - return eid; - } - - private void processSaveMeetings() { - signupMeeting.setRepeatUntil(getRepeatUntil()); - int repeatNum = getOccurrences(); - if("1".equals(getRecurLengthChoice())){ - repeatNum = CreateMeetings.getNumOfRecurrence(getRepeatType(), signupMeeting.getStartTime(), - getRepeatUntil()); - } - signupMeeting.setRepeatNum(repeatNum); - signupMeeting.setRepeatType(getRepeatType()); - - if(CUSTOM_TIMESLOTS.equals(this.signupMeeting.getMeetingType())){ - boolean multipleCalBlocks = getUserDefineTimeslotBean().getPutInMultipleCalendarBlocks(); - signupMeeting.setInMultipleCalendarBlocks(multipleCalBlocks); - } - - /*pass who should receive the emails*/ - signupMeeting.setSendEmailToSelectedPeopleOnly(this.sendEmailToSelectedPeopleOnly); - - CreateMeetings createMeeting = new CreateMeetings(signupMeeting, sendEmail, - !assignParicitpantsToAllRecurEvents, assignParicitpantsToAllRecurEvents, getSignupBegins(), - getSignupBeginsType(), getDeadlineTime(), getDeadlineTimeType(), getRecurLengthChoice(), sakaiFacade, signupMeetingService, - getAttachmentHandler(), sakaiFacade.getCurrentUserId(), sakaiFacade.getCurrentLocationId(), true); - - try { - /*need push to calendar tool*/ - createMeeting.setPublishToCalendar(getPublishToCalendar()); - - /*do we want to also create groups? */ - createMeeting.setCreateGroups(this.createGroups); - - createMeeting.processSaveMeetings(); - - /*handle attachments and it should not be cleaned up in CHS*/ - this.attachments.clear(); - - } catch (PermissionException e) { - logger.info(Utilities.rb.getString("no.permission_create_event") + " - " + e.getMessage()); - } catch (Exception e) { - logger.error(Utilities.rb.getString("error.occurred_try_again") + " - " + e.getMessage()); - Utilities.addErrorMessage(Utilities.rb.getString("error.occurred_try_again")); - } - - } - - /** - * This is a getter for UI - * - * @return a boolean value - */ - public boolean isAssignParicitpantsToAllRecurEvents() { - return assignParicitpantsToAllRecurEvents; - } - - /** - * This is a setter method for UI - * - * @param assignParicitpantsToAllRecurEvents - * a boolean vaule - */ - public void setAssignParicitpantsToAllRecurEvents(boolean assignParicitpantsToAllRecurEvents) { - this.assignParicitpantsToAllRecurEvents = assignParicitpantsToAllRecurEvents; - } - - private String eventFreqType = ""; - - /** - * This is a getter method for UI - * - * @return a event frequency type string - */ - public String getEventFreqType() { - eventFreqType = ""; - if (getRepeatType().equals(DAILY)) - eventFreqType = Utilities.rb.getString("label_daily"); - else if (getRepeatType().equals(WEEKDAYS)) - eventFreqType = Utilities.rb.getString("label_weekdays"); - else if (getRepeatType().equals(WEEKLY)) - eventFreqType = Utilities.rb.getString("label_weekly"); - else if (getRepeatType().equals(BIWEEKLY)) - eventFreqType = Utilities.rb.getString("label_biweekly"); - - return eventFreqType; - } - - /** - * This is a getter method for UI and it provides the selected - * site(s)/group(s) by user. - * - * @return a list of SignupSite objects. - */ - public List<SignupSite> getSelectedSignupSites() { - return CreateSitesGroups.getSelectedSignupSites(this.currentSite, this.otherSites); - } - - /** - * This is a getter method for UI and it provides the meeting types for - * radio buttons. - * - * @return a list of SelectItem objects. - */ - public List<SelectItem> getMeetingTypeRadioBttns() { - this.meetingTypeRadioBttns = Utilities.getMeetingTypeSelectItems("", false); - return meetingTypeRadioBttns; - } - - /** - * This is a getter method for UI - * - * @return true if the site is published. - */ - public Boolean getPublishedSite() { - if (this.publishedSite == null) { - try { - boolean status = sakaiFacade.getSiteService().getSite(sakaiFacade.getCurrentLocationId()).isPublished(); - this.publishedSite = new Boolean(status); - - } catch (Exception e) { - logger.warn(e.getMessage()); - this.publishedSite = new Boolean(false); - - } - } - - return publishedSite.booleanValue(); - } - - /** - * This is a getter method for UI - * @return true if the ending time is adjusted. - */ - public boolean isEndTimeAutoAdjusted() { - return endTimeAutoAdjusted; - } - - /** - * This is a setter method. - * @param endTimeAutoAdjusted - */ - public void setEndTimeAutoAdjusted(boolean endTimeAutoAdjusted) { - this.endTimeAutoAdjusted = endTimeAutoAdjusted; - } - - public boolean isAllowWaitList() { - return allowWaitList; - } - - public void setAllowWaitList(boolean allowWaitList) { - this.allowWaitList = allowWaitList; - } - - public boolean isAllowComment() { - return allowComment; - } - - public void setAllowComment(boolean allowComment) { - this.allowComment = allowComment; - } - - public boolean isAutoReminder() { - return autoReminder; - } - - public void setAutoReminder(boolean autoReminder) { - this.autoReminder = autoReminder; - } - - public boolean isAutoReminderOptionChoice() { - return autoReminderOptionChoice; - } - - public void setAutoReminderOptionChoice(boolean autoReminderOptionChoice) { - this.autoReminderOptionChoice = autoReminderOptionChoice; - } - - public boolean isUserIdInputModeOptionChoice() { - return userIdInputModeOptionChoice; - } - - public void setUserIdInputModeOptionChoice(boolean userIdInputModeOptionChoice) { - this.userIdInputModeOptionChoice = userIdInputModeOptionChoice; - } - - public List<SignupAttachment> getAttachments() { - return attachments; - } - - public void setAttachments(List<SignupAttachment> attachments) { - this.attachments = attachments; - } - - public AttachmentHandler getAttachmentHandler() { - return attachmentHandler; - } - - public void setAttachmentHandler(AttachmentHandler attachmentHandler) { - this.attachmentHandler = attachmentHandler; - } - - public boolean isAttachmentsEmpty(){ - if (this.attachments !=null && this.attachments.size()>0) - return false; - else - return true; - } - - public boolean isAllLocationsEmpty(){ - // this is safe to call often since we cache the locations - //it already has one label item in - return !(getAllLocations().size()>1); - - } - - public boolean isCategoriesExist() { - // this is safe to call often since we cache the categories - return getAllCategories().size()>1; - } - - public UserDefineTimeslotBean getUserDefineTimeslotBean() { - return userDefineTimeslotBean; - } - - public void setUserDefineTimeslotBean(UserDefineTimeslotBean userDefineTimeslotBean) { - this.userDefineTimeslotBean = userDefineTimeslotBean; - } - - public List<TimeslotWrapper> getCustomTimeSlotWrpList() { - return customTimeSlotWrpList; - } - - public void setCustomTimeSlotWrpList(List<TimeslotWrapper> customTimeSlotWrpList) { - this.customTimeSlotWrpList = customTimeSlotWrpList; - } - - public boolean isUserDefinedTS() { - return userDefinedTS; - } - - public void setUserDefinedTS(boolean userDefinedTS) { - this.userDefinedTS = userDefinedTS; - } - - public boolean getPublishToCalendar() { - return publishToCalendar; - } - - public void setPublishToCalendar(boolean publishToCalendar) { - this.publishToCalendar = publishToCalendar; - } - - public boolean getCreateGroups() { - return createGroups; - } - - public void setCreateGroups(boolean createGroups) { - this.createGroups = createGroups; - } - - public String getRecurLengthChoice() { - return recurLengthChoice; - } - - public void setRecurLengthChoice(String recurLengthChoice) { - this.recurLengthChoice = recurLengthChoice; - } - - public int getOccurrences() { - return occurrences; - } - - public void setOccurrences(int occurrences) { - this.occurrences = occurrences; - } - - /** - * @return true if sakai property signup.enableAttendance is true, else will return false - */ - public boolean isAttendanceOn() { - return Utilities.getSignupMeetingsBean().isAttendanceOn(); - } - - /** - * Get a list of users that have permission, but format it as a SelectItem list for the dropdown. - * Since this is a new item there will be no current instructor so it returns the current user at the top of the list - * We send a null signup meeting param as this is a new meeting. - */ - public List<SelectItem> getInstructors() { - return Utilities.getSignupMeetingsBean().getInstructors(null); - } - - /** - * Get the instructor name attached to the value currently set for the instructor - */ - public String getInstructorName() { - return Utilities.getSignupMeetingsBean().getInstructorName(creatorUserId); - } - - /** - * Gets the userId for a user, given an eid or an email address. - * We check if it matches the eid first, then if it matches an email address. - * If nothing, return null. - * - * @param value the string to lookup, could be an eid or an email address - * @return the userId or null if User cannot be found - */ - public String getUserIdForEidOrEmail(String value) { - User u = sakaiFacade.getUserByEid(value); - if(u==null) { - u=sakaiFacade.getUserByEmail(value); - } - - if(u!=null) { - return u.getId(); - } - - return null; - } - - /** - * Get the eids assocaited with an email address, ie there may be two or more users with the same email address. - * We need to be able to handle this in the UI. - * - * @param email - * @return List<String> of eids. - */ - public List<String> getEidsForEmail(String email) { - List<User> users = sakaiFacade.getUsersByEmail(email); - - List<String> eids = new ArrayList<String>(); - for(User u:users) { - eids.add(u.getEid()); - } - - return eids; - } - - public List<SignupUser> getAllPossibleCoordinators() { - return allPossibleCoordinators; - } - - public void setAllPossibleCoordinators(List<SignupUser> allPossibleCoordinators) { - this.allPossibleCoordinators = allPossibleCoordinators; - } - - /** - * This is for UI page to determine whether the email checkbox should be checked and disabled to change - * @return - */ - public boolean isMandatorySendEmail(){ - return this.mandatorySendEmail; - } - - public String getSendEmailToSelectedPeopleOnly() { - return sendEmailToSelectedPeopleOnly; - } - - public void setSendEmailToSelectedPeopleOnly( - String sendEmailToSelectedPeopleOnly) { - this.sendEmailToSelectedPeopleOnly = sendEmailToSelectedPeopleOnly; - } - - private String iframeId = ""; - - /** - * This is a getter method which provide current Iframe id for refresh - * IFrame purpose. - * - * @return a String - */ - public String getIframeId() { - HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext() - .getRequest(); - String iFrameId = (String) request.getAttribute("sakai.tool.placement.id"); - return iFrameId; - } - - public void setIframeId(String iframeId) { - this.iframeId = iframeId; - } - -} +/* +* Licensed to The Apereo Foundation under one or more contributor license +* agreements. See the NOTICE file distributed with this work for +* additional information regarding copyright ownership. +* +* The Apereo Foundation licenses this file to you 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: +* +* http://opensource.org/licenses/ecl2.txt +* +* 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.sakaiproject.signup.tool.jsf; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import javax.faces.component.UIData; +import javax.faces.component.UIInput; +import javax.faces.component.html.HtmlInputHidden; +import javax.faces.event.ActionEvent; +import javax.faces.event.ValueChangeEvent; +import javax.faces.model.SelectItem; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpServletRequest; + +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sakaiproject.exception.IdUnusedException; +import org.sakaiproject.exception.PermissionException; +import org.sakaiproject.signup.logic.SakaiFacade; +import org.sakaiproject.signup.logic.SignupMeetingService; +import org.sakaiproject.signup.logic.SignupMessageTypes; +import org.sakaiproject.signup.logic.SignupUser; +import org.sakaiproject.signup.model.MeetingTypes; +import org.sakaiproject.signup.model.SignupAttachment; +import org.sakaiproject.signup.model.SignupAttendee; +import org.sakaiproject.signup.model.SignupMeeting; +import org.sakaiproject.signup.model.SignupSite; +import org.sakaiproject.signup.model.SignupTimeslot; +import org.sakaiproject.signup.tool.jsf.attachment.AttachmentHandler; +import org.sakaiproject.signup.tool.jsf.organizer.UserDefineTimeslotBean; +import org.sakaiproject.signup.tool.jsf.organizer.action.CreateMeetings; +import org.sakaiproject.signup.tool.jsf.organizer.action.CreateSitesGroups; +import org.sakaiproject.signup.tool.util.SignupBeanConstants; +import org.sakaiproject.signup.tool.util.Utilities; +import org.sakaiproject.site.api.Site; +import org.sakaiproject.user.api.User; +import org.sakaiproject.user.api.UserNotDefinedException; + +/** + * <p> + * This JSF UIBean class will handle the creation of different types of + * event/meeting by Organizer It provides all the necessary business logic for + * this process. + * + * @author Peter Liu + * + * </P> + */ +public class NewSignupMeetingBean implements MeetingTypes, SignupMessageTypes, SignupBeanConstants { + + private SignupMeetingService signupMeetingService; + + private SignupMeeting signupMeeting; + + private SakaiFacade sakaiFacade; + + private HtmlInputHidden currentStepHiddenInfo; + + private boolean unlimited; + + private int numberOfSlots; + + private int numberOfAttendees; + + private int maxOfAttendees; + + private int timeSlotDuration; + + private boolean recurrence; + + private String signupBeginsType; + + //Location selected from the dropdown + private String selectedLocation; + + //New Location added in the editable field + private String customLocation; + + private List<SelectItem> locations=null; + + //Category selected from the dropdown + private String selectedCategory; + + //New Category added in the editable field + private String customCategory; + + private List<SelectItem> categories = null; + + private String repeatType; + + private Date repeatUntil; + + /* 0 for num of repeat, 1 for date choice*/ + private String recurLengthChoice; + + private int occurrences; + + private boolean assignParicitpantsToAllRecurEvents = false; + + /* sign up can start before this minutes/hours/days */ + private int signupBegins; + + private String deadlineTimeType; + + /* sign up deadline before this minutes/hours/days */ + + private int deadlineTime; + + private SignupSiteWrapper currentSite; + + private List<SignupSiteWrapper> otherSites; + + private static boolean DEFAULT_SEND_EMAIL = "true".equalsIgnoreCase(Utilities.getSignupConfigParamVal("signup.default.email.notification", "true")) ? true : false; + + protected boolean sendEmail = DEFAULT_SEND_EMAIL; + + private boolean receiveEmail; + + private boolean sendEmailByOwner; + + private static boolean DEFAULT_ALLOW_WAITLIST = "true".equalsIgnoreCase(Utilities.getSignupConfigParamVal("signup.default.allow.waitlist", "true")) ? true : false; + + private static boolean DEFAULT_ALLOW_COMMENT = "true".equalsIgnoreCase(Utilities.getSignupConfigParamVal("signup.default.allow.comment", "true")) ? true : false; + + private static boolean DEFAULT_AUTO_RIMINDER = "true".equalsIgnoreCase(Utilities.getSignupConfigParamVal("signup.event.default.auto.reminder", "true")) ? true : false; + + private static boolean DEFAULT_AUTO_RMINDER_OPTION_CHOICE = "true".equalsIgnoreCase(Utilities.getSignupConfigParamVal("signup.autoRiminder.option.choice.setting", "true")) ? true : false; + + private static boolean DEFAULT_USERID_INPUT_MODE_OPTION_CHOICE = "true".equalsIgnoreCase(Utilities.getSignupConfigParamVal("signup.userId.inputMode.choiceOption.setting", "true")) ? true : false; + + private static boolean DEFAULT_EXPORT_TO_CALENDAR_TOOL = "true".equalsIgnoreCase(Utilities.getSignupConfigParamVal("signup.default.export.to.calendar.setting", "true")) ? true : false; + + private static boolean DEFAULT_CREATE_GROUPS = "true".equalsIgnoreCase(Utilities.getSignupConfigParamVal("signup.default.create.groups.setting", "true")) ? true : false; + + protected static boolean NEW_MEETING_SEND_EMAIL = "true".equalsIgnoreCase(Utilities.getSignupConfigParamVal( + "signup.email.notification.mandatory.for.newMeeting", "true")) ? true : false; + + private boolean mandatorySendEmail = NEW_MEETING_SEND_EMAIL; + + private String sendEmailToSelectedPeopleOnly = SEND_EMAIL_ONLY_ORGANIZER_COORDINATORS; + + private boolean publishToCalendar = DEFAULT_EXPORT_TO_CALENDAR_TOOL; + + private boolean createGroups = DEFAULT_CREATE_GROUPS; + + private boolean allowWaitList = DEFAULT_ALLOW_WAITLIST; + + private boolean allowComment = DEFAULT_ALLOW_COMMENT; + + private boolean autoReminder = DEFAULT_AUTO_RIMINDER; + + private boolean autoReminderOptionChoice = DEFAULT_AUTO_RMINDER_OPTION_CHOICE; + + private boolean userIdInputModeOptionChoice = DEFAULT_USERID_INPUT_MODE_OPTION_CHOICE; + + private List<TimeslotWrapper> timeSlotWrappers; + + private List<SelectItem> meetingTypeRadioBttns; + + List<SignupUser> allSignupUsers; + + List<SignupUser> allPossibleCoordinators; + + private List<SelectItem> allAttendees; + + private UIInput newAttendeeInput; + + /* proxy param */ + private String eidOrEmailInputByUser; + + private UIData timeslotWrapperTable; + + private boolean showParticipants; + + private boolean validationError; + + private boolean eidInputMode = false; + + private Boolean publishedSite; + + private boolean endTimeAutoAdjusted=false; + + private List<SignupAttachment> attachments; + + private AttachmentHandler attachmentHandler; + + private UserDefineTimeslotBean userDefineTimeslotBean; + + //discontinued time slots case + private List<TimeslotWrapper> customTimeSlotWrpList; + + private boolean otherSitesAvailability; + + private boolean userDefinedTS=false; + + private String creatorUserId; + + private int maxSlots; + + private int maxAttendeesPerSlot; + + private Logger logger = LoggerFactory.getLogger(getClass()); + + /* used for jsf parameter passing */ + private final static String PARAM_NAME_FOR_ATTENDEE_USERID = "attendeeUserId"; + + /* to remember the number of the meeting slots */ + private int maxNumOfSlots; + /* Used for populate the drop down box for the allowed number of meeting slots */ + private List<SelectItem> slots; + + public int getMaxNumOfSlots() { + return maxNumOfSlots; + } + + public void setMaxNumOfSlots(int preferredSlot) { + this.maxNumOfSlots = preferredSlot; + } + + public List<SelectItem> getSlots(){ + + slots = new ArrayList<SelectItem>(); + for (int i =1; i <= numberOfSlots;i++) slots.add(new SelectItem(i, i+"")); + return slots; + } + + public String getCurrentUserDisplayName() { + return sakaiFacade.getUserDisplayName(sakaiFacade.getCurrentUserId()); + } + + public String getselectedLocation() { + return selectedLocation; + } + + public void setselectedLocation(String selectedLocation) { + this.selectedLocation = selectedLocation; + } + + public String getcustomLocation() { + return customLocation; + } + + public void setcustomLocation(String customLocation) { + this.customLocation = customLocation; + } + + public String getselectedCategory() { + return selectedCategory; + } + + public void setselectedCategory(String selectedCategory) { + this.selectedCategory = selectedCategory; + } + + public String getcustomCategory() { + return customCategory; + } + + public void setcustomCategory(String customCategory) { + this.customCategory = customCategory; + } + + public String getCreatorUserId() { + if(this.creatorUserId ==null){ + //set current user as default meeting organizer if case people forget to select one + return sakaiFacade.getCurrentUserId(); + } + return creatorUserId; + } + + public void setCreatorUserId(String creatorUserId) { + this.creatorUserId = creatorUserId; + } + + public boolean isOtherSitesAvailability() { + + //checking for tool property, if it doesn't exist,take value as default + String toolProperty = sakaiFacade.getToolManager().getCurrentPlacement().getConfig().getProperty("signup.other.sites.availability", "default"); + if (toolProperty.equals("default")) { + //If tool property is not set, then consider sakai property + String sakaiProperty = Boolean.valueOf(sakaiFacade.getServerConfigurationService().getBoolean("signup.otherSitesAvailability", true)).toString(); + toolProperty = sakaiProperty; + } + //tool property would take precedence over sakai property + otherSitesAvailability= "false".equalsIgnoreCase(toolProperty)? false : true; + return otherSitesAvailability; + } + + public void setOtherSitesAvailability(boolean otherSitesAvailability) { + this.otherSitesAvailability = otherSitesAvailability; + } + + /** + * @return the maxSlots + */ + public int getMaxSlots() { + String maxSlotsStringVal = Utilities.getSignupConfigParamVal("signup.maxSlots", "500"); + try{ + maxSlots = Integer.parseInt(maxSlotsStringVal); + } + catch (Exception e){ + maxSlots = 500; + } + return maxSlots; + } + + /** + * @param maxSlots the maxSlots to set + */ + public void setMaxSlots(int maxSlots) { + this.maxSlots = maxSlots; + } + + /** + * @return the maxAttendeesPerSlot + */ + public int getMaxAttendeesPerSlot() { + String maxAttendeesStringVal = Utilities.getSignupConfigParamVal("signup.maxAttendeesPerSlot", "500"); + try{ + maxAttendeesPerSlot = Integer.parseInt(maxAttendeesStringVal); + } + catch(Exception e){ + maxAttendeesPerSlot=500; + } + return maxAttendeesPerSlot; + } + + /** + * @param maxAttendeesPerSlot the maxAttendeesPerSlot to set + */ + public void setMaxAttendeesPerSlot(int maxAttendeesPerSlot) { + this.maxAttendeesPerSlot = maxAttendeesPerSlot; + } + + + /** + * The default Constructor. It will initialize all the required variables. + * + */ + public NewSignupMeetingBean() { + init(); + } + + public String getRepeatType() { + return repeatType; + } + + public Date getRepeatUntil() { + return repeatUntil; + } + + public void setRepeatType(String repeatType) { + this.repeatType = repeatType; + } + + public void setRepeatUntil(Date repeatUntil) { + this.repeatUntil = repeatUntil; + } + + /** Initialize all the default setting for creating new events. */ + private void init() { + + signupMeeting = new SignupMeeting(); + signupMeeting.setMeetingType(INDIVIDUAL); + + Date date = new Date(); + Calendar startCal = Calendar.getInstance(); + startCal.setTime(date); + startCal.set(Calendar.MINUTE, 0); + startCal.set(Calendar.SECOND, 0); + startCal.set(Calendar.MILLISECOND, 0); + signupMeeting.setStartTime(startCal.getTime()); + + Calendar endCal = startCal; + endCal.add(Calendar.HOUR, 1); + signupMeeting.setEndTime(endCal.getTime()); + + unlimited = false; + recurrence = false; + assignParicitpantsToAllRecurEvents = false; + numberOfSlots = 4; + numberOfAttendees = 1; + maxOfAttendees = 10; + timeSlotDuration = 0; // minutes + signupBegins = 6; + deadlineTime = 1; + signupBeginsType = Utilities.DAYS; + deadlineTimeType = Utilities.HOURS; + validationError = false; + sendEmail = DEFAULT_SEND_EMAIL; + if(NEW_MEETING_SEND_EMAIL){ + sendEmail = NEW_MEETING_SEND_EMAIL; + } + sendEmailToSelectedPeopleOnly=SEND_EMAIL_ONLY_ORGANIZER_COORDINATORS; + receiveEmail = false; + sendEmailByOwner= DEFAULT_SEND_EMAIL; /*will be inherited per meeting basis*/ + allowComment = DEFAULT_ALLOW_COMMENT; + allowWaitList = DEFAULT_ALLOW_WAITLIST; + autoReminder = DEFAULT_AUTO_RIMINDER; + publishToCalendar= DEFAULT_EXPORT_TO_CALENDAR_TOOL; + createGroups = DEFAULT_CREATE_GROUPS; + currentStepHiddenInfo = null; + eidInputMode = false; + repeatType = ONCE_ONLY; + repeatUntil = startCal.getTime(); + recurLengthChoice="1";//0 for num of repeat, 1 for date choice + occurrences=0; + this.publishedSite = null; + //Custom defined time slots allocation + userDefinedTS=false; + customTimeSlotWrpList=null; + otherSitesAvailability = true; + creatorUserId = null; + + /*cleanup unused attachments in CHS*/ + if(this.attachments !=null && this.attachments.size()>0){ + for (SignupAttachment attach : attachments) { + getAttachmentHandler().removeAttachmentInContentHost(attach); + } + this.attachments.clear(); + } + else + this.attachments = new ArrayList<SignupAttachment>(); + } + + public void reset() { + init(); + signupBeginsType = Utilities.DAYS; + deadlineTimeType = Utilities.HOURS; + signupBegins = 6; + deadlineTime = 1; + timeSlotWrappers = null; + currentSite = null; + otherSites = null; + /* for main meetingpage */ + Utilities.resetMeetingList(); + this.eidOrEmailInputByUser = null; + this.selectedLocation=null; + this.customLocation=""; + this.selectedCategory=null; + this.customCategory=""; + this.creatorUserId=null; + this.locations=null; + this.categories=null; + /*clean up everything in getUserDefineTimeslotBean*/ + getUserDefineTimeslotBean().reset(UserDefineTimeslotBean.NEW_MEETING); + } + + /** + * This method is called to get all locations to populate the dropdown, for new signup creation. + * + * @return list of allLocations + */ + public List<SelectItem> getAllLocations(){ + if(locations ==null){ + locations = new ArrayList<SelectItem>(); + locations.addAll(Utilities.getSignupMeetingsBean().getAllLocations()); + locations.add(0, new SelectItem(Utilities.rb.getString("select_location"))); + } + + return locations; + } + + /** + * This method is called to get all categories to populate the dropdown, for new signup creation. + * + * @return list of categories + */ + public List<SelectItem> getAllCategories(){ + if(categories ==null){ + categories = new ArrayList<SelectItem>(); + categories.addAll(Utilities.getSignupMeetingsBean().getAllCategories()); + categories.remove(0);//remove the 'All' default value from the list + categories.add(0, new SelectItem(Utilities.rb.getString("select_category"))); + } + return categories; + } + + /** + * This is a JSF action call method by UI to navigate to the next page. + * + * @return an action outcome string. + */ + public String goNext() { + if (validationError) { + validationError = false; + return ADD_MEETING_STEP1_PAGE_URL; + } + + String step = (String) currentStepHiddenInfo.getValue(); + if (step.equals("step1")) { + /* + * let recalculate the duration just in case of meeting endTime + * changes + */ + setTimeSlotDuration(0); + if(isUserDefinedTS()){ + /*get the timeslots schedules for further process*/ + if(!Utilities.isDataIntegritySafe(isUserDefinedTS(),UserDefineTimeslotBean.NEW_MEETING,getUserDefineTimeslotBean())) + return ADD_MEETING_STEP1_PAGE_URL; + + this.customTimeSlotWrpList=getUserDefineTimeslotBean().getDestTSwrpList(); + } + + return ADD_MEETING_STEP2_PAGE_URL; + } + + return ADD_MEETING_STEP1_PAGE_URL; + } + + /** + * This method is called by JSP page for adding/removing attachments action. + * @return null. + */ + public String addRemoveAttachments(){ + getAttachmentHandler().processAddAttachRedirect(this.attachments, this.signupMeeting,true); + return null; + } + + /** + * Create a new time slot blocks + * @return String object for the next page url + */ + public String createUserDefTimeSlots(){ + /* initially get the data from automatic time-slot creation as default*/ + this.timeSlotDuration = 0;//reset the value + this.customTimeSlotWrpList = timeSlotWrappers(); + getUserDefineTimeslotBean().init(this.signupMeeting, ADD_MEETING_STEP1_PAGE_URL,this.customTimeSlotWrpList, UserDefineTimeslotBean.NEW_MEETING); + return CUSTOM_DEFINED_TIMESLOT_PAGE_URL; + } + + /** + * Modify the existing time slot blocks + * @return String object for next page url + */ + public String editUserDefTimeSlots(){ + if(!Utilities.isDataIntegritySafe(isUserDefinedTS(),UserDefineTimeslotBean.NEW_MEETING,getUserDefineTimeslotBean())){ + reset(); + return ADD_MEETING_STEP1_PAGE_URL; + } + + this.customTimeSlotWrpList = getUserDefineTimeslotBean().getDestTSwrpList(); + getUserDefineTimeslotBean().init(this.signupMeeting, ADD_MEETING_STEP1_PAGE_URL,this.customTimeSlotWrpList, UserDefineTimeslotBean.NEW_MEETING); + return CUSTOM_DEFINED_TIMESLOT_PAGE_URL; + } + + /*Make sure the start/end time input fields have values.*/ + public boolean getPrePopulateValues(){ + if (this.signupMeeting.getStartTime() == null && isUserDefinedTS()){ + this.signupMeeting.setStartTime(getUserDefineTimeslotBean().getEventStartTime()); + this.signupMeeting.setEndTime(getUserDefineTimeslotBean().getEventEndTime()); + } + return false; + } + + /** + * This is a validator to make sure that the event/meeting starting time is + * before ending time. + * + * @param e + * an ActionEvent object. + */ + + public void validateNewMeeting(ActionEvent e) { + if(currentStepHiddenInfo == null) + return; + + String step = (String) currentStepHiddenInfo.getValue(); + + if (step.equals("step1")) { + + boolean locationSet = false; + + //Set Location + if (StringUtils.isNotBlank(customLocation)){ + logger.debug("custom location set: " + customLocation); + this.signupMeeting.setLocation(customLocation); + locationSet = true; + } + + if (!locationSet && StringUtils.isNotBlank(selectedLocation) && !StringUtils.equals(selectedLocation, Utilities.rb.getString("select_location"))){ + this.signupMeeting.setLocation(selectedLocation); + logger.debug("chose a location: " + selectedLocation); + locationSet = true; + } + + if(!locationSet) { + validationError = true; + Utilities.addErrorMessage(Utilities.rb.getString("event.location_not_assigned")); + return; + } + + + //Set Category + //custom + if (StringUtils.isNotBlank(customCategory)){ + this.signupMeeting.setCategory(customCategory); + } + else{ + //or from the dropdown, but if we don't choose one or left it as the 'choose category method' then don't set it + if (!StringUtils.equals(selectedCategory, Utilities.rb.getString("select_category"))){ + this.signupMeeting.setCategory(selectedCategory); + } + } + + //set instructor + this.signupMeeting.setCreatorUserId(creatorUserId); + + Date eventEndTime = signupMeeting.getEndTime(); + Date eventStartTime = signupMeeting.getStartTime(); + /*user defined own TS case*/ + if(isUserDefinedTS()){ + eventEndTime= getUserDefineTimeslotBean().getEventEndTime(); + eventStartTime = getUserDefineTimeslotBean().getEventStartTime(); + /*pass the value since they are null*/ + this.signupMeeting.setStartTime(eventStartTime); + this.signupMeeting.setEndTime(eventEndTime); + + if(getUserDefineTimeslotBean().getDestTSwrpList()==null || getUserDefineTimeslotBean().getDestTSwrpList().isEmpty()){ + validationError = true; + Utilities.addErrorMessage(Utilities.rb.getString("event.create_custom_defined_TS_blocks")); + return; + } + + } + + if (eventEndTime.before(eventStartTime) || eventStartTime.equals(eventEndTime)) { + validationError = true; + Utilities.addErrorMessage(Utilities.rb.getString("event.endTime_should_after_startTime")); + // signupMeeting.setMeetingType(null); + return; + } + + setRecurrence(false); + if (!(getRepeatType().equals(ONCE_ONLY))) { + int repeatNum = getOccurrences(); + if("1".equals(getRecurLengthChoice())){ + repeatNum = CreateMeetings.getNumOfRecurrence(getRepeatType(), eventStartTime, + getRepeatUntil()); + } + + if ((DAILY.equals(getRepeatType()) || WEEKDAYS.equals(getRepeatType())) && isMeetingOverRepeatPeriod(eventStartTime, eventEndTime, 1)) { + validationError = true; + Utilities.addErrorMessage(Utilities.rb.getString("crossDay.event.repeat.daily.problem")); + return; + } + + if (WEEKLY.equals(getRepeatType()) && isMeetingOverRepeatPeriod(eventStartTime, eventEndTime, 7)) { + validationError = true; + Utilities.addErrorMessage(Utilities.rb.getString("crossDay.event.repeat.weekly.problem")); + return; + } + + if (BIWEEKLY.equals(getRepeatType()) && isMeetingOverRepeatPeriod(eventStartTime, eventEndTime, 14)) { + validationError = true; + Utilities.addErrorMessage(Utilities.rb.getString("crossDay.event.repeat.biweekly.problem")); + return; + } + // TODO need to check for weekly too? + + if (repeatNum < 1) { + validationError = true; + if("1".equals(getRecurLengthChoice())) + Utilities.addErrorMessage(Utilities.rb.getString("event.repeatbeforestart")); + else + Utilities.addErrorMessage(Utilities.rb.getString("event.repeatNnum.bigger.than.one")); + + return; + } + setRecurrence(true); + } + + warnMeetingAccrossTwoDates(eventEndTime, eventStartTime); + + if (!CreateSitesGroups.isAtleastASiteOrGroupSelected(this.getCurrentSite(), this.getOtherSites())) { + validationError = true; + Utilities.addErrorMessage(Utilities.rb.getString("select.atleast.oneGroup")); + + } + + if (signupMeeting.getMeetingType() == null) { + validationError = true; + Utilities.addErrorMessage(Utilities.rb.getString("signup.validator.selectMeetingType")); + // signupMeeting.setMeetingType(null); + + } + + /*give warning to user in the next page if the event ending time get auto adjusted due to not even-division + * and it's not the case for custom defined time slot*/ + setEndTimeAutoAdjusted(false); + if(!isUserDefinedTS()){ + if (isIndividualType() && getNumberOfSlots()!=0) { + double duration = (double)(getSignupMeeting().getEndTime().getTime() - getSignupMeeting().getStartTime().getTime()) + / (double)(MINUTE_IN_MILLISEC * getNumberOfSlots()); + if (duration != Math.floor(duration)){ + setEndTimeAutoAdjusted(true); + Utilities.addErrorMessage(Utilities.rb.getString("event_endtime_auto_adjusted_warning")); + } + } + } + + /*for custom time slot case*/ + if(!validationError && isUserDefinedTS()){ + this.signupMeeting.setStartTime(eventStartTime); + this.signupMeeting.setEndTime(eventEndTime); + this.signupMeeting.setMeetingType(CUSTOM_TIMESLOTS); + } + /*reset meetingType for step1 */ + if(!isUserDefinedTS() && CUSTOM_TIMESLOTS.equals(this.signupMeeting.getMeetingType())){ + this.signupMeeting.setMeetingType(INDIVIDUAL); + } + + /*pre-load all possible coordinators for step2*/ + signupMeeting.setSignupSites(CreateSitesGroups.getSelectedSignupSites(getCurrentSite(), getOtherSites())); + this.allPossibleCoordinators = this.sakaiFacade.getAllPossbileCoordinatorsOnFastTrack(this.signupMeeting); + + // tick the creator by default (SIGNUP-216) + for(SignupUser u: this.allPossibleCoordinators) { + if(StringUtils.equals(u.getInternalUserId(), this.creatorUserId)) { + u.setChecked(true); + } + } + + } + } + + private void warnMeetingAccrossTwoDates(Date endTime, Date startTime) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(startTime); + int startYear = calendar.get(Calendar.YEAR); + int startMonth = calendar.get(Calendar.MONTH); + int startDay = calendar.get(Calendar.DATE); + + calendar.setTime(endTime); + int endYear = calendar.get(Calendar.YEAR); + int endMonth = calendar.get(Calendar.MONTH); + int endDay = calendar.get(Calendar.DATE); + if (startYear != endYear){ + Utilities.addInfoMessage(Utilities.rb.getString("warning.event.crossed_twoYears")); + return; + } + if (startMonth != endMonth){ + Utilities.addInfoMessage(Utilities.rb.getString("warning.event.crossed_twoMonths")); + return; + } + if (startDay != endDay){ + Utilities.addInfoMessage(Utilities.rb.getString("warning.event.crossed_twoDays")); + return; + } + + } + + /*private boolean isMeetingLengthOver24Hours(SignupMeeting sm){ + long duration= sm.getEndTime().getTime()- sm.getStartTime().getTime(); + if( 24 - duration /(MINUTE_IN_MILLISEC * Hour_In_MINUTES) >= 0 ) + return false; + + return true; + }*/ + + private boolean isMeetingOverRepeatPeriod(Date startTime, Date endTime, int repeatPeriodInDays){ + long duration= endTime.getTime()- startTime.getTime(); + if( 24*repeatPeriodInDays - duration /(MINUTE_IN_MILLISEC * Hour_In_MINUTES) >= 0 ) + return false; + + return true; + } + + /** + * This is a JSF action call method by UI to let user navigate one page + * back. + * + * @return an action outcome string. + */ + public String goBack() { + if(currentStepHiddenInfo == null){ + //it is rarely happening if any + Utilities.addErrorMessage(Utilities.rb.getString("publish.withAttendee.exception")); + //recover this from "assignAttendee" step case too + //reset to remove timeslots info with attendees + timeSlotWrappers = null; + assignParicitpantsToAllRecurEvents = false; + //reset warning for ending time auto-adjustment + setEndTimeAutoAdjusted(false); + return ADD_MEETING_STEP1_PAGE_URL; + } + + String step = (String) currentStepHiddenInfo.getValue(); + + if (step.equals("step2")) { + return ADD_MEETING_STEP1_PAGE_URL; + } + if (step.equals("assignAttendee")) { + timeSlotWrappers = null; // reset to remove timeslots info with attendees + assignParicitpantsToAllRecurEvents = false; + //reset warning for ending time auto-adjustment + setEndTimeAutoAdjusted(false); + //reset who should receive emails + //setSendEmailAttendeeOnly(false); + sendEmailToSelectedPeopleOnly = SEND_EMAIL_ONLY_ORGANIZER_COORDINATORS;//reset + + return ADD_MEETING_STEP2_PAGE_URL; + } + + return ADD_MEETING_STEP1_PAGE_URL; + } + + /** + * This is a JSF action call method by UI to let user cancel the action. + * + * @return an action outcome string. + */ + public String processCancel() { + reset(); + return CANCEL_ADD_MEETING_PAGE_URL; + } + + /** + * This is a ValueChange Listener to watch the meeting type selection by + * user. + * + * @param vce + * a ValuechangeEvent object. + * @return a outcome string. + */ + public String processSelectedType(ValueChangeEvent vce) { + String newMeetingType = (String) vce.getNewValue(); + signupMeeting.setMeetingType(newMeetingType); + if(!INDIVIDUAL.equals(newMeetingType)){ + setUserDefinedTS(false); + //this.timeSlotWrappers = null;//reset + } + + return ""; + + } + + /** + * This is a ValueChange Listener to watch changes on the selection of + * 'unlimited attendee' choice by user. + * + * @param vce + * a ValuechangeEvent object. + * @return a outcome string. + */ + public String processGroup(ValueChangeEvent vce) { + Boolean changeValue = (Boolean) vce.getNewValue(); + if (changeValue != null) { + unlimited = changeValue.booleanValue(); + if (unlimited) + maxOfAttendees = 10; + + } + + return ""; + + } + + /** + * This is a JSF action call method by UI to let user to save and create a + * new event/meeting. + * + * @return an action outcome string. + */ + public String processSave() { + if(!Utilities.isDataIntegritySafe(isUserDefinedTS(),UserDefineTimeslotBean.NEW_MEETING,getUserDefineTimeslotBean())){ + reset(); + return ADD_MEETING_STEP1_PAGE_URL; + } + + preSaveAction(); + processSaveMeetings(); + reset(); + return MAIN_EVENTS_LIST_PAGE_URL; + } + + /* Prepare the data for saving action */ + private void preSaveAction() { + //SignupSite sSite = new SignupSite(); + //String currentLocationId = sakaiFacade.getCurrentLocationId(); + //sSite.setSiteId(currentLocationId); + //sSite.setTitle(sakaiFacade.getLocationTitle(currentLocationId)); + //List<SignupSite> signupSites = new ArrayList<SignupSite>(); + //signupSites.add(sSite); + //signupMeeting.setSignupSites(signupSites); + List<SignupTimeslot> slots = timeslots(); + signupMeeting.setSignupTimeSlots(slots); + + Date sBegin = Utilities.subTractTimeToDate(signupMeeting.getStartTime(), getSignupBegins(), + getSignupBeginsType()); + Date sDeadline = Utilities.subTractTimeToDate(signupMeeting.getEndTime(), getDeadlineTime(), + getDeadlineTimeType()); + + // TODO need a better way to warn people? + /* + * if (sBegin.before(new Date())) { // a warning for user + * Utilities.addErrorMessage(Utilities.rb.getString("warning.your.event.singup.begin.time.passed.today.time")); } + */ + signupMeeting.setSignupBegins(sBegin); + // TODO need validate and handle error for case: deadline is before + // sBegin + signupMeeting.setSignupDeadline(sDeadline); + //maybe duplicated, it is already set up after 'step1' + signupMeeting.setSignupSites(CreateSitesGroups.getSelectedSignupSites(getCurrentSite(), getOtherSites())); + + signupMeeting.setCreatorUserId(this.creatorUserId); + signupMeeting.setReceiveEmailByOwner(receiveEmail); + signupMeeting.setSendEmailByOwner(sendEmailByOwner); + signupMeeting.setAllowWaitList(this.allowWaitList); + signupMeeting.setAllowComment(this.allowComment); + signupMeeting.setAutoReminder(this.autoReminder); + signupMeeting.setEidInputMode(this.eidInputMode); + signupMeeting.setMaxNumOfSlots(new Integer(this.maxNumOfSlots)); + signupMeeting.setCoordinatorIds(Utilities.getSelectedCoordinators(this.allPossibleCoordinators,this.creatorUserId)); + /* add attachments */ + signupMeeting.setSignupAttachments(this.attachments); + + signupMeeting.setCreateGroups(this.createGroups); + + } + + /** + * This is a JSF action call method by UI to let user to go to next page, + * which will allow user to pre-assign the attendees into the event/meeting. + * + * @return an action outcome string. + */ + public String proceesPreAssignAttendee() { + if(!Utilities.isDataIntegritySafe(isUserDefinedTS(),UserDefineTimeslotBean.NEW_MEETING,getUserDefineTimeslotBean())){ + reset(); + return ADD_MEETING_STEP1_PAGE_URL; + } + + preSaveAction(); + loadAllAttendees(this.getSignupMeeting()); + return PRE_ASSIGN_ATTENDEE_PAGE_URL; + } + + /** + * This is a JSF action call method by UI to let user to save and publish + * the new event/meeting with pre-assigned attendees. + * + * @return an action outcome string. + */ + public String processAssignStudentsAndPublish() { + preSaveAction(); + processSaveMeetings(); + reset(); + return MAIN_EVENTS_LIST_PAGE_URL; + } + + /** + * This is a JSF action call method by UI to let user add an attendee into + * the page. + * + * @return an action outcome string. + */ + public String addAttendee() { + TimeslotWrapper timeslotWrapper = (TimeslotWrapper) timeslotWrapperTable.getRowData(); + + String attendeeEidOrEmail = null; + if (isEidInputMode()) { + attendeeEidOrEmail = getEidOrEmailInputByUser(); + } else { + attendeeEidOrEmail = (String) newAttendeeInput.getValue(); + } + + if(attendeeEidOrEmail ==null || attendeeEidOrEmail.length() <1) + return PRE_ASSIGN_ATTENDEE_PAGE_URL; + + //check if there are multiple email addresses associated with input + List<String> associatedEids = getEidsForEmail(attendeeEidOrEmail.trim()); + if(associatedEids.size() > 1) { + Utilities.addErrorMessage(MessageFormat.format(Utilities.rb.getString("exception.multiple.eids"), new Object[] {attendeeEidOrEmail, StringUtils.join(associatedEids, ", ")})); + return PRE_ASSIGN_ATTENDEE_PAGE_URL; + } + + String attendeeUserId = getUserIdForEidOrEmail(attendeeEidOrEmail.trim()); + if(StringUtils.isBlank(attendeeEidOrEmail)){ + Utilities.addErrorMessage(Utilities.rb.getString("exception.no.such.user") + attendeeEidOrEmail); + return PRE_ASSIGN_ATTENDEE_PAGE_URL; + } + + SignupUser attendeeSignUser = getSakaiFacade().getSignupUser(this.signupMeeting, attendeeUserId); + if(attendeeSignUser ==null){ + Utilities.addErrorMessage(MessageFormat.format(Utilities.rb.getString("user.has.no.permission.attend"), new Object[] {attendeeEidOrEmail})); + return PRE_ASSIGN_ATTENDEE_PAGE_URL; + } + + SignupAttendee attendee = new SignupAttendee(attendeeUserId, attendeeSignUser.getMainSiteId()); + + if (isDuplicateAttendee(timeslotWrapper.getTimeSlot(), attendee)) { + Utilities.addErrorMessage(Utilities.rb.getString("attendee.already.in.timeslot")); + } else { + timeslotWrapper.addAttendee(attendee, sakaiFacade.getUserDisplayLastFirstName(attendeeUserId)); + } + + return PRE_ASSIGN_ATTENDEE_PAGE_URL; + } + + /** + * This is a JSF action call method by UI to let user remove an attendee + * from the page. + * + * @return an action outcome string. + */ + public String removeAttendee() { + TimeslotWrapper timeslotWrapper = (TimeslotWrapper) timeslotWrapperTable.getRowData(); + String attendeeUserId = Utilities.getRequestParam(PARAM_NAME_FOR_ATTENDEE_USERID); + + timeslotWrapper.removeAttendee(attendeeUserId); + + return ""; + } + + private boolean isDuplicateAttendee(SignupTimeslot timeslot, SignupAttendee newAttendee) { + List<SignupAttendee> attendees = timeslot.getAttendees(); + if (attendees != null && !attendees.isEmpty()) { + for (SignupAttendee attendee : attendees) { + if (attendee.getAttendeeUserId().equals(newAttendee.getAttendeeUserId())) + return true; + } + } + return false; + } + + private List<SignupTimeslot> timeslots() { + List<SignupTimeslot> slots = new ArrayList<SignupTimeslot>(); + List<TimeslotWrapper> timeSlotWrappers = getTimeSlotWrappers(); + + if (timeSlotWrappers == null) + return null;// for Announcement type + + for (TimeslotWrapper wrapper : timeSlotWrappers) { + SignupTimeslot slot = wrapper.getTimeSlot(); + slots.add(slot); + } + return slots; + } + + /** + * This is a getter method for UI. + * + * @return a list of TimeslotWrapper objects. + */ + public List<TimeslotWrapper> getTimeSlotWrappers() { + if (timeSlotWrappers == null) + timeSlotWrappers = timeSlotWrappers(); + + return timeSlotWrappers; + + } + + /* construct the TimeslotWrapper list from the raw data */ + private List<TimeslotWrapper> timeSlotWrappers() { + String meetingType = signupMeeting.getMeetingType(); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(signupMeeting.getStartTime()); + + List<TimeslotWrapper> timeSlotWrappers = new ArrayList<TimeslotWrapper>(); + if (meetingType.equals(INDIVIDUAL)) { + for (int i = 0; i < numberOfSlots; i++) { + SignupTimeslot slot = new SignupTimeslot(); + slot.setMaxNoOfAttendees(numberOfAttendees); + slot.setStartTime(calendar.getTime()); + calendar.add(Calendar.MINUTE, getTimeSlotDuration()); + slot.setEndTime(calendar.getTime()); + slot.setDisplayAttendees(isShowParticipants()); + + TimeslotWrapper wrapper = new TimeslotWrapper(slot); + wrapper.setPositionInTSlist(i); + timeSlotWrappers.add(wrapper); + } + /* set endTime for meeting */ + getMeetingEndTime(); + return timeSlotWrappers; + } + + if (meetingType.equals(GROUP)) { + SignupTimeslot slot = new SignupTimeslot(); + slot.setMaxNoOfAttendees(unlimited ? SignupTimeslot.UNLIMITED : maxOfAttendees); + slot.setStartTime(signupMeeting.getStartTime()); + slot.setEndTime(signupMeeting.getEndTime()); + slot.setDisplayAttendees(isShowParticipants()); + + TimeslotWrapper wrapper = new TimeslotWrapper(slot); + timeSlotWrappers.add(wrapper); + return timeSlotWrappers; + } + + if(meetingType.equals(CUSTOM_TIMESLOTS)){ + List<TimeslotWrapper> tmpTSList = new ArrayList<TimeslotWrapper>(this.customTimeSlotWrpList); + for (TimeslotWrapper tsWrp : tmpTSList) { + tsWrp.getTimeSlot().setDisplayAttendees(isShowParticipants()); + } + return tmpTSList; + } + return null; + } + + /** + * This is a getter method for UI and it provides the time for Signup-begin. + * + * @return a Date object. + */ + public Date getSignupBeginInDate() { + return Utilities.subTractTimeToDate(signupMeeting.getStartTime(), signupBegins, signupBeginsType); + } + + /** + * This is a getter method for UI and it provides the time for + * Signup-Deadline. + * + * @return a Date object. + */ + public Date getSignupDeadlineInDate() { + return Utilities.subTractTimeToDate(signupMeeting.getEndTime(), deadlineTime, deadlineTimeType); + } + + /** + * This is a getter method for UI and it calculates the meeting ending time + * according to meeting type + * + * @return a Date object. + */ + /* */ + public Date getMeetingEndTime() { + if (signupMeeting.getMeetingType().equals(INDIVIDUAL)) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(signupMeeting.getStartTime()); + int internval = getTimeSlotDuration() * numberOfSlots; + calendar.add(Calendar.MINUTE, internval); + signupMeeting.setEndTime(calendar.getTime()); + return calendar.getTime(); + } + + return signupMeeting.getEndTime(); + } + + /** + * This is a getter method. + * + * @return a SakaiFacade object. + */ + public SakaiFacade getSakaiFacade() { + return sakaiFacade; + } + + /** + * This is a setter. + * + * @param sakaiFacade + * a SakaiFacade object. + */ + public void setSakaiFacade(SakaiFacade sakaiFacade) { + this.sakaiFacade = sakaiFacade; + } + + /** + * This is a getter method. + * + * @return a SignupMeetingService object. + */ + public SignupMeetingService getSignupMeetingService() { + return signupMeetingService; + } + + /** + * This is a setter. + * + * @param signupMeetingService + * a SignupMeetingService object. + */ + public void setSignupMeetingService(SignupMeetingService signupMeetingService) { + this.signupMeetingService = signupMeetingService; + } + + /** + * This is a getter method for UI. + * + * @return a SignupMeeting object. + */ + public SignupMeeting getSignupMeeting() { + return signupMeeting; + } + + /** + * This is a setter for UI. + * + * @param signupMeeting + * a SignupMeeting object. + */ + public void setSignupMeeting(SignupMeeting signupMeeting) { + this.signupMeeting = signupMeeting; + } + + /** + * This is a getter method for UI. + * + * @return a HtmlInputHidden object. + */ + public HtmlInputHidden getCurrentStepHiddenInfo() { + return currentStepHiddenInfo; + } + + /** + * This is a setter for UI. + * + * @param htmlInputHidden + * a HtmlInputHidden object. + */ + public void setCurrentStepHiddenInfo(HtmlInputHidden htmlInputHidden) { + this.currentStepHiddenInfo = htmlInputHidden; + } + + /** + * This is a getter method for UI and check if the event/meeting is + * recurred. + * + * @return true if the event/meeting is recurred. + */ + public boolean isRecurrence() { + return recurrence; + } + + /** + * This is a setter for UI. + * + * @param recurrence + * a boolean value. + */ + public void setRecurrence(boolean recurrence) { + this.recurrence = recurrence; + } + + /** + * This is a getter method for UI. + * + * @return an int value. + */ + public int getMaxOfAttendees() { + if (unlimited) + return SignupTimeslot.UNLIMITED; + + return maxOfAttendees; + } + + /** + * This is a setter for UI. + * + * @param maxOfAttendees + * an int value + */ + public void setMaxOfAttendees(int maxOfAttendees) { + this.maxOfAttendees = maxOfAttendees; + } + + /** + * This is a getter method for UI. + * + * @return a HtmlInputHidden object. + */ + public int getNumberOfSlots() { + return numberOfSlots; + } + + /** + * This is a setter method for UI. + * + * @param numberOfSlots + * an int value + */ + public void setNumberOfSlots(int numberOfSlots) { + this.numberOfSlots = numberOfSlots; + } + + /** + * This is a getter method for UI. + * + * @return a HtmlInputHidden object. + */ + public int getTimeSlotDuration() { + if (this.timeSlotDuration == 0) {// first time + long duration = (getSignupMeeting().getEndTime().getTime() - getSignupMeeting().getStartTime().getTime()) + / (MINUTE_IN_MILLISEC * getNumberOfSlots()); + + setTimeSlotDuration((int) duration); + } + return this.timeSlotDuration; + } + + public void setTimeSlotDuration(int timeSlotDuration) { + this.timeSlotDuration = timeSlotDuration; + } + + /** + * This is a getter method for UI. + * + * @return an int value. + */ + public int getNumberOfAttendees() { + return numberOfAttendees; + } + + /** + * This is a setter for UI. + * + * @param numberOfAttendees + * an int value. + */ + public void setNumberOfAttendees(int numberOfAttendees) { + this.numberOfAttendees = numberOfAttendees; + } + + /** + * This is a getter method and it checks if the number of attendees is + * limited. + * + * @return true if the number of attendees is unlimited. + */ + public boolean isUnlimited() { + return unlimited; + } + + /** + * This is a setter for UI. + * + * @param unlimited + * a boolean value. + */ + public void setUnlimited(boolean unlimited) { + this.unlimited = unlimited; + } + + /** + * This is a getter method for UI. + * + * @return an int value. + */ + public int getSignupBegins() { + return signupBegins; + } + + /** + * This is a setter for UI. + * + * @param bookingTime + * an int value. + */ + public void setSignupBegins(int bookingTime) { + this.signupBegins = bookingTime; + } + + /** + * This is a getter method for UI. + * + * @return a string value. + */ + public String getSignupBeginsType() { + return signupBeginsType; + } + + /** + * This is a setter for UI. + * + * @param bookingTimeType + * a string value. + */ + public void setSignupBeginsType(String bookingTimeType) { + this.signupBeginsType = bookingTimeType; + } + + /** + * This is a getter method for UI. + * + * @return an int value. + */ + public int getDeadlineTime() { + return deadlineTime; + } + + /** + * This is a setter for UI. + * + * @param deadlineTime + * an int value. + */ + public void setDeadlineTime(int deadlineTime) { + this.deadlineTime = deadlineTime; + } + + /** + * This is a getter method for UI. + * + * @return a string value. + */ + public String getDeadlineTimeType() { + return deadlineTimeType; + } + + /** + * This is a setter for UI. + * + * @param deadlineTimeType + * a string value. + */ + public void setDeadlineTimeType(String deadlineTimeType) { + this.deadlineTimeType = deadlineTimeType; + } + + /** + * This is a getter method for UI. + * + * @return a list of SignupSiteWrapper objects. + */ + public List<SignupSiteWrapper> getOtherSites() { + if (this.currentSite == null) { + getAvailableSiteGroups(); + } + return otherSites; + } + + /** + * This is a setter method for UI. + * + * @param signupSiteWrapperList + * a list of SignupSiteWrapper object. + */ + public void setOtherSites(List<SignupSiteWrapper> signupSiteWrapperList) { + this.otherSites = signupSiteWrapperList; + } + + /** + * This is a getter method for UI. + * + * @return a SignupSiteWrapper object. + */ + public SignupSiteWrapper getCurrentSite() { + if (this.currentSite == null) { + getAvailableSiteGroups(); + } + return currentSite; + } + + /* + * Due to Authz bug, we have to share the same CreateSitesGroups object. It + * will much simple if Authz bug is fixed. + */ + private void getAvailableSiteGroups() { + Utilities.getSignupMeetingsBean().getCreateSitesGroups().resetSiteGroupCheckboxMark(); + currentSite = Utilities.getSignupMeetingsBean().getCreateSitesGroups().getCurrentSite(); + otherSites = Utilities.getSignupMeetingsBean().getCreateSitesGroups().getOtherSites(); + } + + /** + * This is a setter for UI. + * + * @param currentSite + * a SignupSiteWrapper object. + */ + public void setCurrentSite(SignupSiteWrapper currentSite) { + this.currentSite = currentSite; + } + + /** + * This is a getter method for UI. + * + * @return true if email notification will be sent away. + */ + public boolean getSendEmail() { + if (!getPublishedSite()) + sendEmail = false;// no email notification + + return sendEmail; + } + + + /** + * This is a setter for UI. + * + * @param sendEmail + * a boolean value. + */ + public void setSendEmail(boolean sendEmail) { + this.sendEmail = sendEmail; + } + + /** + * This is a getter method for UI. + * + * @return true if email notification will be the default value. + */ + public boolean getSendEmailByOwner() { + return sendEmailByOwner; + } + + /** + * This is a getter method for UI. + * + * @return a constant string. + */ + public void setSendEmailByOwner(boolean sendEmailByOwner) { + this.sendEmailByOwner = sendEmailByOwner; + } + + /** + * This is a getter method for UI. + * + * @return a constant string. + */ + public String getIndividual() { + return INDIVIDUAL; + } + + /** + * This is a getter method for UI. + * + * @return a constant string. + */ + public String getGroup() { + return GROUP; + } + + /** + * This is a getter method for UI. + * + * @return a constant string. + */ + public String getAnnouncement() { + return ANNOUNCEMENT; + } + + /** + * This is a getter method for UI. + * + * @return a list of SelectItem objects. + */ + public List<SelectItem> getAllAttendees() { + return allAttendees; + } + + /** + * This is a setter. + * + * @param allAttendees + * a list of SelectItem objects. + */ + public void setAllAttendees(List<SelectItem> allAttendees) { + this.allAttendees = allAttendees; + } + + /** + * This is a getter method for UI. + * + * @return true if the name of attendees will be made public. + */ + public boolean isShowParticipants() { + return showParticipants; + } + + /** + * This is a setter for UI. + * + * @param showParticipants + * a boolean value. + */ + public void setShowParticipants(boolean showParticipants) { + this.showParticipants = showParticipants; + } + + private void loadAllAttendees(SignupMeeting meeting) { + if(isEidInputMode()) + return; + + try { + Site site = getSakaiFacade().getSiteService().getSite(getSakaiFacade().getCurrentLocationId()); + if(site !=null){ + int allMemeberSize = site.getMembers()!=null? site.getMembers().size() : 0; + /* + * due to efficiency, user has to input EID instead of using dropdown + * user name list + */ + /*First check to avoid load all site member up if there is ten of thousends*/ + if(allMemeberSize > MAX_NUM_PARTICIPANTS_FOR_DROPDOWN_BEFORE_AUTO_SWITCH_TO_EID_INPUT_MODE){ + setEidInputMode(true); + return; + } + } + } catch (IdUnusedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + this.allSignupUsers = sakaiFacade.getAllPossibleAttendees(meeting); + + if (allSignupUsers != null + && allSignupUsers.size() > MAX_NUM_PARTICIPANTS_FOR_DROPDOWN_BEFORE_AUTO_SWITCH_TO_EID_INPUT_MODE) { + setEidInputMode(true); + return; + } + + setEidInputMode(false); + this.allAttendees = new ArrayList<SelectItem>(); + SelectItem sItem = new SelectItem("", " " + Utilities.rb.getString("label.select.attendee")); + allAttendees.add(sItem); + String previous_displayName =""; + int index = 0; + for (SignupUser user : allSignupUsers) { + if(user.getDisplayName().equals(previous_displayName)){ + allAttendees.add(new SelectItem(user.getEid(), user.getDisplayName()+ "(" + user.getEid() +")")); + SelectItem prev_sItem = allAttendees.get(index); + //checking: not already has eid for triple duplicates case + if(!prev_sItem.getLabel().contains("(")){ + prev_sItem.setLabel(prev_sItem.getLabel() + " (" + prev_sItem.getValue() +")"); + } + + }else { + allAttendees.add(new SelectItem(user.getEid(), user.getDisplayName())); + } + + previous_displayName = user.getDisplayName(); + index++; + } + } + + /** + * This is a getter method for UI. + * + * @return an UIInput object. + */ + public UIInput getNewAttendeeInput() { + return newAttendeeInput; + } + + /** + * This is a setter for UI. + * + * @param newAttendeeInput + * an UIInput object. + */ + public void setNewAttendeeInput(UIInput newAttendeeInput) { + this.newAttendeeInput = newAttendeeInput; + } + + /** + * This is a getter method for UI. + * + * @return an UIData object. + */ + public UIData getTimeslotWrapperTable() { + return timeslotWrapperTable; + } + + /** + * This is a setter for UI. + * + * @param timeslotWrapperTable + * an UIData object. + */ + public void setTimeslotWrapperTable(UIData timeslotWrapperTable) { + this.timeslotWrapperTable = timeslotWrapperTable; + } + + /** + * This is a getter method for UI. + * + * @return true if the organizer want to receive email notification from + * attendees. + */ + public boolean isReceiveEmail() { + return receiveEmail; + } + + /** + * This is a setter for UI. + * + * @param receiveEmail + * a boolean value. + */ + public void setReceiveEmail(boolean receiveEmail) { + this.receiveEmail = receiveEmail; + } + + /** + * This is a getter method for UI. + * + * @return a constant string value. + */ + public String getAttendeeUserId() { + return PARAM_NAME_FOR_ATTENDEE_USERID; + } + + /** + * This is a getter method for UI. + * + * @return true if it's an announcement event/meeting type. + */ + public boolean isAnnouncementType() { + return ANNOUNCEMENT.equals(getSignupMeeting().getMeetingType()); + } + + /** + * This is a getter method for UI. + * + * @return true if it's an group event/meeting type. + */ + public boolean isGroupType() { + return GROUP.equals(getSignupMeeting().getMeetingType()); + } + + /** + * This is a getter method for UI. + * + * @return true if it's an individual event/meeting type. + */ + public boolean isIndividualType() { + return INDIVIDUAL.equals(getSignupMeeting().getMeetingType()); + } + + /** + * This is a getter method for UI. + * + * @return true if it's an individual event/meeting type. + */ + public boolean isCustomTimeslotType() { + return CUSTOM_TIMESLOTS.equals(getSignupMeeting().getMeetingType()); + } + + /** + * This is for UI purpose and it displays the meeting type, which user can + * redefine in message bundle + * + * @return a meeting display type + */ + public String getDisplayCurrentMeetingType() { + String mType = ""; + if (isIndividualType()) + mType = Utilities.rb.getString("label_individaul"); + else if (isGroupType()) + mType = Utilities.rb.getString("label_group"); + else if (isAnnouncementType()) + mType = Utilities.rb.getString("label_announcement"); + else if (isUserDefinedTS()) + mType = Utilities.rb.getString("label_custom_timeslots"); + + return mType; + } + + /** + * This is a getter method for UI. + * + * @return true if it's in the eid-input mode. + */ + public boolean isEidInputMode() { + return eidInputMode; + } + + /** + * This is a setter. + * + * @param eidInputMode + * a boolean value. + */ + public void setEidInputMode(boolean eidInputMode) { + this.eidInputMode = eidInputMode; + } + + /** + * This is for Javascript UI only. + * + * @return empty string. + */ + public String getUserInputEidOrEmail() { + return ""; + } + + /** + * This is for Javascript UI only. + * + * @param value + * eid or email for the user + */ + public void setUserInputEidOrEmail(String value) { + if (StringUtils.isNotBlank(value)) { + this.eidOrEmailInputByUser = value; + } + } + + /* Proxy method */ + private String getEidOrEmailInputByUser() { + String eid = this.eidOrEmailInputByUser; + this.eidOrEmailInputByUser = null;// reset for use once only + return eid; + } + + private void processSaveMeetings() { + signupMeeting.setRepeatUntil(getRepeatUntil()); + int repeatNum = getOccurrences(); + if("1".equals(getRecurLengthChoice())){ + repeatNum = CreateMeetings.getNumOfRecurrence(getRepeatType(), signupMeeting.getStartTime(), + getRepeatUntil()); + } + signupMeeting.setRepeatNum(repeatNum); + signupMeeting.setRepeatType(getRepeatType()); + + if(CUSTOM_TIMESLOTS.equals(this.signupMeeting.getMeetingType())){ + boolean multipleCalBlocks = getUserDefineTimeslotBean().getPutInMultipleCalendarBlocks(); + signupMeeting.setInMultipleCalendarBlocks(multipleCalBlocks); + } + + /*pass who should receive the emails*/ + signupMeeting.setSendEmailToSelectedPeopleOnly(this.sendEmailToSelectedPeopleOnly); + + CreateMeetings createMeeting = new CreateMeetings(signupMeeting, sendEmail, + !assignParicitpantsToAllRecurEvents, assignParicitpantsToAllRecurEvents, getSignupBegins(), + getSignupBeginsType(), getDeadlineTime(), getDeadlineTimeType(), getRecurLengthChoice(), sakaiFacade, signupMeetingService, + getAttachmentHandler(), sakaiFacade.getCurrentUserId(), sakaiFacade.getCurrentLocationId(), true); + + try { + /*need push to calendar tool*/ + createMeeting.setPublishToCalendar(getPublishToCalendar()); + + /*do we want to also create groups? */ + createMeeting.setCreateGroups(this.createGroups); + + createMeeting.processSaveMeetings(); + + /*handle attachments and it should not be cleaned up in CHS*/ + this.attachments.clear(); + + } catch (PermissionException e) { + logger.info(Utilities.rb.getString("no.permission_create_event") + " - " + e.getMessage()); + } catch (Exception e) { + logger.error(Utilities.rb.getString("error.occurred_try_again") + " - " + e.getMessage()); + Utilities.addErrorMessage(Utilities.rb.getString("error.occurred_try_again")); + } + + } + + /** + * This is a getter for UI + * + * @return a boolean value + */ + public boolean isAssignParicitpantsToAllRecurEvents() { + return assignParicitpantsToAllRecurEvents; + } + + /** + * This is a setter method for UI + * + * @param assignParicitpantsToAllRecurEvents + * a boolean vaule + */ + public void setAssignParicitpantsToAllRecurEvents(boolean assignParicitpantsToAllRecurEvents) { + this.assignParicitpantsToAllRecurEvents = assignParicitpantsToAllRecurEvents; + } + + private String eventFreqType = ""; + + /** + * This is a getter method for UI + * + * @return a event frequency type string + */ + public String getEventFreqType() { + eventFreqType = ""; + if (getRepeatType().equals(DAILY)) + eventFreqType = Utilities.rb.getString("label_daily"); + else if (getRepeatType().equals(WEEKDAYS)) + eventFreqType = Utilities.rb.getString("label_weekdays"); + else if (getRepeatType().equals(WEEKLY)) + eventFreqType = Utilities.rb.getString("label_weekly"); + else if (getRepeatType().equals(BIWEEKLY)) + eventFreqType = Utilities.rb.getString("label_biweekly"); + + return eventFreqType; + } + + /** + * This is a getter method for UI and it provides the selected + * site(s)/group(s) by user. + * + * @return a list of SignupSite objects. + */ + public List<SignupSite> getSelectedSignupSites() { + return CreateSitesGroups.getSelectedSignupSites(this.currentSite, this.otherSites); + } + + /** + * This is a getter method for UI and it provides the meeting types for + * radio buttons. + * + * @return a list of SelectItem objects. + */ + public List<SelectItem> getMeetingTypeRadioBttns() { + this.meetingTypeRadioBttns = Utilities.getMeetingTypeSelectItems("", false); + return meetingTypeRadioBttns; + } + + /** + * This is a getter method for UI + * + * @return true if the site is published. + */ + public Boolean getPublishedSite() { + if (this.publishedSite == null) { + try { + boolean status = sakaiFacade.getSiteService().getSite(sakaiFacade.getCurrentLocationId()).isPublished(); + this.publishedSite = new Boolean(status); + + } catch (Exception e) { + logger.warn(e.getMessage()); + this.publishedSite = new Boolean(false); + + } + } + + return publishedSite.booleanValue(); + } + + /** + * This is a getter method for UI + * @return true if the ending time is adjusted. + */ + public boolean isEndTimeAutoAdjusted() { + return endTimeAutoAdjusted; + } + + /** + * This is a setter method. + * @param endTimeAutoAdjusted + */ + public void setEndTimeAutoAdjusted(boolean endTimeAutoAdjusted) { + this.endTimeAutoAdjusted = endTimeAutoAdjusted; + } + + public boolean isAllowWaitList() { + return allowWaitList; + } + + public void setAllowWaitList(boolean allowWaitList) { + this.allowWaitList = allowWaitList; + } + + public boolean isAllowComment() { + return allowComment; + } + + public void setAllowComment(boolean allowComment) { + this.allowComment = allowComment; + } + + public boolean isAutoReminder() { + return autoReminder; + } + + public void setAutoReminder(boolean autoReminder) { + this.autoReminder = autoReminder; + } + + public boolean isAutoReminderOptionChoice() { + return autoReminderOptionChoice; + } + + public void setAutoReminderOptionChoice(boolean autoReminderOptionChoice) { + this.autoReminderOptionChoice = autoReminderOptionChoice; + } + + public boolean isUserIdInputModeOptionChoice() { + return userIdInputModeOptionChoice; + } + + public void setUserIdInputModeOptionChoice(boolean userIdInputModeOptionChoice) { + this.userIdInputModeOptionChoice = userIdInputModeOptionChoice; + } + + public List<SignupAttachment> getAttachments() { + return attachments; + } + + public void setAttachments(List<SignupAttachment> attachments) { + this.attachments = attachments; + } + + public AttachmentHandler getAttachmentHandler() { + return attachmentHandler; + } + + public void setAttachmentHandler(AttachmentHandler attachmentHandler) { + this.attachmentHandler = attachmentHandler; + } + + public boolean isAttachmentsEmpty(){ + if (this.attachments !=null && this.attachments.size()>0) + return false; + else + return true; + } + + public boolean isAllLocationsEmpty(){ + // this is safe to call often since we cache the locations + //it already has one label item in + return !(getAllLocations().size()>1); + + } + + public boolean isCategoriesExist() { + // this is safe to call often since we cache the categories + return getAllCategories().size()>1; + } + + public UserDefineTimeslotBean getUserDefineTimeslotBean() { + return userDefineTimeslotBean; + } + + public void setUserDefineTimeslotBean(UserDefineTimeslotBean userDefineTimeslotBean) { + this.userDefineTimeslotBean = userDefineTimeslotBean; + } + + public List<TimeslotWrapper> getCustomTimeSlotWrpList() { + return customTimeSlotWrpList; + } + + public void setCustomTimeSlotWrpList(List<TimeslotWrapper> customTimeSlotWrpList) { + this.customTimeSlotWrpList = customTimeSlotWrpList; + } + + public boolean isUserDefinedTS() { + return userDefinedTS; + } + + public void setUserDefinedTS(boolean userDefinedTS) { + this.userDefinedTS = userDefinedTS; + } + + public boolean getPublishToCalendar() { + return publishToCalendar; + } + + public void setPublishToCalendar(boolean publishToCalendar) { + this.publishToCalendar = publishToCalendar; + } + + public boolean getCreateGroups() { + return createGroups; + } + + public void setCreateGroups(boolean createGroups) { + this.createGroups = createGroups; + } + + public String getRecurLengthChoice() { + return recurLengthChoice; + } + + public void setRecurLengthChoice(String recurLengthChoice) { + this.recurLengthChoice = recurLengthChoice; + } + + public int getOccurrences() { + return occurrences; + } + + public void setOccurrences(int occurrences) { + this.occurrences = occurrences; + } + + /** + * @return true if sakai property signup.enableAttendance is true, else will return false + */ + public boolean isAttendanceOn() { + return Utilities.getSignupMeetingsBean().isAttendanceOn(); + } + + /** + * Get a list of users that have permission, but format it as a SelectItem list for the dropdown. + * Since this is a new item there will be no current instructor so it returns the current user at the top of the list + * We send a null signup meeting param as this is a new meeting. + */ + public List<SelectItem> getInstructors() { + return Utilities.getSignupMeetingsBean().getInstructors(null); + } + + /** + * Get the instructor name attached to the value currently set for the instructor + */ + public String getInstructorName() { + return Utilities.getSignupMeetingsBean().getInstructorName(creatorUserId); + } + + /** + * Gets the userId for a user, given an eid or an email address. + * We check if it matches the eid first, then if it matches an email address. + * If nothing, return null. + * + * @param value the string to lookup, could be an eid or an email address + * @return the userId or null if User cannot be found + */ + public String getUserIdForEidOrEmail(String value) { + User u = sakaiFacade.getUserByEid(value); + if(u==null) { + u=sakaiFacade.getUserByEmail(value); + } + + if(u!=null) { + return u.getId(); + } + + return null; + } + + /** + * Get the eids assocaited with an email address, ie there may be two or more users with the same email address. + * We need to be able to handle this in the UI. + * + * @param email + * @return List<String> of eids. + */ + public List<String> getEidsForEmail(String email) { + List<User> users = sakaiFacade.getUsersByEmail(email); + + List<String> eids = new ArrayList<String>(); + for(User u:users) { + eids.add(u.getEid()); + } + + return eids; + } + + public List<SignupUser> getAllPossibleCoordinators() { + return allPossibleCoordinators; + } + + public void setAllPossibleCoordinators(List<SignupUser> allPossibleCoordinators) { + this.allPossibleCoordinators = allPossibleCoordinators; + } + + /** + * This is for UI page to determine whether the email checkbox should be checked and disabled to change + * @return + */ + public boolean isMandatorySendEmail(){ + return this.mandatorySendEmail; + } + + public String getSendEmailToSelectedPeopleOnly() { + return sendEmailToSelectedPeopleOnly; + } + + public void setSendEmailToSelectedPeopleOnly( + String sendEmailToSelectedPeopleOnly) { + this.sendEmailToSelectedPeopleOnly = sendEmailToSelectedPeopleOnly; + } + + private String iframeId = ""; + + /** + * This is a getter method which provide current Iframe id for refresh + * IFrame purpose. + * + * @return a String + */ + public String getIframeId() { + HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext() + .getRequest(); + String iFrameId = (String) request.getAttribute("sakai.tool.placement.id"); + return iFrameId; + } + + public void setIframeId(String iframeId) { + this.iframeId = iframeId; + } + +} diff --git a/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/SignupMeetingsBean.java b/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/SignupMeetingsBean.java index b596fe24fd81..678db3c8b34e 100644 --- a/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/SignupMeetingsBean.java +++ b/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/SignupMeetingsBean.java @@ -1,1160 +1,1160 @@ -/* -* Licensed to The Apereo Foundation under one or more contributor license -* agreements. See the NOTICE file distributed with this work for -* additional information regarding copyright ownership. -* -* The Apereo Foundation licenses this file to you 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: -* -* http://opensource.org/licenses/ecl2.txt -* -* 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.sakaiproject.signup.tool.jsf; - -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collections; -import java.util.Date; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import javax.faces.component.UIData; -import javax.faces.context.FacesContext; -import javax.faces.event.ValueChangeEvent; -import javax.faces.model.SelectItem; -import javax.servlet.http.HttpServletRequest; - -import lombok.Getter; -import lombok.Setter; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.sakaiproject.signup.logic.Permission; -import org.sakaiproject.signup.logic.SakaiFacade; -import org.sakaiproject.signup.logic.SignupEventTypes; -import org.sakaiproject.signup.logic.SignupMeetingService; -import org.sakaiproject.signup.model.SignupAttachment; -import org.sakaiproject.signup.model.SignupMeeting; -import org.sakaiproject.signup.tool.jsf.attendee.AttendeeSignupMBean; -import org.sakaiproject.signup.tool.jsf.organizer.AttendanceSignupBean; -import org.sakaiproject.signup.tool.jsf.organizer.OrganizerSignupMBean; -import org.sakaiproject.signup.tool.jsf.organizer.action.CreateSitesGroups; -import org.sakaiproject.signup.tool.util.SignupBeanConstants; -import org.sakaiproject.signup.tool.util.Utilities; -import org.sakaiproject.tool.cover.ToolManager; -import org.sakaiproject.user.api.User; - -/** - * <p> - * This JSF UIBean class will handle information exchanges between main - * events/meetings list view page:<b>orgSignupMeetings.jsp</b> and backbone - * system. It provides all the necessary business logic - * </P> - */ -public class SignupMeetingsBean implements SignupBeanConstants { - - private static Log log = LogFactory.getLog(SignupMeetingsBean.class); - - protected UIData meetingTable; - - protected String viewDateRang = ALL_FUTURE;// default setting - - protected SignupMeetingService signupMeetingService; - - protected List<SignupMeetingWrapper> signupMeetings; - - protected SakaiFacade sakaiFacade; - - protected AttendeeSignupMBean attendeeSignupMBean; - - protected OrganizerSignupMBean organizerSignupMBean; - - protected AttendanceSignupBean attendanceSignupBean; - - private NewSignupMeetingBean newSignupMeetingBean; - - protected SignupSorter signupSorter = new SignupSorter(); - - protected Boolean showAllRecurMeetings = null; - - protected boolean enableExpandOption = false; - - protected List<SelectItem> viewDropDownList; - - protected final String disabledSelectView = "none"; - - protected String meetingUnavailableMessages; - - protected Boolean categoriesExist = null; - - protected Boolean locationsExist = null; - - - @Getter @Setter - protected String categoryFilter = CATERGORY_FILER_ALL; // default setting is blank, which means all categories - - - /** - * Default Constructor - * - */ - public SignupMeetingsBean() { - } - - /** - * This is a getter method. - * - * @return the current user display name. - */ - public String getCurrentUserDisplayName() { - return sakaiFacade.getUserDisplayName(sakaiFacade.getCurrentUserId()); - } - - /** - * This is a JSF action call method by UI to navigate to add new - * event/meeting page. - * - * @return an action outcome string. - */ - public String addMeeting() { - getNewSignupMeetingBean().reset(); - return ADD_MEETING_PAGE_URL; - } - - /** - * This is a JSF action call method by UI to remove the selected - * events/meetings. - * - * @return an action outcome string. - */ - public String removeMeetings() { - Set<SignupMeeting> meetingsSet = new HashSet<SignupMeeting>(); - - try { - for (SignupMeetingWrapper mWrapper : getSignupMeetings()) { - if (mWrapper.isSelected()) { - - //SIGNUP-139 - //if this meeting wrapper is the first one in a set of recurring meetings - //and we have recurring meetings - //then get all meetings have the same meeting.recurrenceId (as they are part of the set) and add to the list for removal - if(mWrapper.isFirstOneRecurMeeting() && mWrapper.getRecurEventsSize() > 1) { - SignupMeeting topLevel = mWrapper.getMeeting(); - - List<SignupMeeting> recurrentMeetings = signupMeetingService.getRecurringSignupMeetings(sakaiFacade.getCurrentLocationId(), sakaiFacade.getCurrentUserId(), topLevel.getRecurrenceId(), topLevel.getStartTime()); - - meetingsSet.addAll(recurrentMeetings); - } - meetingsSet.add(mWrapper.getMeeting()); - } - } - - List<SignupMeeting> meetings = new ArrayList<SignupMeeting>(meetingsSet); - - signupMeetingService.removeMeetings(meetings); - /* record the logs of the removed meetings */ - for (SignupMeeting meeting : meetings) { - log.info("Meeting Name:" - + meeting.getTitle() - + " - UserId:" - + sakaiFacade.getCurrentUserId() - + " - has removed the meeting at meeting startTime:" - + getSakaiFacade().getTimeService().newTime(meeting.getStartTime().getTime()) - .toStringLocalFull()); - - Utilities.postEventTracking(SignupEventTypes.EVENT_SIGNUP_MTNG_REMOVE, ToolManager.getCurrentPlacement().getContext() + " meetingId|title:" - + meeting.getId() + "|" + meeting.getTitle() + " at startTime:" + getSakaiFacade().getTimeService().newTime(meeting.getStartTime().getTime()) - .toStringLocalFull()); - - } - - try { - signupMeetingService.removeCalendarEvents(meetings); - } catch (Exception e) { - Utilities.addErrorMessage(Utilities.rb.getString("error.calendarEvent.removal_failed")); - log.error(Utilities.rb.getString("error.calendarEvent.removal_failed") + " - " + e.getMessage()); - } - /*cleanup attachments in contentHS*/ - for (SignupMeeting m : meetings) { - List<SignupAttachment> attachs= m.getSignupAttachments(); - if(attachs !=null){ - for (SignupAttachment attach : attachs) { - getNewSignupMeetingBean().getAttachmentHandler().removeAttachmentInContentHost(attach); - } - } - } - - } catch (Exception e) { - log.error(Utilities.rb.getString("Failed.remove.event") + " - " + e.getMessage()); - Utilities.addErrorMessage(Utilities.rb.getString("Failed.remove.event")); - } - signupMeetings = null;// TODO:do it more efficiently - - return MAIN_EVENTS_LIST_PAGE_URL; - } - - /** - * Get a list of locations for the UI. Unfiltered. - * @return - */ - private long lastUpdatedLocTime = 0; - private List<SelectItem> allLocations = null; - public List<SelectItem> getAllLocations(){ - long curr_time=(new Date()).getTime(); - //avoid multiple calls for one page loading : not refresh within one second - if(allLocations == null || curr_time - lastUpdatedLocTime > 1000){ - //Set<String> set = new HashSet<String>(); - List<SelectItem> locations= new ArrayList<SelectItem>(); - //List<SignupMeetingWrapper> allMeetings = getMeetingWrappers(VIEW_ALL, null); - List<String> allLocs = null; - try { - allLocs = signupMeetingService.getAllLocations(sakaiFacade.getCurrentLocationId()); - } catch (Exception e) { - //do nothing - allLocs=null; - } - if(allLocs !=null){ - for(String lc : allLocs) { - if(StringUtils.isNotBlank(lc)) { - locations.add(new SelectItem(lc)); - } - } - } - - if(!locations.isEmpty()){ - //avoid multiple call later - this.locationsExist = new Boolean(true); - } - else{ - this.locationsExist = new Boolean(false); - } - - lastUpdatedLocTime = curr_time; - allLocations = locations; - } - - return allLocations; - - } - - private long lastUpdatedCatTime = 0; - private List<SelectItem> allCategories = null; - public List<SelectItem> getAllCategories(){ - - long curr_time=(new Date()).getTime(); - //avoid multiple calls for one page loading : not refresh within one second - if(allCategories == null || curr_time - lastUpdatedCatTime > 1000){ - List<SelectItem> categories = new ArrayList<SelectItem>(); - List<String> allCats = null; - try { - allCats = signupMeetingService.getAllCategories(sakaiFacade.getCurrentLocationId()); - } catch (Exception e) { - //do nothing - allCats=null; - } - if(allCats !=null){ - for(String c : allCats) { - if(StringUtils.isNotBlank(c)) { - categories.add(new SelectItem(c)); - } - } - } - - if(!categories.isEmpty()){ - //avoid multiple call later - this.categoriesExist = new Boolean(true); - } - else{ - this.categoriesExist = new Boolean(false); - } - - lastUpdatedCatTime = curr_time; - categories.add(0, new SelectItem(CATERGORY_FILER_ALL, Utilities.rb.getString("filter_categories_top"))); - allCategories = categories; - } - - return allCategories; - } - - /** - * This is a JSF action call method by UI to navigate to view the specific - * event/meeting page. - * - * @return an action outcome string. - */ - public String processSignup() { - // TODO ??? need to check if we have covered the case for people, who - // have only view permission; we need - // to disable everything in that page - SignupMeetingWrapper meetingWrapper=null; - try{ - meetingWrapper = (SignupMeetingWrapper) meetingTable.getRowData(); - } - catch (Exception ex){ - /* sometimes, it throw - * java.lang.IllegalArgumentException - * at javax.faces.model.ListDataModel.getRowData(ListDataModel.java:139) - * Retry for user - */ - //reset main page data - setSignupMeetings(null); - return MAIN_EVENTS_LIST_PAGE_URL; - } - - Permission permission = meetingWrapper.getMeeting().getPermission(); - try { - if (permission.isUpdate()) { - organizerSignupMBean.init(meetingWrapper); - return ORGANIZER_MEETING_PAGE_URL; - } - - attendeeSignupMBean.init(meetingWrapper); - - } catch (Exception e) { - return MAIN_EVENTS_LIST_PAGE_URL; - } - return ATTENDEE_MEETING_PAGE_URL; - } - - /** - * This is a JSF action call method by UI to navigate to view the specific - * event/meeting attendance page. - * - * @return an action outcome string. - */ - public String processSignupAttendance() { - - SignupMeetingWrapper meetingWrapper = (SignupMeetingWrapper) meetingTable.getRowData(); - Permission permission = meetingWrapper.getMeeting().getPermission(); - try { - if (permission.isUpdate()) { - attendanceSignupBean.init(meetingWrapper); - return ATTENDANCE_PAGE_URL; - } - - } catch (Exception e) { - return ATTENDANCE_PAGE_URL; - } - return ATTENDANCE_PAGE_URL; - } - - /** - * This is a ValueChange Listener to watch the view-range type selection by - * user. - * - * @param vce - * a ValuechangeEvent object. - * @return a outcome string. - */ - public String processSelectedRange(ValueChangeEvent vce) { - String viewRange = (String) vce.getNewValue(); - if (disabledSelectView.equals(viewRange)) - return MAIN_EVENTS_LIST_PAGE_URL;// do-nothing for IE browser - // case - - setViewDateRang(viewRange); - setSignupMeetings(null);// reset - - return MAIN_EVENTS_LIST_PAGE_URL; - - } - - /** - * This is a ValueChange Listener to watch the show-all-recurring-events - * check-box value change by user. - * - * @param vce - * a ValuechangeEvent object. - * @return a outcome string. - */ - public String processExpandAllRcurEvents(ValueChangeEvent vce) { - Boolean expandAllEvents = (Boolean) vce.getNewValue(); - setShowAllRecurMeetings(expandAllEvents.booleanValue()); - List<SignupMeetingWrapper> smWrappers = getSignupMeetings(); - if (smWrappers != null) { - if (isShowAllRecurMeetings()) { - for (SignupMeetingWrapper smWrp : smWrappers) { - smWrp.setRecurEventsSize(0); - smWrp.setSubRecurringMeeting(false); - } - } else { - getSignupSorter().setSortAscending(true); - getSignupSorter().setSortColumn(SignupSorter.DATE_COLUMN); - getSignupSorter().sort(smWrappers); - markingRecurMeetings(smWrappers); - setSignupMeetings(smWrappers); - } - } - - return MAIN_EVENTS_LIST_PAGE_URL; - - } - - /** - * This is a getter method for UI. - * - * @return a SakaiFacade object. - */ - public SakaiFacade getSakaiFacade() { - return sakaiFacade; - } - - /** - * This is a setter. - * - * @param sakaiFacade - * a SakaiFacade object. - */ - public void setSakaiFacade(SakaiFacade sakaiFacade) { - this.sakaiFacade = sakaiFacade; - } - - /** - * This is a getter method. - * - * @return a SignupMeetingService object. - */ - public SignupMeetingService getSignupMeetingService() { - return signupMeetingService; - } - - /** - * This is a setter. - * - * @param signupMeetingService - * a SignupMeetingService object. - */ - public void setSignupMeetingService(SignupMeetingService signupMeetingService) { - this.signupMeetingService = signupMeetingService; - } - - /** - * This is a getter method for UI and filters the list according to what has been set. - * - * @return a list of SignupMeetingWrapper objects. - */ - public List<SignupMeetingWrapper> getSignupMeetings() { - try { - if (signupMeetings == null || isRefresh()) { - loadMeetings(getViewDateRang(), getCategoryFilter()); - setLastUpdatedTime(new Date().getTime()); - } - - } catch (Exception e) { - log.error(Utilities.rb.getString("failed.fetch_allEvents_from_db") + " - " + e.getMessage()); - Utilities.addErrorMessage(Utilities.rb.getString("failed.fetch_allEvents_from_db")); - } - return signupMeetings; - } - - /** - * This is a getter method for UI and returns all signup meetings. Ignores any filters. - * - * @return a list of SignupMeetingWrapper objects. - */ - // TODO how to handle this more efficiently - public List<SignupMeetingWrapper> getAllSignupMeetings() { - try { - loadMeetings(VIEW_ALL, null); - } catch (Exception e) { - log.error(Utilities.rb.getString("failed.fetch_allEvents_from_db") + " - " + e.getMessage()); - Utilities.addErrorMessage(Utilities.rb.getString("failed.fetch_allEvents_from_db")); - } - return signupMeetings; - } - - /** - * Loads the signup meetings and updates the bean state - * @param viewRange - * @param categoryFilter - */ - private void loadMeetings(String viewRange, String categoryFilter) { - - List<SignupMeetingWrapper> mWrappers = getMeetingWrappers(viewRange, categoryFilter); - if (!isShowAllRecurMeetings()) { - markingRecurMeetings(mWrappers); - } - setSignupMeetings(mWrappers); - } - - private void markingRecurMeetings(List<SignupMeetingWrapper> smList) { - if (smList == null || smList.size() == 0) - return; - - /* - * Assume that the list is already sorted by Date (default Date sorting - * by sql-query) - */ - for (int i = 0; i < smList.size(); i++) { - SignupMeetingWrapper smWrapper = (SignupMeetingWrapper) smList.get(i); - Long firstRecurId = smWrapper.getMeeting().getRecurrenceId(); - if (firstRecurId != null && firstRecurId.longValue() >= 0 && !smWrapper.isSubRecurringMeeting()) { - int index = 0; - for (int j = i + 1; j < smList.size(); j++) { - SignupMeetingWrapper nextOne = (SignupMeetingWrapper) smList.get(j); - if (nextOne.getMeeting().getRecurrenceId() != null - && nextOne.getMeeting().getRecurrenceId().longValue() == firstRecurId.longValue()) { - nextOne.setSubRecurringMeeting(true); - nextOne.setRecurId(firstRecurId + "_" + index++); - - } - } - smWrapper.setRecurEventsSize(index + 1); - } - } - } - - private List<SignupMeetingWrapper> getMeetingWrappers(String viewRange, String categoryFilter) { - String currentUserId = sakaiFacade.getCurrentUserId(); - if(!isUserLoggedInStatus()){ - /*Let user log-in first*/ - return null; - } - - List<SignupMeeting> signupMeetings = null; - Calendar calendar = Calendar.getInstance(); - calendar.setTime(new Date()); - - if (VIEW_ALL.equals(viewRange)) { - signupMeetings = signupMeetingService.getAllSignupMeetings(sakaiFacade.getCurrentLocationId(), currentUserId); - } else if (!OLD_DAYS.equals(viewRange)) { - /* including today's day for search */ - int currentHour = calendar.get(Calendar.HOUR_OF_DAY); - int currentMinutes = calendar.get(Calendar.MINUTE); - calendar.add(Calendar.HOUR, -1 * currentHour); - calendar.add(Calendar.MINUTE, -1 * currentMinutes); - String searchDateStr = viewRange; - - if (VIEW_MY_SIGNED_UP.equals(viewRange) || VIEW_IMMEDIATE_AVAIL.equals(viewRange)) { - searchDateStr = ALL_FUTURE; - } - - signupMeetings = signupMeetingService.getSignupMeetings(sakaiFacade.getCurrentLocationId(), currentUserId, calendar.getTime(), Utilities.getUserDefinedDate(Integer.parseInt(searchDateStr))); - - } else if (OLD_DAYS.equals(viewRange)) { - // calendar.add(Calendar.HOUR, 1 * 24);//exluding today for search - signupMeetings = signupMeetingService.getSignupMeetings(sakaiFacade.getCurrentLocationId(), currentUserId, calendar.getTime()); - } - - if (signupMeetings == null || signupMeetings.isEmpty()) { - return null; - } - - //SIGNUP-173 filter list by categoryFilter - //if no category, add them all - List<SignupMeeting> filteredCategorySignupMeetings = new ArrayList<SignupMeeting>(); - if(StringUtils.isNotBlank(categoryFilter) && !StringUtils.equals(CATERGORY_FILER_ALL,categoryFilter)) { - for(SignupMeeting s: signupMeetings) { - if(StringUtils.equals(s.getCategory(), categoryFilter)) { - filteredCategorySignupMeetings.add(s); - } - } - } else { - filteredCategorySignupMeetings.addAll(signupMeetings); - } - - List<SignupMeetingWrapper> wrappers = new ArrayList<SignupMeetingWrapper>(); - for (SignupMeeting meeting : filteredCategorySignupMeetings) { - SignupMeetingWrapper wrapper = new SignupMeetingWrapper(meeting, sakaiFacade.getUserDisplayName(meeting - .getCreatorUserId()), sakaiFacade.getCurrentUserId(), getSakaiFacade()); - wrappers.add(wrapper); - } - - /* filter out not-relevant ones */ - signupFilter filter = new signupFilter(currentUserId, viewRange); - filter.filterSignupMeetings(wrappers); - - /* show user the option check-box to expand all */ - setEnableExpandOption(false); - for (SignupMeetingWrapper meetingWrp : wrappers) { - if (meetingWrp.getMeeting().isRecurredMeeting()) - setEnableExpandOption(true); - } - - return wrappers; - } - - /** - * This is a getter method for UI. - * - * @return true if atleast one of the meeting has delete permission for the - * current user. - */ - public boolean isAllowedToDelete() { - if (sakaiFacade.isAllowedSite(sakaiFacade.getCurrentUserId(), SakaiFacade.SIGNUP_DELETE_SITE, sakaiFacade.getCurrentLocationId())) { - return true; - } - - if (getSignupMeetings() == null) { - return false; - } - - for (SignupMeetingWrapper meetingW : signupMeetings) { - if (meetingW.getMeeting().getPermission().isDelete()) - return true; - } - - return false; - - } - - /** - * This is a getter method for UI. - * - * @return true if at least one of the meetings has update permission for the - * current user. - */ - public boolean isAllowedToUpdate() { - // Do we really need to loop through 1000 meetings if the user has elevated site permissions?! - if (sakaiFacade.isAllowedSite(sakaiFacade.getCurrentUserId(), SakaiFacade.SIGNUP_UPDATE_SITE, sakaiFacade.getCurrentLocationId())) { - return true; - } - - // This call to getSignupMeetings() is going to make Hibernate load lots and lots of data - if (getSignupMeetings() == null) { - return false; - } - - for (SignupMeetingWrapper meetingW : signupMeetings) { - if (meetingW.getMeeting().getPermission().isUpdate()) { - return true; - } - } - - return false; - - } - - /** - * This is a getter method for UI. - * - * @return true if atleast one of the meeting is available to the current - * user. - */ - public boolean isMeetingsAvailable() { - getSignupMeetings(); - return !(signupMeetings == null || signupMeetings.isEmpty()); - } - - /** - * This is a getter method for UI. - * - * @return true if we have categories already - * - */ - public boolean isCategoriesAvailable() { - //getSignupMeetings(); - if(this.categoriesExist == null){ - //initialization first - getAllCategories(); - } - - return this.categoriesExist.booleanValue(); - } - - /** - * This is a getter method for UI. - * - * @return true if we have categories already - * - */ - public boolean isLocationsAvailable() { - //getSignupMeetings(); - if(this.locationsExist == null){ - //initialization first - getAllLocations(); - } - - return this.locationsExist.booleanValue(); - } - - /** - * This provides information of user's View selection for UI - * - * @return true if user has select 'all future meetings' or 'all' for view - */ - public boolean isSelectedViewFutureMeetings() { - boolean t = false; - if (getViewDateRang().equals(ALL_FUTURE)) - t = true; - return t; - } - - /** - * This provides information of user's View selection for UI - * - * @return true if user has select 'all meetings' or 'all' for view - */ - public boolean isSelectedViewAllMeetings() { - boolean t = false; - if (getViewDateRang().equals(VIEW_ALL)) - t = true; - return t; - } - - /** - * This is a getter method for UI. - * - * @return true if atleast one of the meeting has create permission for the - * current user. - */ - private CreateSitesGroups createSitesGroups = null; - - public boolean isAllowedToCreate() { - boolean allowed = signupMeetingService.isAllowedToCreateAnyInSite(sakaiFacade.getCurrentUserId(), sakaiFacade - .getCurrentLocationId()); - /* - * Temporary bug fix for AuthZ code ( isAllowed(..) ), which gives wrong - * permission for the first time at 'Create new or Copy meeting pages', - * once it's fixed, remove this below and make it into a more clean way - */ - if (allowed && createSitesGroups == null) { - createSitesGroups = new CreateSitesGroups(null, sakaiFacade, signupMeetingService); - } - - return allowed; - } - - /* - * provide a way to let other bean to access this same object (temporary - * fixing Authz code problem) - */ - public CreateSitesGroups getCreateSitesGroups() { - return createSitesGroups; - } - - /** - * This is a setter. - * - * @param signupMeetings - * a list of SignupMeetingWrapper objects. - */ - public void setSignupMeetings(List<SignupMeetingWrapper> signupMeetings) { - this.signupMeetings = signupMeetings; - } - - /** - * This is a getter method for UI. - * - * @return an UIData object. - */ - public UIData getMeetingTable() { - return meetingTable; - } - - /** - * This is a setter. - * - * @param meetingTable - * an UIData object. - */ - public void setMeetingTable(UIData meetingTable) { - this.meetingTable = meetingTable; - } - - /** - * This is a getter method. - * - * @return an AttendeeSginupMBean object. - */ - public AttendeeSignupMBean getAttendeeSignupMBean() { - return attendeeSignupMBean; - } - - /** - * This is a setter. - * - * @param attendeeSignupMBean - * an AttendeeSignupMBean object. - */ - public void setAttendeeSignupMBean(AttendeeSignupMBean attendeeSignupMBean) { - this.attendeeSignupMBean = attendeeSignupMBean; - } - - /** - * This is a getter method. - * - * @return an OrganizerSignupMBean object - */ - public OrganizerSignupMBean getOrganizerSignupMBean() { - return organizerSignupMBean; - } - - /** - * This is a setter. - * - * @param organizerSignupMBean - * an OrganizerSignupMBean object - */ - public void setOrganizerSignupMBean(OrganizerSignupMBean organizerSignupMBean) { - this.organizerSignupMBean = organizerSignupMBean; - } - - /** - * This is a getter method for UI. - * - * @return a string value. - */ - public String getViewDateRang() { - return viewDateRang; - } - - /** - * This is a setter for UI. - * - * @param viewDateRang - * a string value. - */ - public void setViewDateRang(String viewDateRang) { - this.viewDateRang = viewDateRang; - } - - /* The following methods provide data auto-refresh for current page */ - private long lastUpdatedTime = new Date().getTime(); - - private boolean isRefresh() { - if ((new Date()).getTime() - lastUpdatedTime > dataRefreshInterval) - return true; - - return false; - } - - private void setLastUpdatedTime(long lastUpdatedTime) { - this.lastUpdatedTime = lastUpdatedTime; - } - - /** - * This is a getter to obtain the SignupSorter object. - * - * @return A SignupSorter object. - */ - public SignupSorter getSignupSorter() { - return signupSorter; - } - - /** - * This is a setter. - * - * @param signupSorter - * A SignupSorter object. - */ - public void setSignupSorter(SignupSorter signupSorter) { - this.signupSorter = signupSorter; - } - - /** - * This is a getter method for UI. - * - * @return a boolean value - */ - public boolean isShowAllRecurMeetings() { - if (showAllRecurMeetings == null) { - if (getSakaiFacade().getServerConfigurationService().getBoolean("signup.showAllRecurMeetings.default", false)) { - showAllRecurMeetings = true; - } - else { - showAllRecurMeetings = false; - } - } - return showAllRecurMeetings; - } - - /** - * This is a setter method for UI. - * - * @param showAllRecurMeetings - * a boolean value - */ - public void setShowAllRecurMeetings(boolean showAllRecurMeetings) { - this.showAllRecurMeetings = showAllRecurMeetings; - } - - private String iframeId = ""; - - /** - * This is a getter method which provide current Iframe id for refresh - * IFrame purpose. - * - * @return a String - */ - public String getIframeId() { - HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext() - .getRequest(); - String iFrameId = (String) request.getAttribute("sakai.tool.placement.id"); - return iFrameId; - } - - /** - * This is a getter method for UI. - * - * @return a boolean value - */ - public boolean isEnableExpandOption() { - return enableExpandOption; - } - - /** - * This is a setter method for UI. - * - * @param enableExpandOption - * a boolean value - */ - public void setEnableExpandOption(boolean enableExpandOption) { - this.enableExpandOption = enableExpandOption; - } - - /** - * This is a getter method. - * - * @return a list of SelectItem which provide user's choices for view - */ - public List<SelectItem> getViewDropDownList() { - if (viewDropDownList == null) { - initViewDropDownList(); - } - return viewDropDownList; - } - - private void initViewDropDownList() { - List<SelectItem> viewDrpDwnList = new ArrayList<SelectItem>(); - - viewDrpDwnList.add(new SelectItem(THIRTY_DAYS, Utilities.rb.getString("view_current_month"))); - viewDrpDwnList.add(new SelectItem(NINTY_DAYS, Utilities.rb.getString("view_current_three_months"))); - viewDrpDwnList.add(new SelectItem(ALL_FUTURE, Utilities.rb.getString("view_all_future_meetings"))); - /* - * viewDrpDwnList.add(new SelectItem(OLD_DAYS, - * Utilities.rb.getString("view_previous_events"))); - */ - viewDrpDwnList.add(new SelectItem(VIEW_ALL, Utilities.rb.getString("view_all"))); - viewDrpDwnList.add(new SelectItem(disabledSelectView, Utilities.rb.getString("dropDown_line_separator"), - "line-separator", true)); - viewDrpDwnList.add(new SelectItem(VIEW_MY_SIGNED_UP, Utilities.rb.getString("view_my_signed_up"))); - viewDrpDwnList.add(new SelectItem(VIEW_IMMEDIATE_AVAIL, Utilities.rb.getString("view_immediate_avail_ones"))); - setViewDropDownList(viewDrpDwnList); - } - - private void setViewDropDownList(List<SelectItem> viewDropDownList) { - this.viewDropDownList = viewDropDownList; - } - - /** - * It's a getter method for UI. - * - * @return a String message. - */ - public String getMeetingUnavailableMessages() { - this.meetingUnavailableMessages = ""; - if (isMeetingsAvailable()) - return this.meetingUnavailableMessages; - - /* no meeting available cases: */ - if (isAllowedToCreate() && isSelectedViewFutureMeetings()) - setMeetingUnavailableMessages(Utilities.rb.getString("no_events_in_future_organizer")); - else if (isAllowedToCreate() && isSelectedViewAllMeetings()) - setMeetingUnavailableMessages(Utilities.rb.getString("no_events_in_timeframe_organizer")); - else if (!isAllowedToCreate() && isSelectedViewAllMeetings()) - setMeetingUnavailableMessages(Utilities.rb.getString("no_events_in_timeframe_attendee")); - else if (isSelectedViewImmediateAvail()) - setMeetingUnavailableMessages(Utilities.rb.getString("no_future_events_in_immediate_available")); - else if (isSelectedViewMySignedUp()) - setMeetingUnavailableMessages(Utilities.rb.getString("no_future_events_I_have_signed_up")); - else if (!isAllowedToCreate() && isSelectedViewFutureMeetings() || !isSelectedViewAllMeetings() - && !isSelectedViewFutureMeetings()) - setMeetingUnavailableMessages(Utilities.rb.getString("no_events_in_this_period_attendee_orgnizer")); - - return this.meetingUnavailableMessages; - } - - public boolean isSelectedViewImmediateAvail() { - boolean t = false; - if (getViewDateRang().equals(VIEW_IMMEDIATE_AVAIL)) - t = true; - return t; - } - - public boolean isSelectedViewMySignedUp() { - boolean t = false; - if (getViewDateRang().equals(VIEW_MY_SIGNED_UP)) - t = true; - return t; - } - - private void setMeetingUnavailableMessages(String meetingUnavailableMessages) { - this.meetingUnavailableMessages = meetingUnavailableMessages; - } - - /** - * It's getter method for JSF bean - * - * @return a NewSignupMeetingBean object - */ - public NewSignupMeetingBean getNewSignupMeetingBean() { - return newSignupMeetingBean; - } - - /** - * It's a setter method for JSF bean. - * - * @param newSignupMeetingBean - * a NewSignupMeetingBean object - */ - public void setNewSignupMeetingBean(NewSignupMeetingBean newSignupMeetingBean) { - this.newSignupMeetingBean = newSignupMeetingBean; - } - - public AttendanceSignupBean getAttendanceSignupBean() { - return attendanceSignupBean; - } - - public void setAttendanceSignupBean(AttendanceSignupBean attendanceSignupBean) { - this.attendanceSignupBean = attendanceSignupBean; - } - - /** - * For UI, it will switch the time-column accordingly - * - * @return a boolean value - */ - public boolean isShowMyAppointmentTime() { - if (VIEW_MY_SIGNED_UP.equals(this.viewDateRang)) - return true; - - return false; - } - - - private boolean userLoggedInStatus = false; - public boolean isUserLoggedInStatus(){ - if(!userLoggedInStatus){ - if(getSakaiFacade().getCurrentUserId()!=null) - this.userLoggedInStatus=true; - else{ - return false; - } - } - return userLoggedInStatus; - } - - - /** - * @return true if sakai property signup.enableAttendance is true, else will return false - */ - public boolean isAttendanceOn() { - - if (getSakaiFacade().getServerConfigurationService().getBoolean("signup.enableAttendance", true)) { - return true; - } - else{ - return false; - } - } - - /** - * Get a list of instructors, defined as those with a given permission. Format it as a SelectItem list with the - * current instructor, if any, at the top - * @return - */ - public List<SelectItem> getInstructors(SignupMeeting meeting) { - List<User> users = sakaiFacade.getUsersWithPermission(SakaiFacade.SIGNUP_CREATE_SITE); - - List<SelectItem> instructors= new ArrayList<SelectItem>(); - - //do we have a meeting set? - //if so get the user and set to top of the list, then remove from the rest of the instructors - //otherwise, put the current user at the top of the list - if(meeting != null && StringUtils.isNotBlank(meeting.getCreatorUserId())) { - User currentInstructor = sakaiFacade.getUser(meeting.getCreatorUserId()); - instructors.add(new SelectItem(currentInstructor.getId(), currentInstructor.getDisplayName() + " (" + currentInstructor.getEid() + ")")); - users.remove(currentInstructor); - } else { - User currentUser = sakaiFacade.getUser(sakaiFacade.getCurrentUserId()); - instructors.add(new SelectItem(currentUser.getId(), currentUser.getDisplayName() + " (" + currentUser.getEid() + ")")); - users.remove(currentUser); - } - - //format remaining list of instructors - for(User u : users) { - instructors.add(new SelectItem (u.getId(), u.getDisplayName() + " (" + u.getDisplayId() + ")")); - } - - Collections.sort(instructors, SignupSorter.sortSelectItemComparator); - - return instructors; - } - - /** - * Get the name of the user (instructor) for the given userId. This really just formats a name - * @param userId - * @return - */ - public String getInstructorName(String userId) { - - User u = sakaiFacade.getUser(userId); - if(u == null) { - return null; - } - - return u.getDisplayName() + " (" + u.getEid() + ")"; - } - - /** - * Is CSV export enabled? - * @return true or false, depending on signup.csv.export.enabled setting. - */ - public boolean isCsvExportEnabled() { - return sakaiFacade.isCsvExportEnabled(); - } - - /** - * Is the current user allowed to update the site? Used for some permission checks - * @return - */ - public boolean isCurrentUserAllowedUpdateSite() { - String currentUserId = sakaiFacade.getCurrentUserId(); - String currentSiteId = sakaiFacade.getCurrentLocationId(); - boolean isAllowedUpdateSite = (sakaiFacade.isAllowedSite(currentUserId, sakaiFacade.SIGNUP_UPDATE_SITE, currentSiteId) - || sakaiFacade.isAllowedSite(currentUserId, sakaiFacade.SIGNUP_CREATE_SITE, currentSiteId)); - - return isAllowedUpdateSite; - } - - /** - * UI method to get list of categories for the filter - * First item has null value to signal that it is all categories - * - * @return list of categories - */ - public List<SelectItem> getAllCategoriesForFilter(){ - List<SelectItem> categories = getAllCategories(); - return categories; - } - - /** - * This is a ValueChange Listener to watch the category filter selection by user. - * - * @param vce a ValuechangeEvent object. - * @return a outcome string. - */ - public String processSelectedCategory(ValueChangeEvent vce) { - String selectedCategory = (String) vce.getNewValue(); - //note that blank values are allowed - if(!categoryFilter.equals(selectedCategory)){ - setCategoryFilter(selectedCategory); - setSignupMeetings(null);// reset - } - - return ""; - } - - -} +/* +* Licensed to The Apereo Foundation under one or more contributor license +* agreements. See the NOTICE file distributed with this work for +* additional information regarding copyright ownership. +* +* The Apereo Foundation licenses this file to you 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: +* +* http://opensource.org/licenses/ecl2.txt +* +* 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.sakaiproject.signup.tool.jsf; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import javax.faces.component.UIData; +import javax.faces.context.FacesContext; +import javax.faces.event.ValueChangeEvent; +import javax.faces.model.SelectItem; +import javax.servlet.http.HttpServletRequest; + +import lombok.Getter; +import lombok.Setter; + +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sakaiproject.signup.logic.Permission; +import org.sakaiproject.signup.logic.SakaiFacade; +import org.sakaiproject.signup.logic.SignupEventTypes; +import org.sakaiproject.signup.logic.SignupMeetingService; +import org.sakaiproject.signup.model.SignupAttachment; +import org.sakaiproject.signup.model.SignupMeeting; +import org.sakaiproject.signup.tool.jsf.attendee.AttendeeSignupMBean; +import org.sakaiproject.signup.tool.jsf.organizer.AttendanceSignupBean; +import org.sakaiproject.signup.tool.jsf.organizer.OrganizerSignupMBean; +import org.sakaiproject.signup.tool.jsf.organizer.action.CreateSitesGroups; +import org.sakaiproject.signup.tool.util.SignupBeanConstants; +import org.sakaiproject.signup.tool.util.Utilities; +import org.sakaiproject.tool.cover.ToolManager; +import org.sakaiproject.user.api.User; + +/** + * <p> + * This JSF UIBean class will handle information exchanges between main + * events/meetings list view page:<b>orgSignupMeetings.jsp</b> and backbone + * system. It provides all the necessary business logic + * </P> + */ +public class SignupMeetingsBean implements SignupBeanConstants { + + private static Logger log = LoggerFactory.getLogger(SignupMeetingsBean.class); + + protected UIData meetingTable; + + protected String viewDateRang = ALL_FUTURE;// default setting + + protected SignupMeetingService signupMeetingService; + + protected List<SignupMeetingWrapper> signupMeetings; + + protected SakaiFacade sakaiFacade; + + protected AttendeeSignupMBean attendeeSignupMBean; + + protected OrganizerSignupMBean organizerSignupMBean; + + protected AttendanceSignupBean attendanceSignupBean; + + private NewSignupMeetingBean newSignupMeetingBean; + + protected SignupSorter signupSorter = new SignupSorter(); + + protected Boolean showAllRecurMeetings = null; + + protected boolean enableExpandOption = false; + + protected List<SelectItem> viewDropDownList; + + protected final String disabledSelectView = "none"; + + protected String meetingUnavailableMessages; + + protected Boolean categoriesExist = null; + + protected Boolean locationsExist = null; + + + @Getter @Setter + protected String categoryFilter = CATERGORY_FILER_ALL; // default setting is blank, which means all categories + + + /** + * Default Constructor + * + */ + public SignupMeetingsBean() { + } + + /** + * This is a getter method. + * + * @return the current user display name. + */ + public String getCurrentUserDisplayName() { + return sakaiFacade.getUserDisplayName(sakaiFacade.getCurrentUserId()); + } + + /** + * This is a JSF action call method by UI to navigate to add new + * event/meeting page. + * + * @return an action outcome string. + */ + public String addMeeting() { + getNewSignupMeetingBean().reset(); + return ADD_MEETING_PAGE_URL; + } + + /** + * This is a JSF action call method by UI to remove the selected + * events/meetings. + * + * @return an action outcome string. + */ + public String removeMeetings() { + Set<SignupMeeting> meetingsSet = new HashSet<SignupMeeting>(); + + try { + for (SignupMeetingWrapper mWrapper : getSignupMeetings()) { + if (mWrapper.isSelected()) { + + //SIGNUP-139 + //if this meeting wrapper is the first one in a set of recurring meetings + //and we have recurring meetings + //then get all meetings have the same meeting.recurrenceId (as they are part of the set) and add to the list for removal + if(mWrapper.isFirstOneRecurMeeting() && mWrapper.getRecurEventsSize() > 1) { + SignupMeeting topLevel = mWrapper.getMeeting(); + + List<SignupMeeting> recurrentMeetings = signupMeetingService.getRecurringSignupMeetings(sakaiFacade.getCurrentLocationId(), sakaiFacade.getCurrentUserId(), topLevel.getRecurrenceId(), topLevel.getStartTime()); + + meetingsSet.addAll(recurrentMeetings); + } + meetingsSet.add(mWrapper.getMeeting()); + } + } + + List<SignupMeeting> meetings = new ArrayList<SignupMeeting>(meetingsSet); + + signupMeetingService.removeMeetings(meetings); + /* record the logs of the removed meetings */ + for (SignupMeeting meeting : meetings) { + log.info("Meeting Name:" + + meeting.getTitle() + + " - UserId:" + + sakaiFacade.getCurrentUserId() + + " - has removed the meeting at meeting startTime:" + + getSakaiFacade().getTimeService().newTime(meeting.getStartTime().getTime()) + .toStringLocalFull()); + + Utilities.postEventTracking(SignupEventTypes.EVENT_SIGNUP_MTNG_REMOVE, ToolManager.getCurrentPlacement().getContext() + " meetingId|title:" + + meeting.getId() + "|" + meeting.getTitle() + " at startTime:" + getSakaiFacade().getTimeService().newTime(meeting.getStartTime().getTime()) + .toStringLocalFull()); + + } + + try { + signupMeetingService.removeCalendarEvents(meetings); + } catch (Exception e) { + Utilities.addErrorMessage(Utilities.rb.getString("error.calendarEvent.removal_failed")); + log.error(Utilities.rb.getString("error.calendarEvent.removal_failed") + " - " + e.getMessage()); + } + /*cleanup attachments in contentHS*/ + for (SignupMeeting m : meetings) { + List<SignupAttachment> attachs= m.getSignupAttachments(); + if(attachs !=null){ + for (SignupAttachment attach : attachs) { + getNewSignupMeetingBean().getAttachmentHandler().removeAttachmentInContentHost(attach); + } + } + } + + } catch (Exception e) { + log.error(Utilities.rb.getString("Failed.remove.event") + " - " + e.getMessage()); + Utilities.addErrorMessage(Utilities.rb.getString("Failed.remove.event")); + } + signupMeetings = null;// TODO:do it more efficiently + + return MAIN_EVENTS_LIST_PAGE_URL; + } + + /** + * Get a list of locations for the UI. Unfiltered. + * @return + */ + private long lastUpdatedLocTime = 0; + private List<SelectItem> allLocations = null; + public List<SelectItem> getAllLocations(){ + long curr_time=(new Date()).getTime(); + //avoid multiple calls for one page loading : not refresh within one second + if(allLocations == null || curr_time - lastUpdatedLocTime > 1000){ + //Set<String> set = new HashSet<String>(); + List<SelectItem> locations= new ArrayList<SelectItem>(); + //List<SignupMeetingWrapper> allMeetings = getMeetingWrappers(VIEW_ALL, null); + List<String> allLocs = null; + try { + allLocs = signupMeetingService.getAllLocations(sakaiFacade.getCurrentLocationId()); + } catch (Exception e) { + //do nothing + allLocs=null; + } + if(allLocs !=null){ + for(String lc : allLocs) { + if(StringUtils.isNotBlank(lc)) { + locations.add(new SelectItem(lc)); + } + } + } + + if(!locations.isEmpty()){ + //avoid multiple call later + this.locationsExist = new Boolean(true); + } + else{ + this.locationsExist = new Boolean(false); + } + + lastUpdatedLocTime = curr_time; + allLocations = locations; + } + + return allLocations; + + } + + private long lastUpdatedCatTime = 0; + private List<SelectItem> allCategories = null; + public List<SelectItem> getAllCategories(){ + + long curr_time=(new Date()).getTime(); + //avoid multiple calls for one page loading : not refresh within one second + if(allCategories == null || curr_time - lastUpdatedCatTime > 1000){ + List<SelectItem> categories = new ArrayList<SelectItem>(); + List<String> allCats = null; + try { + allCats = signupMeetingService.getAllCategories(sakaiFacade.getCurrentLocationId()); + } catch (Exception e) { + //do nothing + allCats=null; + } + if(allCats !=null){ + for(String c : allCats) { + if(StringUtils.isNotBlank(c)) { + categories.add(new SelectItem(c)); + } + } + } + + if(!categories.isEmpty()){ + //avoid multiple call later + this.categoriesExist = new Boolean(true); + } + else{ + this.categoriesExist = new Boolean(false); + } + + lastUpdatedCatTime = curr_time; + categories.add(0, new SelectItem(CATERGORY_FILER_ALL, Utilities.rb.getString("filter_categories_top"))); + allCategories = categories; + } + + return allCategories; + } + + /** + * This is a JSF action call method by UI to navigate to view the specific + * event/meeting page. + * + * @return an action outcome string. + */ + public String processSignup() { + // TODO ??? need to check if we have covered the case for people, who + // have only view permission; we need + // to disable everything in that page + SignupMeetingWrapper meetingWrapper=null; + try{ + meetingWrapper = (SignupMeetingWrapper) meetingTable.getRowData(); + } + catch (Exception ex){ + /* sometimes, it throw + * java.lang.IllegalArgumentException + * at javax.faces.model.ListDataModel.getRowData(ListDataModel.java:139) + * Retry for user + */ + //reset main page data + setSignupMeetings(null); + return MAIN_EVENTS_LIST_PAGE_URL; + } + + Permission permission = meetingWrapper.getMeeting().getPermission(); + try { + if (permission.isUpdate()) { + organizerSignupMBean.init(meetingWrapper); + return ORGANIZER_MEETING_PAGE_URL; + } + + attendeeSignupMBean.init(meetingWrapper); + + } catch (Exception e) { + return MAIN_EVENTS_LIST_PAGE_URL; + } + return ATTENDEE_MEETING_PAGE_URL; + } + + /** + * This is a JSF action call method by UI to navigate to view the specific + * event/meeting attendance page. + * + * @return an action outcome string. + */ + public String processSignupAttendance() { + + SignupMeetingWrapper meetingWrapper = (SignupMeetingWrapper) meetingTable.getRowData(); + Permission permission = meetingWrapper.getMeeting().getPermission(); + try { + if (permission.isUpdate()) { + attendanceSignupBean.init(meetingWrapper); + return ATTENDANCE_PAGE_URL; + } + + } catch (Exception e) { + return ATTENDANCE_PAGE_URL; + } + return ATTENDANCE_PAGE_URL; + } + + /** + * This is a ValueChange Listener to watch the view-range type selection by + * user. + * + * @param vce + * a ValuechangeEvent object. + * @return a outcome string. + */ + public String processSelectedRange(ValueChangeEvent vce) { + String viewRange = (String) vce.getNewValue(); + if (disabledSelectView.equals(viewRange)) + return MAIN_EVENTS_LIST_PAGE_URL;// do-nothing for IE browser + // case + + setViewDateRang(viewRange); + setSignupMeetings(null);// reset + + return MAIN_EVENTS_LIST_PAGE_URL; + + } + + /** + * This is a ValueChange Listener to watch the show-all-recurring-events + * check-box value change by user. + * + * @param vce + * a ValuechangeEvent object. + * @return a outcome string. + */ + public String processExpandAllRcurEvents(ValueChangeEvent vce) { + Boolean expandAllEvents = (Boolean) vce.getNewValue(); + setShowAllRecurMeetings(expandAllEvents.booleanValue()); + List<SignupMeetingWrapper> smWrappers = getSignupMeetings(); + if (smWrappers != null) { + if (isShowAllRecurMeetings()) { + for (SignupMeetingWrapper smWrp : smWrappers) { + smWrp.setRecurEventsSize(0); + smWrp.setSubRecurringMeeting(false); + } + } else { + getSignupSorter().setSortAscending(true); + getSignupSorter().setSortColumn(SignupSorter.DATE_COLUMN); + getSignupSorter().sort(smWrappers); + markingRecurMeetings(smWrappers); + setSignupMeetings(smWrappers); + } + } + + return MAIN_EVENTS_LIST_PAGE_URL; + + } + + /** + * This is a getter method for UI. + * + * @return a SakaiFacade object. + */ + public SakaiFacade getSakaiFacade() { + return sakaiFacade; + } + + /** + * This is a setter. + * + * @param sakaiFacade + * a SakaiFacade object. + */ + public void setSakaiFacade(SakaiFacade sakaiFacade) { + this.sakaiFacade = sakaiFacade; + } + + /** + * This is a getter method. + * + * @return a SignupMeetingService object. + */ + public SignupMeetingService getSignupMeetingService() { + return signupMeetingService; + } + + /** + * This is a setter. + * + * @param signupMeetingService + * a SignupMeetingService object. + */ + public void setSignupMeetingService(SignupMeetingService signupMeetingService) { + this.signupMeetingService = signupMeetingService; + } + + /** + * This is a getter method for UI and filters the list according to what has been set. + * + * @return a list of SignupMeetingWrapper objects. + */ + public List<SignupMeetingWrapper> getSignupMeetings() { + try { + if (signupMeetings == null || isRefresh()) { + loadMeetings(getViewDateRang(), getCategoryFilter()); + setLastUpdatedTime(new Date().getTime()); + } + + } catch (Exception e) { + log.error(Utilities.rb.getString("failed.fetch_allEvents_from_db") + " - " + e.getMessage()); + Utilities.addErrorMessage(Utilities.rb.getString("failed.fetch_allEvents_from_db")); + } + return signupMeetings; + } + + /** + * This is a getter method for UI and returns all signup meetings. Ignores any filters. + * + * @return a list of SignupMeetingWrapper objects. + */ + // TODO how to handle this more efficiently + public List<SignupMeetingWrapper> getAllSignupMeetings() { + try { + loadMeetings(VIEW_ALL, null); + } catch (Exception e) { + log.error(Utilities.rb.getString("failed.fetch_allEvents_from_db") + " - " + e.getMessage()); + Utilities.addErrorMessage(Utilities.rb.getString("failed.fetch_allEvents_from_db")); + } + return signupMeetings; + } + + /** + * Loads the signup meetings and updates the bean state + * @param viewRange + * @param categoryFilter + */ + private void loadMeetings(String viewRange, String categoryFilter) { + + List<SignupMeetingWrapper> mWrappers = getMeetingWrappers(viewRange, categoryFilter); + if (!isShowAllRecurMeetings()) { + markingRecurMeetings(mWrappers); + } + setSignupMeetings(mWrappers); + } + + private void markingRecurMeetings(List<SignupMeetingWrapper> smList) { + if (smList == null || smList.size() == 0) + return; + + /* + * Assume that the list is already sorted by Date (default Date sorting + * by sql-query) + */ + for (int i = 0; i < smList.size(); i++) { + SignupMeetingWrapper smWrapper = (SignupMeetingWrapper) smList.get(i); + Long firstRecurId = smWrapper.getMeeting().getRecurrenceId(); + if (firstRecurId != null && firstRecurId.longValue() >= 0 && !smWrapper.isSubRecurringMeeting()) { + int index = 0; + for (int j = i + 1; j < smList.size(); j++) { + SignupMeetingWrapper nextOne = (SignupMeetingWrapper) smList.get(j); + if (nextOne.getMeeting().getRecurrenceId() != null + && nextOne.getMeeting().getRecurrenceId().longValue() == firstRecurId.longValue()) { + nextOne.setSubRecurringMeeting(true); + nextOne.setRecurId(firstRecurId + "_" + index++); + + } + } + smWrapper.setRecurEventsSize(index + 1); + } + } + } + + private List<SignupMeetingWrapper> getMeetingWrappers(String viewRange, String categoryFilter) { + String currentUserId = sakaiFacade.getCurrentUserId(); + if(!isUserLoggedInStatus()){ + /*Let user log-in first*/ + return null; + } + + List<SignupMeeting> signupMeetings = null; + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + + if (VIEW_ALL.equals(viewRange)) { + signupMeetings = signupMeetingService.getAllSignupMeetings(sakaiFacade.getCurrentLocationId(), currentUserId); + } else if (!OLD_DAYS.equals(viewRange)) { + /* including today's day for search */ + int currentHour = calendar.get(Calendar.HOUR_OF_DAY); + int currentMinutes = calendar.get(Calendar.MINUTE); + calendar.add(Calendar.HOUR, -1 * currentHour); + calendar.add(Calendar.MINUTE, -1 * currentMinutes); + String searchDateStr = viewRange; + + if (VIEW_MY_SIGNED_UP.equals(viewRange) || VIEW_IMMEDIATE_AVAIL.equals(viewRange)) { + searchDateStr = ALL_FUTURE; + } + + signupMeetings = signupMeetingService.getSignupMeetings(sakaiFacade.getCurrentLocationId(), currentUserId, calendar.getTime(), Utilities.getUserDefinedDate(Integer.parseInt(searchDateStr))); + + } else if (OLD_DAYS.equals(viewRange)) { + // calendar.add(Calendar.HOUR, 1 * 24);//exluding today for search + signupMeetings = signupMeetingService.getSignupMeetings(sakaiFacade.getCurrentLocationId(), currentUserId, calendar.getTime()); + } + + if (signupMeetings == null || signupMeetings.isEmpty()) { + return null; + } + + //SIGNUP-173 filter list by categoryFilter + //if no category, add them all + List<SignupMeeting> filteredCategorySignupMeetings = new ArrayList<SignupMeeting>(); + if(StringUtils.isNotBlank(categoryFilter) && !StringUtils.equals(CATERGORY_FILER_ALL,categoryFilter)) { + for(SignupMeeting s: signupMeetings) { + if(StringUtils.equals(s.getCategory(), categoryFilter)) { + filteredCategorySignupMeetings.add(s); + } + } + } else { + filteredCategorySignupMeetings.addAll(signupMeetings); + } + + List<SignupMeetingWrapper> wrappers = new ArrayList<SignupMeetingWrapper>(); + for (SignupMeeting meeting : filteredCategorySignupMeetings) { + SignupMeetingWrapper wrapper = new SignupMeetingWrapper(meeting, sakaiFacade.getUserDisplayName(meeting + .getCreatorUserId()), sakaiFacade.getCurrentUserId(), getSakaiFacade()); + wrappers.add(wrapper); + } + + /* filter out not-relevant ones */ + signupFilter filter = new signupFilter(currentUserId, viewRange); + filter.filterSignupMeetings(wrappers); + + /* show user the option check-box to expand all */ + setEnableExpandOption(false); + for (SignupMeetingWrapper meetingWrp : wrappers) { + if (meetingWrp.getMeeting().isRecurredMeeting()) + setEnableExpandOption(true); + } + + return wrappers; + } + + /** + * This is a getter method for UI. + * + * @return true if atleast one of the meeting has delete permission for the + * current user. + */ + public boolean isAllowedToDelete() { + if (sakaiFacade.isAllowedSite(sakaiFacade.getCurrentUserId(), SakaiFacade.SIGNUP_DELETE_SITE, sakaiFacade.getCurrentLocationId())) { + return true; + } + + if (getSignupMeetings() == null) { + return false; + } + + for (SignupMeetingWrapper meetingW : signupMeetings) { + if (meetingW.getMeeting().getPermission().isDelete()) + return true; + } + + return false; + + } + + /** + * This is a getter method for UI. + * + * @return true if at least one of the meetings has update permission for the + * current user. + */ + public boolean isAllowedToUpdate() { + // Do we really need to loop through 1000 meetings if the user has elevated site permissions?! + if (sakaiFacade.isAllowedSite(sakaiFacade.getCurrentUserId(), SakaiFacade.SIGNUP_UPDATE_SITE, sakaiFacade.getCurrentLocationId())) { + return true; + } + + // This call to getSignupMeetings() is going to make Hibernate load lots and lots of data + if (getSignupMeetings() == null) { + return false; + } + + for (SignupMeetingWrapper meetingW : signupMeetings) { + if (meetingW.getMeeting().getPermission().isUpdate()) { + return true; + } + } + + return false; + + } + + /** + * This is a getter method for UI. + * + * @return true if atleast one of the meeting is available to the current + * user. + */ + public boolean isMeetingsAvailable() { + getSignupMeetings(); + return !(signupMeetings == null || signupMeetings.isEmpty()); + } + + /** + * This is a getter method for UI. + * + * @return true if we have categories already + * + */ + public boolean isCategoriesAvailable() { + //getSignupMeetings(); + if(this.categoriesExist == null){ + //initialization first + getAllCategories(); + } + + return this.categoriesExist.booleanValue(); + } + + /** + * This is a getter method for UI. + * + * @return true if we have categories already + * + */ + public boolean isLocationsAvailable() { + //getSignupMeetings(); + if(this.locationsExist == null){ + //initialization first + getAllLocations(); + } + + return this.locationsExist.booleanValue(); + } + + /** + * This provides information of user's View selection for UI + * + * @return true if user has select 'all future meetings' or 'all' for view + */ + public boolean isSelectedViewFutureMeetings() { + boolean t = false; + if (getViewDateRang().equals(ALL_FUTURE)) + t = true; + return t; + } + + /** + * This provides information of user's View selection for UI + * + * @return true if user has select 'all meetings' or 'all' for view + */ + public boolean isSelectedViewAllMeetings() { + boolean t = false; + if (getViewDateRang().equals(VIEW_ALL)) + t = true; + return t; + } + + /** + * This is a getter method for UI. + * + * @return true if atleast one of the meeting has create permission for the + * current user. + */ + private CreateSitesGroups createSitesGroups = null; + + public boolean isAllowedToCreate() { + boolean allowed = signupMeetingService.isAllowedToCreateAnyInSite(sakaiFacade.getCurrentUserId(), sakaiFacade + .getCurrentLocationId()); + /* + * Temporary bug fix for AuthZ code ( isAllowed(..) ), which gives wrong + * permission for the first time at 'Create new or Copy meeting pages', + * once it's fixed, remove this below and make it into a more clean way + */ + if (allowed && createSitesGroups == null) { + createSitesGroups = new CreateSitesGroups(null, sakaiFacade, signupMeetingService); + } + + return allowed; + } + + /* + * provide a way to let other bean to access this same object (temporary + * fixing Authz code problem) + */ + public CreateSitesGroups getCreateSitesGroups() { + return createSitesGroups; + } + + /** + * This is a setter. + * + * @param signupMeetings + * a list of SignupMeetingWrapper objects. + */ + public void setSignupMeetings(List<SignupMeetingWrapper> signupMeetings) { + this.signupMeetings = signupMeetings; + } + + /** + * This is a getter method for UI. + * + * @return an UIData object. + */ + public UIData getMeetingTable() { + return meetingTable; + } + + /** + * This is a setter. + * + * @param meetingTable + * an UIData object. + */ + public void setMeetingTable(UIData meetingTable) { + this.meetingTable = meetingTable; + } + + /** + * This is a getter method. + * + * @return an AttendeeSginupMBean object. + */ + public AttendeeSignupMBean getAttendeeSignupMBean() { + return attendeeSignupMBean; + } + + /** + * This is a setter. + * + * @param attendeeSignupMBean + * an AttendeeSignupMBean object. + */ + public void setAttendeeSignupMBean(AttendeeSignupMBean attendeeSignupMBean) { + this.attendeeSignupMBean = attendeeSignupMBean; + } + + /** + * This is a getter method. + * + * @return an OrganizerSignupMBean object + */ + public OrganizerSignupMBean getOrganizerSignupMBean() { + return organizerSignupMBean; + } + + /** + * This is a setter. + * + * @param organizerSignupMBean + * an OrganizerSignupMBean object + */ + public void setOrganizerSignupMBean(OrganizerSignupMBean organizerSignupMBean) { + this.organizerSignupMBean = organizerSignupMBean; + } + + /** + * This is a getter method for UI. + * + * @return a string value. + */ + public String getViewDateRang() { + return viewDateRang; + } + + /** + * This is a setter for UI. + * + * @param viewDateRang + * a string value. + */ + public void setViewDateRang(String viewDateRang) { + this.viewDateRang = viewDateRang; + } + + /* The following methods provide data auto-refresh for current page */ + private long lastUpdatedTime = new Date().getTime(); + + private boolean isRefresh() { + if ((new Date()).getTime() - lastUpdatedTime > dataRefreshInterval) + return true; + + return false; + } + + private void setLastUpdatedTime(long lastUpdatedTime) { + this.lastUpdatedTime = lastUpdatedTime; + } + + /** + * This is a getter to obtain the SignupSorter object. + * + * @return A SignupSorter object. + */ + public SignupSorter getSignupSorter() { + return signupSorter; + } + + /** + * This is a setter. + * + * @param signupSorter + * A SignupSorter object. + */ + public void setSignupSorter(SignupSorter signupSorter) { + this.signupSorter = signupSorter; + } + + /** + * This is a getter method for UI. + * + * @return a boolean value + */ + public boolean isShowAllRecurMeetings() { + if (showAllRecurMeetings == null) { + if (getSakaiFacade().getServerConfigurationService().getBoolean("signup.showAllRecurMeetings.default", false)) { + showAllRecurMeetings = true; + } + else { + showAllRecurMeetings = false; + } + } + return showAllRecurMeetings; + } + + /** + * This is a setter method for UI. + * + * @param showAllRecurMeetings + * a boolean value + */ + public void setShowAllRecurMeetings(boolean showAllRecurMeetings) { + this.showAllRecurMeetings = showAllRecurMeetings; + } + + private String iframeId = ""; + + /** + * This is a getter method which provide current Iframe id for refresh + * IFrame purpose. + * + * @return a String + */ + public String getIframeId() { + HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext() + .getRequest(); + String iFrameId = (String) request.getAttribute("sakai.tool.placement.id"); + return iFrameId; + } + + /** + * This is a getter method for UI. + * + * @return a boolean value + */ + public boolean isEnableExpandOption() { + return enableExpandOption; + } + + /** + * This is a setter method for UI. + * + * @param enableExpandOption + * a boolean value + */ + public void setEnableExpandOption(boolean enableExpandOption) { + this.enableExpandOption = enableExpandOption; + } + + /** + * This is a getter method. + * + * @return a list of SelectItem which provide user's choices for view + */ + public List<SelectItem> getViewDropDownList() { + if (viewDropDownList == null) { + initViewDropDownList(); + } + return viewDropDownList; + } + + private void initViewDropDownList() { + List<SelectItem> viewDrpDwnList = new ArrayList<SelectItem>(); + + viewDrpDwnList.add(new SelectItem(THIRTY_DAYS, Utilities.rb.getString("view_current_month"))); + viewDrpDwnList.add(new SelectItem(NINTY_DAYS, Utilities.rb.getString("view_current_three_months"))); + viewDrpDwnList.add(new SelectItem(ALL_FUTURE, Utilities.rb.getString("view_all_future_meetings"))); + /* + * viewDrpDwnList.add(new SelectItem(OLD_DAYS, + * Utilities.rb.getString("view_previous_events"))); + */ + viewDrpDwnList.add(new SelectItem(VIEW_ALL, Utilities.rb.getString("view_all"))); + viewDrpDwnList.add(new SelectItem(disabledSelectView, Utilities.rb.getString("dropDown_line_separator"), + "line-separator", true)); + viewDrpDwnList.add(new SelectItem(VIEW_MY_SIGNED_UP, Utilities.rb.getString("view_my_signed_up"))); + viewDrpDwnList.add(new SelectItem(VIEW_IMMEDIATE_AVAIL, Utilities.rb.getString("view_immediate_avail_ones"))); + setViewDropDownList(viewDrpDwnList); + } + + private void setViewDropDownList(List<SelectItem> viewDropDownList) { + this.viewDropDownList = viewDropDownList; + } + + /** + * It's a getter method for UI. + * + * @return a String message. + */ + public String getMeetingUnavailableMessages() { + this.meetingUnavailableMessages = ""; + if (isMeetingsAvailable()) + return this.meetingUnavailableMessages; + + /* no meeting available cases: */ + if (isAllowedToCreate() && isSelectedViewFutureMeetings()) + setMeetingUnavailableMessages(Utilities.rb.getString("no_events_in_future_organizer")); + else if (isAllowedToCreate() && isSelectedViewAllMeetings()) + setMeetingUnavailableMessages(Utilities.rb.getString("no_events_in_timeframe_organizer")); + else if (!isAllowedToCreate() && isSelectedViewAllMeetings()) + setMeetingUnavailableMessages(Utilities.rb.getString("no_events_in_timeframe_attendee")); + else if (isSelectedViewImmediateAvail()) + setMeetingUnavailableMessages(Utilities.rb.getString("no_future_events_in_immediate_available")); + else if (isSelectedViewMySignedUp()) + setMeetingUnavailableMessages(Utilities.rb.getString("no_future_events_I_have_signed_up")); + else if (!isAllowedToCreate() && isSelectedViewFutureMeetings() || !isSelectedViewAllMeetings() + && !isSelectedViewFutureMeetings()) + setMeetingUnavailableMessages(Utilities.rb.getString("no_events_in_this_period_attendee_orgnizer")); + + return this.meetingUnavailableMessages; + } + + public boolean isSelectedViewImmediateAvail() { + boolean t = false; + if (getViewDateRang().equals(VIEW_IMMEDIATE_AVAIL)) + t = true; + return t; + } + + public boolean isSelectedViewMySignedUp() { + boolean t = false; + if (getViewDateRang().equals(VIEW_MY_SIGNED_UP)) + t = true; + return t; + } + + private void setMeetingUnavailableMessages(String meetingUnavailableMessages) { + this.meetingUnavailableMessages = meetingUnavailableMessages; + } + + /** + * It's getter method for JSF bean + * + * @return a NewSignupMeetingBean object + */ + public NewSignupMeetingBean getNewSignupMeetingBean() { + return newSignupMeetingBean; + } + + /** + * It's a setter method for JSF bean. + * + * @param newSignupMeetingBean + * a NewSignupMeetingBean object + */ + public void setNewSignupMeetingBean(NewSignupMeetingBean newSignupMeetingBean) { + this.newSignupMeetingBean = newSignupMeetingBean; + } + + public AttendanceSignupBean getAttendanceSignupBean() { + return attendanceSignupBean; + } + + public void setAttendanceSignupBean(AttendanceSignupBean attendanceSignupBean) { + this.attendanceSignupBean = attendanceSignupBean; + } + + /** + * For UI, it will switch the time-column accordingly + * + * @return a boolean value + */ + public boolean isShowMyAppointmentTime() { + if (VIEW_MY_SIGNED_UP.equals(this.viewDateRang)) + return true; + + return false; + } + + + private boolean userLoggedInStatus = false; + public boolean isUserLoggedInStatus(){ + if(!userLoggedInStatus){ + if(getSakaiFacade().getCurrentUserId()!=null) + this.userLoggedInStatus=true; + else{ + return false; + } + } + return userLoggedInStatus; + } + + + /** + * @return true if sakai property signup.enableAttendance is true, else will return false + */ + public boolean isAttendanceOn() { + + if (getSakaiFacade().getServerConfigurationService().getBoolean("signup.enableAttendance", true)) { + return true; + } + else{ + return false; + } + } + + /** + * Get a list of instructors, defined as those with a given permission. Format it as a SelectItem list with the + * current instructor, if any, at the top + * @return + */ + public List<SelectItem> getInstructors(SignupMeeting meeting) { + List<User> users = sakaiFacade.getUsersWithPermission(SakaiFacade.SIGNUP_CREATE_SITE); + + List<SelectItem> instructors= new ArrayList<SelectItem>(); + + //do we have a meeting set? + //if so get the user and set to top of the list, then remove from the rest of the instructors + //otherwise, put the current user at the top of the list + if(meeting != null && StringUtils.isNotBlank(meeting.getCreatorUserId())) { + User currentInstructor = sakaiFacade.getUser(meeting.getCreatorUserId()); + instructors.add(new SelectItem(currentInstructor.getId(), currentInstructor.getDisplayName() + " (" + currentInstructor.getEid() + ")")); + users.remove(currentInstructor); + } else { + User currentUser = sakaiFacade.getUser(sakaiFacade.getCurrentUserId()); + instructors.add(new SelectItem(currentUser.getId(), currentUser.getDisplayName() + " (" + currentUser.getEid() + ")")); + users.remove(currentUser); + } + + //format remaining list of instructors + for(User u : users) { + instructors.add(new SelectItem (u.getId(), u.getDisplayName() + " (" + u.getDisplayId() + ")")); + } + + Collections.sort(instructors, SignupSorter.sortSelectItemComparator); + + return instructors; + } + + /** + * Get the name of the user (instructor) for the given userId. This really just formats a name + * @param userId + * @return + */ + public String getInstructorName(String userId) { + + User u = sakaiFacade.getUser(userId); + if(u == null) { + return null; + } + + return u.getDisplayName() + " (" + u.getEid() + ")"; + } + + /** + * Is CSV export enabled? + * @return true or false, depending on signup.csv.export.enabled setting. + */ + public boolean isCsvExportEnabled() { + return sakaiFacade.isCsvExportEnabled(); + } + + /** + * Is the current user allowed to update the site? Used for some permission checks + * @return + */ + public boolean isCurrentUserAllowedUpdateSite() { + String currentUserId = sakaiFacade.getCurrentUserId(); + String currentSiteId = sakaiFacade.getCurrentLocationId(); + boolean isAllowedUpdateSite = (sakaiFacade.isAllowedSite(currentUserId, sakaiFacade.SIGNUP_UPDATE_SITE, currentSiteId) + || sakaiFacade.isAllowedSite(currentUserId, sakaiFacade.SIGNUP_CREATE_SITE, currentSiteId)); + + return isAllowedUpdateSite; + } + + /** + * UI method to get list of categories for the filter + * First item has null value to signal that it is all categories + * + * @return list of categories + */ + public List<SelectItem> getAllCategoriesForFilter(){ + List<SelectItem> categories = getAllCategories(); + return categories; + } + + /** + * This is a ValueChange Listener to watch the category filter selection by user. + * + * @param vce a ValuechangeEvent object. + * @return a outcome string. + */ + public String processSelectedCategory(ValueChangeEvent vce) { + String selectedCategory = (String) vce.getNewValue(); + //note that blank values are allowed + if(!categoryFilter.equals(selectedCategory)){ + setCategoryFilter(selectedCategory); + setSignupMeetings(null);// reset + } + + return ""; + } + + +} diff --git a/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/SignupPermissionsUpdateBean.java b/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/SignupPermissionsUpdateBean.java index e4ba6677e864..10576595995a 100644 --- a/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/SignupPermissionsUpdateBean.java +++ b/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/SignupPermissionsUpdateBean.java @@ -29,8 +29,8 @@ import javax.faces.context.ExternalContext; import javax.faces.context.FacesContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroupService; import org.sakaiproject.authz.api.PermissionsHelper; import org.sakaiproject.exception.IdUnusedException; @@ -53,7 +53,7 @@ */ public class SignupPermissionsUpdateBean { - private Log logger = LogFactory.getLog(SignupPermissionsUpdateBean.class); + private Logger logger = LoggerFactory.getLogger(SignupPermissionsUpdateBean.class); private SakaiFacade sakaiFacade; diff --git a/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/SignupUIBaseBean.java b/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/SignupUIBaseBean.java index 95e909085499..d3ae5f6f7e58 100644 --- a/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/SignupUIBaseBean.java +++ b/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/SignupUIBaseBean.java @@ -1,978 +1,978 @@ -/* -* Licensed to The Apereo Foundation under one or more contributor license -* agreements. See the NOTICE file distributed with this work for -* additional information regarding copyright ownership. -* -* The Apereo Foundation licenses this file to you 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: -* -* http://opensource.org/licenses/ecl2.txt -* -* 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.sakaiproject.signup.tool.jsf; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collections; -import java.util.Date; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; -import java.util.TimeZone; - -import javax.faces.context.FacesContext; -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.sakaiproject.signup.logic.SakaiFacade; -import org.sakaiproject.signup.logic.SignupCalendarHelper; -import org.sakaiproject.signup.logic.SignupMeetingService; -import org.sakaiproject.signup.logic.SignupMessageTypes; -import org.sakaiproject.signup.logic.SignupUserActionException; -import org.sakaiproject.signup.model.MeetingTypes; -import org.sakaiproject.signup.model.SignupAttachment; -import org.sakaiproject.signup.model.SignupAttendee; -import org.sakaiproject.signup.model.SignupMeeting; -import org.sakaiproject.signup.model.SignupTimeslot; -import org.sakaiproject.signup.tool.jsf.attachment.AttachmentHandler; -import org.sakaiproject.signup.tool.util.SignupBeanConstants; -import org.sakaiproject.signup.tool.util.Utilities; -import org.sakaiproject.time.api.TimeService; -import org.sakaiproject.user.api.User; - -import lombok.Getter; -import lombok.Setter; - -/** - * <p> - * This is a abstract base class for JSF Signup tool UIBean. It provides some - * must-have or common used methods such as getMeetingWrapper(), sakakFacade - * etc. - * </P> - */ -abstract public class SignupUIBaseBean implements SignupBeanConstants, SignupMessageTypes, MeetingTypes { - - protected SakaiFacade sakaiFacade; - - protected SignupMeetingService signupMeetingService; - - @Getter @Setter - protected SignupCalendarHelper calendarHelper; - - private AttachmentHandler attachmentHandler; - - protected SignupMeetingWrapper meetingWrapper; - - protected List<TimeslotWrapper> timeslotWrappers; - - protected TimeslotWrapper timeslotWrapper; - - protected boolean currentUserSignedup; - - protected static boolean DEFAULT_SEND_EMAIL = "true".equalsIgnoreCase(Utilities.getSignupConfigParamVal( - "signup.default.email.notification", "true")) ? true : false; - - protected static boolean DEFAULT_EXPORT_TO_CALENDAR_TOOL = "true".equalsIgnoreCase(Utilities.getSignupConfigParamVal("signup.default.export.to.calendar.setting", "true")) ? true : false; - - protected boolean publishToCalendar = DEFAULT_EXPORT_TO_CALENDAR_TOOL; - - protected boolean sendEmail = DEFAULT_SEND_EMAIL; - - protected Log logger = LogFactory.getLog(SignupUIBaseBean.class); - - protected Boolean publishedSite; - - //protected boolean sendEmailAttendeeOnly = false; - - protected String sendEmailToSelectedPeopleOnly = SEND_EMAIL_ALL_PARTICIPANTS; - - private int maxSlots; - - private int maxAttendeesPerSlot; - - protected String customLocation; - - protected String customCategory; - - protected static final String ICS_MIME_TYPE="text/calendar"; - - /** - * This method will get the most updated event/meeting data and handle all - * the wrapping process for UI. Due to effeciency, the data is only - * guarantied fresh at a 10 minutes interval (defined by - * <b>dataRefreshInterval</b> value). - * - * @return a SignupMeetingWrapper object. - */ - public SignupMeetingWrapper getMeetingWrapper() { - if (meetingWrapper != null && meetingWrapper.isRefresh()) { - try { - SignupMeeting meeting = signupMeetingService.loadSignupMeeting(meetingWrapper.getMeeting().getId(), - sakaiFacade.getCurrentUserId(), sakaiFacade.getCurrentLocationId()); - meetingWrapper.setMeeting(meeting); - updateTimeSlotWrappers(meetingWrapper); - } catch (Exception e) { - Utilities.addErrorMessage(Utilities.rb.getString("db.error_or_event.notExisted")); - logger.error(Utilities.rb.getString("db.error_or_event.notExisted") + " - " + e.getMessage()); - } - } - return meetingWrapper; - } - - /** process new data into Timeslot wrapper for UI purpose */ - protected void updateTimeSlotWrappers(SignupMeetingWrapper meetingWrapper) { - SignupMeeting meeting = this.meetingWrapper.getMeeting(); - if (meeting == null) - return; - - List timeslots = meeting.getSignupTimeSlots(); - if (timeslots == null) - return; - - List<TimeslotWrapper> timeslotWrapperList = new ArrayList<TimeslotWrapper>(); - setCurrentUserSignedup(false);// reset and make sure to capture new - // changes - int i = 0; - int totalSignedupSlots=0; - for (Iterator iter = timeslots.iterator(); iter.hasNext();) { - SignupTimeslot elm = (SignupTimeslot) iter.next(); - TimeslotWrapper tsw = new TimeslotWrapper(elm, sakaiFacade.getCurrentUserId()); - - List<AttendeeWrapper> attendeeWrp = new ArrayList<AttendeeWrapper>(); - int posIndex = 0; - //clean the list - List<SignupAttendee> cleanedList = getValidAttendees(elm.getAttendees()); - for (SignupAttendee attendee : cleanedList) { - AttendeeWrapper attWrp = new AttendeeWrapper(attendee, sakaiFacade.getUserDisplayLastFirstName(attendee - .getAttendeeUserId())); - attWrp.setPositionIndex(posIndex++); - attendeeWrp.add(attWrp); - - /* current user is already signed up in one of the timeslot */ - if (attendee.getAttendeeUserId().equals(sakaiFacade.getCurrentUserId())) - //setCurrentUserSignedup(true); - totalSignedupSlots++; - } - - //sorting by displayname - //JIRA: Signup-204 - posIndex = 0; - Collections.sort(attendeeWrp); - for (AttendeeWrapper attWrp : attendeeWrp) { - attWrp.setPositionIndex(posIndex++); - } - - tsw.setAttendeeWrappers(attendeeWrp); - - tsw.setWaitingList(wrapWaiters(elm.getWaitingList())); - tsw.setPositionInTSlist(i++); - timeslotWrapperList.add(tsw); - - } - int preferredSlot = meeting.getMaxNumOfSlots(); - if (totalSignedupSlots >= preferredSlot){ - setCurrentUserSignedup(true); - } - setTimeslotWrappers(timeslotWrapperList); - - } - - /** process the new data into Meeting wrapper for UI purpose */ - protected String updateMeetingwrapper(SignupMeeting meeting, String destinationUrl) { - /* if null,reload due to exception */ - try { - if (meeting == null) - meeting = signupMeetingService.loadSignupMeeting(this.meetingWrapper.getMeeting().getId(), sakaiFacade - .getCurrentUserId(), sakaiFacade.getCurrentLocationId()); - - getMeetingWrapper().setMeeting(meeting); - getMeetingWrapper().resetAvailableStatus();// re-process avail. - // status - updateTimeSlotWrappers(getMeetingWrapper()); - return destinationUrl; - } catch (Exception e) { - Utilities.addErrorMessage(Utilities.rb.getString("db.error_or_event.notExisted")); - logger.warn(Utilities.rb.getString("db.error_or_event.notExisted") + " - " + e.getMessage()); - Utilities.resetMeetingList(); - return MAIN_EVENTS_LIST_PAGE_URL; - } - } - - protected void updateSignupAttachmentWrapper(SignupMeeting meeting){ - - } - - /** - * setup the event/meeting's signup begin and deadline time and validate it - * too - */ - protected void setSignupBeginDeadlineData(SignupMeeting meeting, int signupBegin, String signupBeginType, - int signupDeadline, String signupDeadlineType) throws Exception { - Date sBegin = Utilities.subTractTimeToDate(meeting.getStartTime(), signupBegin, signupBeginType); - Date sDeadline = Utilities.subTractTimeToDate(meeting.getEndTime(), signupDeadline, signupDeadlineType); - - if (!START_NOW.equals(signupBeginType) && sBegin.before(new Date())) { - // a warning for user - Utilities.addErrorMessage(Utilities.rb.getString("warning.your.event.singup.begin.time.passed.today.time")); - } - - meeting.setSignupBegins(sBegin); - - if (sBegin.after(sDeadline)) - throw new SignupUserActionException(Utilities.rb.getString("signup.deadline.is.before.signup.begin")); - - meeting.setSignupDeadline(sDeadline); - } - - public boolean isMeetingOverRepeatPeriod(Date startTime, Date endTime, int repeatPeriodInDays){ - long duration= endTime.getTime()- startTime.getTime(); - if( 24*repeatPeriodInDays - duration /(MINUTE_IN_MILLISEC * Hour_In_MINUTES) >= 0 ) - return false; - - return true; - } - - /** convert SignupAttendee to AttendeeWrapper object */ - /*private List<AttendeeWrapper> wrapAttendees(List<SignupAttendee> attendees) { - List<AttendeeWrapper> attendeeWrp = new ArrayList<AttendeeWrapper>(); - int posIndex = 0; - - //clean the list - List<SignupAttendee> cleanedList = getValidAttendees(attendees); - - for (SignupAttendee attendee : cleanedList) { - AttendeeWrapper attWrp = new AttendeeWrapper(attendee, sakaiFacade.getUserDisplayName(attendee.getAttendeeUserId())); - attWrp.setPositionIndex(posIndex++); - attendeeWrp.add(attWrp); - - // current user is already signed up in one of the timeslot - if (attendee.getAttendeeUserId().equals(sakaiFacade.getCurrentUserId())) { - setCurrentUserSignedup(true); - } - } - return attendeeWrp; - }*/ - - /** convert SignupAttendee to AttendeeWrapper object */ - private List<AttendeeWrapper> wrapWaiters(List<SignupAttendee> attendees) { - List<AttendeeWrapper> attendeeWrp = new ArrayList<AttendeeWrapper>(); - for (SignupAttendee attendee : attendees) { - attendeeWrp - .add(new AttendeeWrapper(attendee, sakaiFacade.getUserDisplayLastFirstName(attendee.getAttendeeUserId()))); - } - - return attendeeWrp; - } - - /** - * This is a setter. - * - * @param meetingWrapper - * a SignupMeetingWrapper object. - */ - public void setMeetingWrapper(SignupMeetingWrapper meetingWrapper) { - this.meetingWrapper = meetingWrapper; - } - - /** - * Get a SakaiFacade object. - * - * @return a SakaiFacade object. - */ - public SakaiFacade getSakaiFacade() { - return sakaiFacade; - } - - - /** - * @return the maxSlots - */ - public int getMaxSlots() { - String maxSlotsStringVal = Utilities.getSignupConfigParamVal("signup.maxSlots", "500"); - try{ - maxSlots = Integer.parseInt(maxSlotsStringVal); - } - catch (Exception e){ - maxSlots = 500; - } - return maxSlots; - } - - /** - * @param maxSlots the maxSlots to set - */ - public void setMaxSlots(int maxSlots) { - this.maxSlots = maxSlots; - } - - /** - * @return the maxAttendeesPerSlot - */ - public int getMaxAttendeesPerSlot() { - String maxAttendeesStringVal = Utilities.getSignupConfigParamVal("signup.maxAttendeesPerSlot", "500"); - try{ - maxAttendeesPerSlot = Integer.parseInt(maxAttendeesStringVal); - } - catch(Exception e){ - maxAttendeesPerSlot=500; - } - return maxAttendeesPerSlot; - } - - /** - * @param maxAttendeesPerSlot the maxAttendeesPerSlot to set - */ - public void setMaxAttendeesPerSlot(int maxAttendeesPerSlot) { - this.maxAttendeesPerSlot = maxAttendeesPerSlot; - } - - /** - * This is a setter. - * - * @param sakaiFacade - * a SakaiFacade object. - */ - public void setSakaiFacade(SakaiFacade sakaiFacade) { - this.sakaiFacade = sakaiFacade; - } - - /** - * Get a SignupMeetingService object. - * - * @return a SignupMeetingService object. - */ - public SignupMeetingService getSignupMeetingService() { - return signupMeetingService; - } - - /** - * This is a setter. - * - * @param signupMeetingService - * a SignupMeetingService object. - */ - public void setSignupMeetingService(SignupMeetingService signupMeetingService) { - this.signupMeetingService = signupMeetingService; - } - - /** - * This is for UI purpose to see if current user has signed up in the - * event/meeting. - */ - public boolean isCurrentUserSignedup() { - return currentUserSignedup; - } - - /** - * This is a setter. - * - * @param currentUserSignedup - * a boolean value. - */ - public void setCurrentUserSignedup(boolean currentUserSignedup) { - this.currentUserSignedup = currentUserSignedup; - } - - /** - * Get a list of TimeslotWrapper objects. - * - * @return a list of TimeslotWrapper objects. - */ - public List<TimeslotWrapper> getTimeslotWrappers() { - return timeslotWrappers; - } - - /** - * This is a setter. - * - * @param timeslotWrappers - * a list of TimeslotWrapper objects. - */ - public void setTimeslotWrappers(List<TimeslotWrapper> timeslotWrappers) { - this.timeslotWrappers = timeslotWrappers; - } - - /** - * This is only for UI purpose to check if the event/meeting is an open - * session style and signup is not required. - */ - public boolean getAnnouncementType() { - boolean anoun = false; - if (meetingWrapper !=null && meetingWrapper.getMeeting() !=null - && ANNOUNCEMENT.equals(meetingWrapper.getMeeting().getMeetingType())) - anoun= true; - - return anoun; - } - - /** - * This is only for UI purpose to check if the event/meeting is an - * individual style (manay time slots) and it requires signup. - */ - public boolean getIndividualType() { - return INDIVIDUAL.equals(meetingWrapper.getMeeting().getMeetingType()); - } - - /** - * This is only for UI purpose to check if the event/meeting is an group - * style (only one time slot) and it requires signup. - */ - public boolean getGroupType() { - return GROUP.equals(meetingWrapper.getMeeting().getMeetingType()); - } - - /** - * This is only for UI purpose to check if the event/meeting is an - * individual style (manay time slots) and it requires signup. - */ - public boolean getCustomTsType() { - return CUSTOM_TIMESLOTS.equals(meetingWrapper.getMeeting().getMeetingType()); - } - - /** - * Get a TimeslotWrapper object for UI. - * - * @return an TimeslotWrapper object. - */ - public TimeslotWrapper getTimeslotWrapper() { - return timeslotWrapper; - } - - /** - * This is a setter. - * - * @param timeslotWrapper - * a TimeslotWrapper object. - */ - public void setTimeslotWrapper(TimeslotWrapper timeslotWrapper) { - this.timeslotWrapper = timeslotWrapper; - } - - /** - * Check if email should be sent away. This is used by organizer of an - * event/meeting. - * - * @return true if email should be sent away. - */ - public boolean isSendEmail() { - if (!getPublishedSite()) - sendEmail = false; - - return sendEmail; - } - - /** - * This is a setter. - * - * @param sendEmail - * a boolean value. - */ - public void setSendEmail(boolean sendEmail) { - this.sendEmail = sendEmail; - } - - /** - * This is a getter method for UI. - * - * @return a constant string. - */ - public String getIndividual() { - return INDIVIDUAL; - } - - /** - * This is a getter method for UI. - * - * @return a constant string. - */ - public String getGroup() { - return GROUP; - } - - /** - * This is a getter method for UI. - * - * @return a constant string. - */ - public String getAnnouncement() { - return ANNOUNCEMENT; - } - - /** - * This is a getter method for UI - * - * @return true if the site is published. - */ - public Boolean getPublishedSite() { - if (this.publishedSite == null) { - try { - boolean status = sakaiFacade.getSiteService().getSite(sakaiFacade.getCurrentLocationId()).isPublished(); - this.publishedSite = new Boolean(status); - - } catch (Exception e) { - logger.warn(e.getMessage()); - this.publishedSite = new Boolean(false); - - } - } - - return publishedSite.booleanValue(); - } - - - public void cleanUpUnusedAttachmentCopies(List<SignupAttachment> attachList){ - if(attachList !=null){ - for (SignupAttachment attach : attachList) { - getAttachmentHandler().removeAttachmentInContentHost(attach); - } - attachList.clear(); - } - } - - public boolean getSignupAttachmentEmpty(){ - return this.meetingWrapper.getEmptyEventMainAttachment(); - } - - public AttachmentHandler getAttachmentHandler() { - return attachmentHandler; - } - - public void setAttachmentHandler(AttachmentHandler attachmentHandler) { - this.attachmentHandler = attachmentHandler; - } - - protected void markerTimeslots(List<TimeslotWrapper> TimeSlotWrpList){ - int i=0; - if(TimeSlotWrpList !=null){ - for (TimeslotWrapper tsWrp : TimeSlotWrpList) { - tsWrp.setTsMarker(i); - i++; - } - } - } - - public boolean isPublishToCalendar() { - return publishToCalendar; - } - - public void setPublishToCalendar(boolean publishToCalendar) { - this.publishToCalendar = publishToCalendar; - } - - /*public boolean getSendEmailAttendeeOnly() { - return sendEmailAttendeeOnly; - } - - public void setSendEmailAttendeeOnly(boolean sendEmailAttendeeOnly) { - this.sendEmailAttendeeOnly = sendEmailAttendeeOnly; - }*/ - - public String getSendEmailToSelectedPeopleOnly() { - return sendEmailToSelectedPeopleOnly; - } - - public void setSendEmailToSelectedPeopleOnly( - String sendEmailToSelectedPeopleOnly) { - this.sendEmailToSelectedPeopleOnly = sendEmailToSelectedPeopleOnly; - } - - /** - * Clean the list of attendees by checking that each user is valid - * @param attendees List of attendees to be cleaned - * @return the cleaned list - */ - public List<SignupAttendee> getValidAttendees(List<SignupAttendee> attendees) { - List<SignupAttendee> cleanedList = new ArrayList<SignupAttendee>(); - - for(SignupAttendee attendee: attendees){ - if(sakaiFacade.checkForUser(attendee.getAttendeeUserId())) { - cleanedList.add(attendee); - } - } - - return cleanedList; - } - - /** - * Gets the userId for a user, given an eid or an email address. - * We check if it matches the eid first, then if it matches an email address. - * If nothing, return null. - * - * @param value the string to lookup, could be an eid or an email address - * @return the userId or null if User cannot be found - */ - public String getUserIdForEidOrEmail(String value) { - User u = sakaiFacade.getUserByEid(value); - if(u==null) { - u=sakaiFacade.getUserByEmail(value); - } - - if(u!=null) { - return u.getId(); - } - - return null; - } - - - /** - * Get the eids assocaited with an email address, ie there may be two or more users with the same email address. - * We need to be able to handle this in the UI. - * - * @param email - * @return List<String> of eids. - */ - public List<String> getEidsForEmail(String email) { - List<User> users = sakaiFacade.getUsersByEmail(email); - - List<String> eids = new ArrayList<String>(); - for(User u:users) { - eids.add(u.getEid()); - } - - return eids; - } - - // Generate a group title based on the input given - public String generateGroupTitle(String meetingTitle, SignupTimeslot timeslot) { - - final char SEPARATOR = '-'; - - SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmm"); - - StringBuilder sb = new StringBuilder(); - - sb.append(meetingTitle); - sb.append(SEPARATOR); - sb.append(df.format(timeslot.getStartTime())); - sb.append(SEPARATOR); - sb.append(df.format(timeslot.getEndTime())); - - return sb.toString(); - } - - //generate a group description - public String generateGroupDescription(String meetingTitle, SignupTimeslot timeslot) { - return Utilities.rb.getString("group.description.default"); - } - //convert a list of SignupAttendees to a list of userIds - public List<String> convertAttendeesToUuids(List<SignupAttendee> attendees) { - - List<String> uuids = new ArrayList<String>(); - - for(SignupAttendee a: attendees) { - uuids.add(a.getAttendeeUserId()); - } - - return uuids; - } - - //convert a list of AttendeeWrappers to a list of userIds - public List<String> convertAttendeeWrappersToUuids(List<AttendeeWrapper> attendees) { - - List<String> uuids = new ArrayList<String>(); - - for(AttendeeWrapper a: attendees) { - uuids.add(a.getSignupAttendee().getAttendeeUserId()); - } - - return uuids; - } - - - /** - * Helper to get a formatted string of all attendee email addresses for all tineslots - * so we can use them in a mailto link - * @return String of all email addresses - */ - public String getAllAttendeesEmailAddressesFormatted() { - - Set<String> emails = new HashSet<String>(); - - StringBuilder sb = new StringBuilder(); - for (TimeslotWrapper tsWrapper : timeslotWrappers) { - for(AttendeeWrapper atWrapper : tsWrapper.getAttendeeWrappers()) { - String email = atWrapper.getAttendeeEmail(); - if(StringUtils.isNotBlank(email)){ - emails.add(email); - } - } - } - - for(String e: emails) { - sb.append(e); - //for compatibility with Outlook, this should be a semicolon not a comma as per the RFC. - //Also tested in Thunderbird, Yahoo and GMail. - sb.append(';'); - } - - //trim off last , and return - return StringUtils.removeEnd(sb.toString(), ";"); - } - - /** - * Generate and send for download an ICS file for the meeting. Contains no timeslots, just the meeting itself. - * This method is in this particular bean because 1. We have access to the meeting here, and 2. it is used in more than one sub-bean. - */ - - private UserTimeZone userTimeZone; - - public void downloadICSForMeeting() { - String filePath; - SignupMeeting meeting = meetingWrapper.getMeeting(); - - Date defaultEndTime = meeting.getEndTime(); - Date dfaultStartTime = meeting.getStartTime(); - - //pass user preference time in and need to reset back since the object is cached. - meeting.setEndTime(getUserTimezonePreferenceDate(defaultEndTime)); - meeting.setStartTime(getUserTimezonePreferenceDate(dfaultStartTime)); - - try{ - filePath = calendarHelper.createCalendarFile(Collections.singletonList(calendarHelper.generateVEventForMeeting(meeting))); - meeting.setEndTime(defaultEndTime); - meeting.setStartTime(dfaultStartTime); - }catch(NullPointerException ne){ - meeting.setEndTime(defaultEndTime); - meeting.setStartTime(dfaultStartTime); - handleICSDownloadWarningToUser(); - return; - } - - if(StringUtils.isNotBlank(filePath)) { - logger.debug("filepath: " + filePath); - sendDownload(filePath, ICS_MIME_TYPE); - } else { - logger.error("Could not generate file for download"); - //TODO this could set an error and return perhaps. - } - } - - public void downloadICSForMeetingTimeSlot(TimeslotWrapper timeslotWrapper) { - String filePath; - - SignupMeeting meeting = meetingWrapper.getMeeting(); - SignupTimeslot currentTimeslot = timeslotWrapper.getTimeSlot(); - - Date timeslotEndTime = currentTimeslot.getEndTime(); - Date timeslotStartTime = currentTimeslot.getStartTime(); - - Date defaultEndTime = meeting.getEndTime(); - Date dfaultStartTime = meeting.getStartTime(); - - //pass user preference time in and need to reset back since the object is cached. - meeting.setEndTime(getUserTimezonePreferenceDate(defaultEndTime)); - meeting.setStartTime(getUserTimezonePreferenceDate(dfaultStartTime)); - if(currentTimeslot !=null){ - currentTimeslot.setStartTime(getUserTimezonePreferenceDate(timeslotStartTime)); - currentTimeslot.setEndTime(getUserTimezonePreferenceDate(timeslotEndTime)); - } - - try{ - filePath = calendarHelper.createCalendarFile(Collections.singletonList(calendarHelper.generateVEventForTimeslot(meeting, currentTimeslot))); - //reset timezone back on serverside - if(currentTimeslot !=null){ - currentTimeslot.setStartTime(timeslotStartTime); - currentTimeslot.setEndTime(timeslotEndTime); - } - meeting.setEndTime(defaultEndTime); - meeting.setStartTime(dfaultStartTime); - }catch(NullPointerException ne){ - if(currentTimeslot !=null){ - currentTimeslot.setStartTime(timeslotStartTime); - currentTimeslot.setEndTime(timeslotEndTime); - } - meeting.setEndTime(defaultEndTime); - meeting.setStartTime(dfaultStartTime); - - handleICSDownloadWarningToUser(); - return; - } - - if(StringUtils.isNotBlank(filePath)) { - logger.debug("filepath: " + filePath); - sendDownload(filePath, ICS_MIME_TYPE); - } else { - logger.error("Could not generate file for download"); - //TODO this could set an error and return perhaps. - } - - } - - private Date getUserTimezonePreferenceDate(Date dateBasedOnServerTimezone){ - /* - * Since the external-calendar-service don't honor the timezone information (in - * iCal file), which is passed by Date object. Here, we just convert it manually here. - * Once the external-claendar-service can do the job, this method can be removed. - */ - TimeService timeService = sakaiFacade.getTimeService(); - TimeZone currentUserTimeZone = timeService.getLocalTimeZone(); - - Calendar cal = Calendar.getInstance(); - cal.setTime(dateBasedOnServerTimezone); - cal.setTimeZone(currentUserTimeZone); - - //get user Pref display hour, day, month and year - int userPrefMinute = cal.get(cal.MINUTE); - int userPrefHour = cal.get(cal.HOUR_OF_DAY); - int userPrefDay = cal.get(cal.DAY_OF_MONTH); - int userPrefMonth = cal.get(cal.MONTH); - int userPreYear = cal.get(cal.YEAR); - - Calendar calNew = Calendar.getInstance(); - calNew.setTime(dateBasedOnServerTimezone); - calNew.set(cal.MINUTE,userPrefMinute); - calNew.set(cal.HOUR_OF_DAY, userPrefHour); - calNew.set(cal.DAY_OF_MONTH, userPrefDay); - calNew.set(cal.MONTH, userPrefMonth); - calNew.set(cal.YEAR, userPreYear); - return calNew.getTime(); - } - - private void handleICSDownloadWarningToUser(){ - logger.error("The site calendar could not be retrieved when using the Signup tool"); - String warningFileName = Utilities.rb.getString("ics_file_name_for_failure_warning"); - String warningMsg = Utilities.rb.getString("ics_message_for_failure_warning"); - sendDownloadWarning(warningFileName,warningMsg); - } - - /** - * Send a file for download. - * - * @param filePath - * - */ - protected void sendDownload(String filePath, String mimeType) { - - FacesContext fc = FacesContext.getCurrentInstance(); - ServletOutputStream out = null; - FileInputStream in = null; - - String filename = StringUtils.substringAfterLast(filePath, File.separator); - - try { - HttpServletResponse response = (HttpServletResponse) fc.getExternalContext().getResponse(); - - response.reset(); - response.setHeader("Pragma", "public"); - response.setHeader("Cache-Control","public, must-revalidate, post-check=0, pre-check=0, max-age=0"); - response.setContentType(mimeType); - response.setHeader("Content-disposition", "attachment; filename=" + filename); - - in = FileUtils.openInputStream(new File(filePath)); - out = response.getOutputStream(); - - IOUtils.copy(in, out); - - out.flush(); - } catch (IOException ex) { - logger.warn("Error generating file for download:" + ex.getMessage()); - } finally { - IOUtils.closeQuietly(in); - IOUtils.closeQuietly(out); - } - fc.responseComplete(); - - } - - /** - * Send a warning message to user about failed ICS file generation - * @param fileName - * @param warningMsg - */ - protected void sendDownloadWarning(String fileName, String warningMsg) { - - FacesContext fc = FacesContext.getCurrentInstance(); - ServletOutputStream out = null; - - - try { - HttpServletResponse response = (HttpServletResponse) fc.getExternalContext().getResponse(); - - response.reset(); - response.setHeader("Pragma", "public"); - response.setHeader("Cache-Control","public, must-revalidate, post-check=0, pre-check=0, max-age=0"); - response.setContentType("text/plain"); - response.setHeader("Content-disposition", "attachment; filename=" + fileName); - - out = response.getOutputStream(); - warningMsg= warningMsg!=null? warningMsg:"Missing Scheduler tool on site"; - out.print(warningMsg); - - out.flush(); - } catch (IOException ex) { - logger.warn("Error generating file for download:" + ex.getMessage()); - } finally { - try{ - out.close(); - }catch (Exception e){ - //do nothing; - } - } - fc.responseComplete(); - - } - - /** - * Is ICS calendar generation enabled in the external calendaring service? - * @return true/false - */ - public boolean isIcsEnabled() { - return calendarHelper.isIcsEnabled(); - } - - private String iframeId = ""; - - /** - * This is a getter method which provide current Iframe id for refresh - * IFrame purpose. - * - * @return a String - */ - public String getIframeId() { - HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext() - .getRequest(); - String iFrameId = (String) request.getAttribute("sakai.tool.placement.id"); - return iFrameId; - } - - public void setIframeId(String iframeId) { - this.iframeId = iframeId; - } - - public String getCustomLocation() { - return customLocation; - } - - public void setCustomLocation(String customLocation) { - this.customLocation = customLocation; - } - - public String getCustomCategory() { - return customCategory; - } - - public void setCustomCategory(String customCategory) { - this.customCategory = customCategory; - } - -} +/* +* Licensed to The Apereo Foundation under one or more contributor license +* agreements. See the NOTICE file distributed with this work for +* additional information regarding copyright ownership. +* +* The Apereo Foundation licenses this file to you 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: +* +* http://opensource.org/licenses/ecl2.txt +* +* 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.sakaiproject.signup.tool.jsf; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Date; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; +import java.util.TimeZone; + +import javax.faces.context.FacesContext; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sakaiproject.signup.logic.SakaiFacade; +import org.sakaiproject.signup.logic.SignupCalendarHelper; +import org.sakaiproject.signup.logic.SignupMeetingService; +import org.sakaiproject.signup.logic.SignupMessageTypes; +import org.sakaiproject.signup.logic.SignupUserActionException; +import org.sakaiproject.signup.model.MeetingTypes; +import org.sakaiproject.signup.model.SignupAttachment; +import org.sakaiproject.signup.model.SignupAttendee; +import org.sakaiproject.signup.model.SignupMeeting; +import org.sakaiproject.signup.model.SignupTimeslot; +import org.sakaiproject.signup.tool.jsf.attachment.AttachmentHandler; +import org.sakaiproject.signup.tool.util.SignupBeanConstants; +import org.sakaiproject.signup.tool.util.Utilities; +import org.sakaiproject.time.api.TimeService; +import org.sakaiproject.user.api.User; + +import lombok.Getter; +import lombok.Setter; + +/** + * <p> + * This is a abstract base class for JSF Signup tool UIBean. It provides some + * must-have or common used methods such as getMeetingWrapper(), sakakFacade + * etc. + * </P> + */ +abstract public class SignupUIBaseBean implements SignupBeanConstants, SignupMessageTypes, MeetingTypes { + + protected SakaiFacade sakaiFacade; + + protected SignupMeetingService signupMeetingService; + + @Getter @Setter + protected SignupCalendarHelper calendarHelper; + + private AttachmentHandler attachmentHandler; + + protected SignupMeetingWrapper meetingWrapper; + + protected List<TimeslotWrapper> timeslotWrappers; + + protected TimeslotWrapper timeslotWrapper; + + protected boolean currentUserSignedup; + + protected static boolean DEFAULT_SEND_EMAIL = "true".equalsIgnoreCase(Utilities.getSignupConfigParamVal( + "signup.default.email.notification", "true")) ? true : false; + + protected static boolean DEFAULT_EXPORT_TO_CALENDAR_TOOL = "true".equalsIgnoreCase(Utilities.getSignupConfigParamVal("signup.default.export.to.calendar.setting", "true")) ? true : false; + + protected boolean publishToCalendar = DEFAULT_EXPORT_TO_CALENDAR_TOOL; + + protected boolean sendEmail = DEFAULT_SEND_EMAIL; + + protected Logger logger = LoggerFactory.getLogger(SignupUIBaseBean.class); + + protected Boolean publishedSite; + + //protected boolean sendEmailAttendeeOnly = false; + + protected String sendEmailToSelectedPeopleOnly = SEND_EMAIL_ALL_PARTICIPANTS; + + private int maxSlots; + + private int maxAttendeesPerSlot; + + protected String customLocation; + + protected String customCategory; + + protected static final String ICS_MIME_TYPE="text/calendar"; + + /** + * This method will get the most updated event/meeting data and handle all + * the wrapping process for UI. Due to effeciency, the data is only + * guarantied fresh at a 10 minutes interval (defined by + * <b>dataRefreshInterval</b> value). + * + * @return a SignupMeetingWrapper object. + */ + public SignupMeetingWrapper getMeetingWrapper() { + if (meetingWrapper != null && meetingWrapper.isRefresh()) { + try { + SignupMeeting meeting = signupMeetingService.loadSignupMeeting(meetingWrapper.getMeeting().getId(), + sakaiFacade.getCurrentUserId(), sakaiFacade.getCurrentLocationId()); + meetingWrapper.setMeeting(meeting); + updateTimeSlotWrappers(meetingWrapper); + } catch (Exception e) { + Utilities.addErrorMessage(Utilities.rb.getString("db.error_or_event.notExisted")); + logger.error(Utilities.rb.getString("db.error_or_event.notExisted") + " - " + e.getMessage()); + } + } + return meetingWrapper; + } + + /** process new data into Timeslot wrapper for UI purpose */ + protected void updateTimeSlotWrappers(SignupMeetingWrapper meetingWrapper) { + SignupMeeting meeting = this.meetingWrapper.getMeeting(); + if (meeting == null) + return; + + List timeslots = meeting.getSignupTimeSlots(); + if (timeslots == null) + return; + + List<TimeslotWrapper> timeslotWrapperList = new ArrayList<TimeslotWrapper>(); + setCurrentUserSignedup(false);// reset and make sure to capture new + // changes + int i = 0; + int totalSignedupSlots=0; + for (Iterator iter = timeslots.iterator(); iter.hasNext();) { + SignupTimeslot elm = (SignupTimeslot) iter.next(); + TimeslotWrapper tsw = new TimeslotWrapper(elm, sakaiFacade.getCurrentUserId()); + + List<AttendeeWrapper> attendeeWrp = new ArrayList<AttendeeWrapper>(); + int posIndex = 0; + //clean the list + List<SignupAttendee> cleanedList = getValidAttendees(elm.getAttendees()); + for (SignupAttendee attendee : cleanedList) { + AttendeeWrapper attWrp = new AttendeeWrapper(attendee, sakaiFacade.getUserDisplayLastFirstName(attendee + .getAttendeeUserId())); + attWrp.setPositionIndex(posIndex++); + attendeeWrp.add(attWrp); + + /* current user is already signed up in one of the timeslot */ + if (attendee.getAttendeeUserId().equals(sakaiFacade.getCurrentUserId())) + //setCurrentUserSignedup(true); + totalSignedupSlots++; + } + + //sorting by displayname + //JIRA: Signup-204 + posIndex = 0; + Collections.sort(attendeeWrp); + for (AttendeeWrapper attWrp : attendeeWrp) { + attWrp.setPositionIndex(posIndex++); + } + + tsw.setAttendeeWrappers(attendeeWrp); + + tsw.setWaitingList(wrapWaiters(elm.getWaitingList())); + tsw.setPositionInTSlist(i++); + timeslotWrapperList.add(tsw); + + } + int preferredSlot = meeting.getMaxNumOfSlots(); + if (totalSignedupSlots >= preferredSlot){ + setCurrentUserSignedup(true); + } + setTimeslotWrappers(timeslotWrapperList); + + } + + /** process the new data into Meeting wrapper for UI purpose */ + protected String updateMeetingwrapper(SignupMeeting meeting, String destinationUrl) { + /* if null,reload due to exception */ + try { + if (meeting == null) + meeting = signupMeetingService.loadSignupMeeting(this.meetingWrapper.getMeeting().getId(), sakaiFacade + .getCurrentUserId(), sakaiFacade.getCurrentLocationId()); + + getMeetingWrapper().setMeeting(meeting); + getMeetingWrapper().resetAvailableStatus();// re-process avail. + // status + updateTimeSlotWrappers(getMeetingWrapper()); + return destinationUrl; + } catch (Exception e) { + Utilities.addErrorMessage(Utilities.rb.getString("db.error_or_event.notExisted")); + logger.warn(Utilities.rb.getString("db.error_or_event.notExisted") + " - " + e.getMessage()); + Utilities.resetMeetingList(); + return MAIN_EVENTS_LIST_PAGE_URL; + } + } + + protected void updateSignupAttachmentWrapper(SignupMeeting meeting){ + + } + + /** + * setup the event/meeting's signup begin and deadline time and validate it + * too + */ + protected void setSignupBeginDeadlineData(SignupMeeting meeting, int signupBegin, String signupBeginType, + int signupDeadline, String signupDeadlineType) throws Exception { + Date sBegin = Utilities.subTractTimeToDate(meeting.getStartTime(), signupBegin, signupBeginType); + Date sDeadline = Utilities.subTractTimeToDate(meeting.getEndTime(), signupDeadline, signupDeadlineType); + + if (!START_NOW.equals(signupBeginType) && sBegin.before(new Date())) { + // a warning for user + Utilities.addErrorMessage(Utilities.rb.getString("warning.your.event.singup.begin.time.passed.today.time")); + } + + meeting.setSignupBegins(sBegin); + + if (sBegin.after(sDeadline)) + throw new SignupUserActionException(Utilities.rb.getString("signup.deadline.is.before.signup.begin")); + + meeting.setSignupDeadline(sDeadline); + } + + public boolean isMeetingOverRepeatPeriod(Date startTime, Date endTime, int repeatPeriodInDays){ + long duration= endTime.getTime()- startTime.getTime(); + if( 24*repeatPeriodInDays - duration /(MINUTE_IN_MILLISEC * Hour_In_MINUTES) >= 0 ) + return false; + + return true; + } + + /** convert SignupAttendee to AttendeeWrapper object */ + /*private List<AttendeeWrapper> wrapAttendees(List<SignupAttendee> attendees) { + List<AttendeeWrapper> attendeeWrp = new ArrayList<AttendeeWrapper>(); + int posIndex = 0; + + //clean the list + List<SignupAttendee> cleanedList = getValidAttendees(attendees); + + for (SignupAttendee attendee : cleanedList) { + AttendeeWrapper attWrp = new AttendeeWrapper(attendee, sakaiFacade.getUserDisplayName(attendee.getAttendeeUserId())); + attWrp.setPositionIndex(posIndex++); + attendeeWrp.add(attWrp); + + // current user is already signed up in one of the timeslot + if (attendee.getAttendeeUserId().equals(sakaiFacade.getCurrentUserId())) { + setCurrentUserSignedup(true); + } + } + return attendeeWrp; + }*/ + + /** convert SignupAttendee to AttendeeWrapper object */ + private List<AttendeeWrapper> wrapWaiters(List<SignupAttendee> attendees) { + List<AttendeeWrapper> attendeeWrp = new ArrayList<AttendeeWrapper>(); + for (SignupAttendee attendee : attendees) { + attendeeWrp + .add(new AttendeeWrapper(attendee, sakaiFacade.getUserDisplayLastFirstName(attendee.getAttendeeUserId()))); + } + + return attendeeWrp; + } + + /** + * This is a setter. + * + * @param meetingWrapper + * a SignupMeetingWrapper object. + */ + public void setMeetingWrapper(SignupMeetingWrapper meetingWrapper) { + this.meetingWrapper = meetingWrapper; + } + + /** + * Get a SakaiFacade object. + * + * @return a SakaiFacade object. + */ + public SakaiFacade getSakaiFacade() { + return sakaiFacade; + } + + + /** + * @return the maxSlots + */ + public int getMaxSlots() { + String maxSlotsStringVal = Utilities.getSignupConfigParamVal("signup.maxSlots", "500"); + try{ + maxSlots = Integer.parseInt(maxSlotsStringVal); + } + catch (Exception e){ + maxSlots = 500; + } + return maxSlots; + } + + /** + * @param maxSlots the maxSlots to set + */ + public void setMaxSlots(int maxSlots) { + this.maxSlots = maxSlots; + } + + /** + * @return the maxAttendeesPerSlot + */ + public int getMaxAttendeesPerSlot() { + String maxAttendeesStringVal = Utilities.getSignupConfigParamVal("signup.maxAttendeesPerSlot", "500"); + try{ + maxAttendeesPerSlot = Integer.parseInt(maxAttendeesStringVal); + } + catch(Exception e){ + maxAttendeesPerSlot=500; + } + return maxAttendeesPerSlot; + } + + /** + * @param maxAttendeesPerSlot the maxAttendeesPerSlot to set + */ + public void setMaxAttendeesPerSlot(int maxAttendeesPerSlot) { + this.maxAttendeesPerSlot = maxAttendeesPerSlot; + } + + /** + * This is a setter. + * + * @param sakaiFacade + * a SakaiFacade object. + */ + public void setSakaiFacade(SakaiFacade sakaiFacade) { + this.sakaiFacade = sakaiFacade; + } + + /** + * Get a SignupMeetingService object. + * + * @return a SignupMeetingService object. + */ + public SignupMeetingService getSignupMeetingService() { + return signupMeetingService; + } + + /** + * This is a setter. + * + * @param signupMeetingService + * a SignupMeetingService object. + */ + public void setSignupMeetingService(SignupMeetingService signupMeetingService) { + this.signupMeetingService = signupMeetingService; + } + + /** + * This is for UI purpose to see if current user has signed up in the + * event/meeting. + */ + public boolean isCurrentUserSignedup() { + return currentUserSignedup; + } + + /** + * This is a setter. + * + * @param currentUserSignedup + * a boolean value. + */ + public void setCurrentUserSignedup(boolean currentUserSignedup) { + this.currentUserSignedup = currentUserSignedup; + } + + /** + * Get a list of TimeslotWrapper objects. + * + * @return a list of TimeslotWrapper objects. + */ + public List<TimeslotWrapper> getTimeslotWrappers() { + return timeslotWrappers; + } + + /** + * This is a setter. + * + * @param timeslotWrappers + * a list of TimeslotWrapper objects. + */ + public void setTimeslotWrappers(List<TimeslotWrapper> timeslotWrappers) { + this.timeslotWrappers = timeslotWrappers; + } + + /** + * This is only for UI purpose to check if the event/meeting is an open + * session style and signup is not required. + */ + public boolean getAnnouncementType() { + boolean anoun = false; + if (meetingWrapper !=null && meetingWrapper.getMeeting() !=null + && ANNOUNCEMENT.equals(meetingWrapper.getMeeting().getMeetingType())) + anoun= true; + + return anoun; + } + + /** + * This is only for UI purpose to check if the event/meeting is an + * individual style (manay time slots) and it requires signup. + */ + public boolean getIndividualType() { + return INDIVIDUAL.equals(meetingWrapper.getMeeting().getMeetingType()); + } + + /** + * This is only for UI purpose to check if the event/meeting is an group + * style (only one time slot) and it requires signup. + */ + public boolean getGroupType() { + return GROUP.equals(meetingWrapper.getMeeting().getMeetingType()); + } + + /** + * This is only for UI purpose to check if the event/meeting is an + * individual style (manay time slots) and it requires signup. + */ + public boolean getCustomTsType() { + return CUSTOM_TIMESLOTS.equals(meetingWrapper.getMeeting().getMeetingType()); + } + + /** + * Get a TimeslotWrapper object for UI. + * + * @return an TimeslotWrapper object. + */ + public TimeslotWrapper getTimeslotWrapper() { + return timeslotWrapper; + } + + /** + * This is a setter. + * + * @param timeslotWrapper + * a TimeslotWrapper object. + */ + public void setTimeslotWrapper(TimeslotWrapper timeslotWrapper) { + this.timeslotWrapper = timeslotWrapper; + } + + /** + * Check if email should be sent away. This is used by organizer of an + * event/meeting. + * + * @return true if email should be sent away. + */ + public boolean isSendEmail() { + if (!getPublishedSite()) + sendEmail = false; + + return sendEmail; + } + + /** + * This is a setter. + * + * @param sendEmail + * a boolean value. + */ + public void setSendEmail(boolean sendEmail) { + this.sendEmail = sendEmail; + } + + /** + * This is a getter method for UI. + * + * @return a constant string. + */ + public String getIndividual() { + return INDIVIDUAL; + } + + /** + * This is a getter method for UI. + * + * @return a constant string. + */ + public String getGroup() { + return GROUP; + } + + /** + * This is a getter method for UI. + * + * @return a constant string. + */ + public String getAnnouncement() { + return ANNOUNCEMENT; + } + + /** + * This is a getter method for UI + * + * @return true if the site is published. + */ + public Boolean getPublishedSite() { + if (this.publishedSite == null) { + try { + boolean status = sakaiFacade.getSiteService().getSite(sakaiFacade.getCurrentLocationId()).isPublished(); + this.publishedSite = new Boolean(status); + + } catch (Exception e) { + logger.warn(e.getMessage()); + this.publishedSite = new Boolean(false); + + } + } + + return publishedSite.booleanValue(); + } + + + public void cleanUpUnusedAttachmentCopies(List<SignupAttachment> attachList){ + if(attachList !=null){ + for (SignupAttachment attach : attachList) { + getAttachmentHandler().removeAttachmentInContentHost(attach); + } + attachList.clear(); + } + } + + public boolean getSignupAttachmentEmpty(){ + return this.meetingWrapper.getEmptyEventMainAttachment(); + } + + public AttachmentHandler getAttachmentHandler() { + return attachmentHandler; + } + + public void setAttachmentHandler(AttachmentHandler attachmentHandler) { + this.attachmentHandler = attachmentHandler; + } + + protected void markerTimeslots(List<TimeslotWrapper> TimeSlotWrpList){ + int i=0; + if(TimeSlotWrpList !=null){ + for (TimeslotWrapper tsWrp : TimeSlotWrpList) { + tsWrp.setTsMarker(i); + i++; + } + } + } + + public boolean isPublishToCalendar() { + return publishToCalendar; + } + + public void setPublishToCalendar(boolean publishToCalendar) { + this.publishToCalendar = publishToCalendar; + } + + /*public boolean getSendEmailAttendeeOnly() { + return sendEmailAttendeeOnly; + } + + public void setSendEmailAttendeeOnly(boolean sendEmailAttendeeOnly) { + this.sendEmailAttendeeOnly = sendEmailAttendeeOnly; + }*/ + + public String getSendEmailToSelectedPeopleOnly() { + return sendEmailToSelectedPeopleOnly; + } + + public void setSendEmailToSelectedPeopleOnly( + String sendEmailToSelectedPeopleOnly) { + this.sendEmailToSelectedPeopleOnly = sendEmailToSelectedPeopleOnly; + } + + /** + * Clean the list of attendees by checking that each user is valid + * @param attendees List of attendees to be cleaned + * @return the cleaned list + */ + public List<SignupAttendee> getValidAttendees(List<SignupAttendee> attendees) { + List<SignupAttendee> cleanedList = new ArrayList<SignupAttendee>(); + + for(SignupAttendee attendee: attendees){ + if(sakaiFacade.checkForUser(attendee.getAttendeeUserId())) { + cleanedList.add(attendee); + } + } + + return cleanedList; + } + + /** + * Gets the userId for a user, given an eid or an email address. + * We check if it matches the eid first, then if it matches an email address. + * If nothing, return null. + * + * @param value the string to lookup, could be an eid or an email address + * @return the userId or null if User cannot be found + */ + public String getUserIdForEidOrEmail(String value) { + User u = sakaiFacade.getUserByEid(value); + if(u==null) { + u=sakaiFacade.getUserByEmail(value); + } + + if(u!=null) { + return u.getId(); + } + + return null; + } + + + /** + * Get the eids assocaited with an email address, ie there may be two or more users with the same email address. + * We need to be able to handle this in the UI. + * + * @param email + * @return List<String> of eids. + */ + public List<String> getEidsForEmail(String email) { + List<User> users = sakaiFacade.getUsersByEmail(email); + + List<String> eids = new ArrayList<String>(); + for(User u:users) { + eids.add(u.getEid()); + } + + return eids; + } + + // Generate a group title based on the input given + public String generateGroupTitle(String meetingTitle, SignupTimeslot timeslot) { + + final char SEPARATOR = '-'; + + SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmm"); + + StringBuilder sb = new StringBuilder(); + + sb.append(meetingTitle); + sb.append(SEPARATOR); + sb.append(df.format(timeslot.getStartTime())); + sb.append(SEPARATOR); + sb.append(df.format(timeslot.getEndTime())); + + return sb.toString(); + } + + //generate a group description + public String generateGroupDescription(String meetingTitle, SignupTimeslot timeslot) { + return Utilities.rb.getString("group.description.default"); + } + //convert a list of SignupAttendees to a list of userIds + public List<String> convertAttendeesToUuids(List<SignupAttendee> attendees) { + + List<String> uuids = new ArrayList<String>(); + + for(SignupAttendee a: attendees) { + uuids.add(a.getAttendeeUserId()); + } + + return uuids; + } + + //convert a list of AttendeeWrappers to a list of userIds + public List<String> convertAttendeeWrappersToUuids(List<AttendeeWrapper> attendees) { + + List<String> uuids = new ArrayList<String>(); + + for(AttendeeWrapper a: attendees) { + uuids.add(a.getSignupAttendee().getAttendeeUserId()); + } + + return uuids; + } + + + /** + * Helper to get a formatted string of all attendee email addresses for all tineslots + * so we can use them in a mailto link + * @return String of all email addresses + */ + public String getAllAttendeesEmailAddressesFormatted() { + + Set<String> emails = new HashSet<String>(); + + StringBuilder sb = new StringBuilder(); + for (TimeslotWrapper tsWrapper : timeslotWrappers) { + for(AttendeeWrapper atWrapper : tsWrapper.getAttendeeWrappers()) { + String email = atWrapper.getAttendeeEmail(); + if(StringUtils.isNotBlank(email)){ + emails.add(email); + } + } + } + + for(String e: emails) { + sb.append(e); + //for compatibility with Outlook, this should be a semicolon not a comma as per the RFC. + //Also tested in Thunderbird, Yahoo and GMail. + sb.append(';'); + } + + //trim off last , and return + return StringUtils.removeEnd(sb.toString(), ";"); + } + + /** + * Generate and send for download an ICS file for the meeting. Contains no timeslots, just the meeting itself. + * This method is in this particular bean because 1. We have access to the meeting here, and 2. it is used in more than one sub-bean. + */ + + private UserTimeZone userTimeZone; + + public void downloadICSForMeeting() { + String filePath; + SignupMeeting meeting = meetingWrapper.getMeeting(); + + Date defaultEndTime = meeting.getEndTime(); + Date dfaultStartTime = meeting.getStartTime(); + + //pass user preference time in and need to reset back since the object is cached. + meeting.setEndTime(getUserTimezonePreferenceDate(defaultEndTime)); + meeting.setStartTime(getUserTimezonePreferenceDate(dfaultStartTime)); + + try{ + filePath = calendarHelper.createCalendarFile(Collections.singletonList(calendarHelper.generateVEventForMeeting(meeting))); + meeting.setEndTime(defaultEndTime); + meeting.setStartTime(dfaultStartTime); + }catch(NullPointerException ne){ + meeting.setEndTime(defaultEndTime); + meeting.setStartTime(dfaultStartTime); + handleICSDownloadWarningToUser(); + return; + } + + if(StringUtils.isNotBlank(filePath)) { + logger.debug("filepath: " + filePath); + sendDownload(filePath, ICS_MIME_TYPE); + } else { + logger.error("Could not generate file for download"); + //TODO this could set an error and return perhaps. + } + } + + public void downloadICSForMeetingTimeSlot(TimeslotWrapper timeslotWrapper) { + String filePath; + + SignupMeeting meeting = meetingWrapper.getMeeting(); + SignupTimeslot currentTimeslot = timeslotWrapper.getTimeSlot(); + + Date timeslotEndTime = currentTimeslot.getEndTime(); + Date timeslotStartTime = currentTimeslot.getStartTime(); + + Date defaultEndTime = meeting.getEndTime(); + Date dfaultStartTime = meeting.getStartTime(); + + //pass user preference time in and need to reset back since the object is cached. + meeting.setEndTime(getUserTimezonePreferenceDate(defaultEndTime)); + meeting.setStartTime(getUserTimezonePreferenceDate(dfaultStartTime)); + if(currentTimeslot !=null){ + currentTimeslot.setStartTime(getUserTimezonePreferenceDate(timeslotStartTime)); + currentTimeslot.setEndTime(getUserTimezonePreferenceDate(timeslotEndTime)); + } + + try{ + filePath = calendarHelper.createCalendarFile(Collections.singletonList(calendarHelper.generateVEventForTimeslot(meeting, currentTimeslot))); + //reset timezone back on serverside + if(currentTimeslot !=null){ + currentTimeslot.setStartTime(timeslotStartTime); + currentTimeslot.setEndTime(timeslotEndTime); + } + meeting.setEndTime(defaultEndTime); + meeting.setStartTime(dfaultStartTime); + }catch(NullPointerException ne){ + if(currentTimeslot !=null){ + currentTimeslot.setStartTime(timeslotStartTime); + currentTimeslot.setEndTime(timeslotEndTime); + } + meeting.setEndTime(defaultEndTime); + meeting.setStartTime(dfaultStartTime); + + handleICSDownloadWarningToUser(); + return; + } + + if(StringUtils.isNotBlank(filePath)) { + logger.debug("filepath: " + filePath); + sendDownload(filePath, ICS_MIME_TYPE); + } else { + logger.error("Could not generate file for download"); + //TODO this could set an error and return perhaps. + } + + } + + private Date getUserTimezonePreferenceDate(Date dateBasedOnServerTimezone){ + /* + * Since the external-calendar-service don't honor the timezone information (in + * iCal file), which is passed by Date object. Here, we just convert it manually here. + * Once the external-claendar-service can do the job, this method can be removed. + */ + TimeService timeService = sakaiFacade.getTimeService(); + TimeZone currentUserTimeZone = timeService.getLocalTimeZone(); + + Calendar cal = Calendar.getInstance(); + cal.setTime(dateBasedOnServerTimezone); + cal.setTimeZone(currentUserTimeZone); + + //get user Pref display hour, day, month and year + int userPrefMinute = cal.get(cal.MINUTE); + int userPrefHour = cal.get(cal.HOUR_OF_DAY); + int userPrefDay = cal.get(cal.DAY_OF_MONTH); + int userPrefMonth = cal.get(cal.MONTH); + int userPreYear = cal.get(cal.YEAR); + + Calendar calNew = Calendar.getInstance(); + calNew.setTime(dateBasedOnServerTimezone); + calNew.set(cal.MINUTE,userPrefMinute); + calNew.set(cal.HOUR_OF_DAY, userPrefHour); + calNew.set(cal.DAY_OF_MONTH, userPrefDay); + calNew.set(cal.MONTH, userPrefMonth); + calNew.set(cal.YEAR, userPreYear); + return calNew.getTime(); + } + + private void handleICSDownloadWarningToUser(){ + logger.error("The site calendar could not be retrieved when using the Signup tool"); + String warningFileName = Utilities.rb.getString("ics_file_name_for_failure_warning"); + String warningMsg = Utilities.rb.getString("ics_message_for_failure_warning"); + sendDownloadWarning(warningFileName,warningMsg); + } + + /** + * Send a file for download. + * + * @param filePath + * + */ + protected void sendDownload(String filePath, String mimeType) { + + FacesContext fc = FacesContext.getCurrentInstance(); + ServletOutputStream out = null; + FileInputStream in = null; + + String filename = StringUtils.substringAfterLast(filePath, File.separator); + + try { + HttpServletResponse response = (HttpServletResponse) fc.getExternalContext().getResponse(); + + response.reset(); + response.setHeader("Pragma", "public"); + response.setHeader("Cache-Control","public, must-revalidate, post-check=0, pre-check=0, max-age=0"); + response.setContentType(mimeType); + response.setHeader("Content-disposition", "attachment; filename=" + filename); + + in = FileUtils.openInputStream(new File(filePath)); + out = response.getOutputStream(); + + IOUtils.copy(in, out); + + out.flush(); + } catch (IOException ex) { + logger.warn("Error generating file for download:" + ex.getMessage()); + } finally { + IOUtils.closeQuietly(in); + IOUtils.closeQuietly(out); + } + fc.responseComplete(); + + } + + /** + * Send a warning message to user about failed ICS file generation + * @param fileName + * @param warningMsg + */ + protected void sendDownloadWarning(String fileName, String warningMsg) { + + FacesContext fc = FacesContext.getCurrentInstance(); + ServletOutputStream out = null; + + + try { + HttpServletResponse response = (HttpServletResponse) fc.getExternalContext().getResponse(); + + response.reset(); + response.setHeader("Pragma", "public"); + response.setHeader("Cache-Control","public, must-revalidate, post-check=0, pre-check=0, max-age=0"); + response.setContentType("text/plain"); + response.setHeader("Content-disposition", "attachment; filename=" + fileName); + + out = response.getOutputStream(); + warningMsg= warningMsg!=null? warningMsg:"Missing Scheduler tool on site"; + out.print(warningMsg); + + out.flush(); + } catch (IOException ex) { + logger.warn("Error generating file for download:" + ex.getMessage()); + } finally { + try{ + out.close(); + }catch (Exception e){ + //do nothing; + } + } + fc.responseComplete(); + + } + + /** + * Is ICS calendar generation enabled in the external calendaring service? + * @return true/false + */ + public boolean isIcsEnabled() { + return calendarHelper.isIcsEnabled(); + } + + private String iframeId = ""; + + /** + * This is a getter method which provide current Iframe id for refresh + * IFrame purpose. + * + * @return a String + */ + public String getIframeId() { + HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext() + .getRequest(); + String iFrameId = (String) request.getAttribute("sakai.tool.placement.id"); + return iFrameId; + } + + public void setIframeId(String iframeId) { + this.iframeId = iframeId; + } + + public String getCustomLocation() { + return customLocation; + } + + public void setCustomLocation(String customLocation) { + this.customLocation = customLocation; + } + + public String getCustomCategory() { + return customCategory; + } + + public void setCustomCategory(String customCategory) { + this.customCategory = customCategory; + } + +} diff --git a/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/attachment/AttachmentHandler.java b/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/attachment/AttachmentHandler.java index dfcc8d79ab4f..26b3c7140df1 100644 --- a/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/attachment/AttachmentHandler.java +++ b/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/attachment/AttachmentHandler.java @@ -30,8 +30,8 @@ import javax.faces.context.ExternalContext; import javax.faces.context.FacesContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.Role; import org.sakaiproject.content.api.ContentResource; import org.sakaiproject.content.api.FilePickerHelper; @@ -57,7 +57,7 @@ */ public class AttachmentHandler implements Serializable { - private static Log log = LogFactory.getLog(AttachmentHandler.class); + private static Logger log = LoggerFactory.getLogger(AttachmentHandler.class); private List<SignupAttachment> attachments; diff --git a/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/organizer/OrganizerSignupMBean.java b/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/organizer/OrganizerSignupMBean.java index 186e8885a23a..5bc7ca2c5ea0 100644 --- a/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/organizer/OrganizerSignupMBean.java +++ b/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/organizer/OrganizerSignupMBean.java @@ -1,1451 +1,1451 @@ -/* -* Licensed to The Apereo Foundation under one or more contributor license -* agreements. See the NOTICE file distributed with this work for -* additional information regarding copyright ownership. -* -* The Apereo Foundation licenses this file to you 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: -* -* http://opensource.org/licenses/ecl2.txt -* -* 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.sakaiproject.signup.tool.jsf.organizer; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.List; - -import javax.faces.component.UIData; -import javax.faces.component.UIInput; -import javax.faces.event.ActionEvent; -import javax.faces.model.SelectItem; -import javax.faces.model.SelectItemGroup; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.sakaiproject.exception.IdUnusedException; -import org.sakaiproject.signup.logic.SignupUser; -import org.sakaiproject.signup.logic.SignupUserActionException; -import org.sakaiproject.signup.logic.messages.SignupEventTrackingInfo; -import org.sakaiproject.signup.model.SignupAttendee; -import org.sakaiproject.signup.model.SignupMeeting; -import org.sakaiproject.signup.model.SignupSite; -import org.sakaiproject.signup.tool.jsf.AttendeeWrapper; -import org.sakaiproject.signup.tool.jsf.SignupMeetingWrapper; -import org.sakaiproject.signup.tool.jsf.SignupUIBaseBean; -import org.sakaiproject.signup.tool.jsf.TimeslotWrapper; -import org.sakaiproject.signup.tool.jsf.attendee.EditCommentSignupMBean; -import org.sakaiproject.signup.tool.jsf.organizer.action.AddAttendee; -import org.sakaiproject.signup.tool.jsf.organizer.action.AddWaiter; -import org.sakaiproject.signup.tool.jsf.organizer.action.CancelAttendee; -import org.sakaiproject.signup.tool.jsf.organizer.action.CancelRestoreTimeslot; -import org.sakaiproject.signup.tool.jsf.organizer.action.LockUnlockTimeslot; -import org.sakaiproject.signup.tool.jsf.organizer.action.MoveAttendee; -import org.sakaiproject.signup.tool.jsf.organizer.action.RemoveWaiter; -import org.sakaiproject.signup.tool.jsf.organizer.action.ReplaceAttendee; -import org.sakaiproject.signup.tool.jsf.organizer.action.SwapAttendee; -import org.sakaiproject.signup.tool.util.Utilities; -import org.sakaiproject.site.api.Site; -import org.sakaiproject.user.api.UserNotDefinedException; - -/** - * <p> - * This JSF UIBean class will handle information exchanges between Organizer's - * event/meeting view page:<b>orgSignupMeeting.jsp</b> and backbone system. It - * provides all the necessary business logic - * - * @author Peter Liu - * - * </P> - */ -public class OrganizerSignupMBean extends SignupUIBaseBean { - - private UIData timeslotWrapperTable; - - private UIInput attendeeTimeSlotWithId; - - private UIInput replacedAttendeeEidOrEmail; - - /* proxy param for eid by user input */ - private String eidOrEmailByUser; - - private UIInput waiterEidOrEmail; - - private UIData attendeeWrapperTable; - - private UIData waiterWrapperTable; - - private List<SelectItem> allAttendees; - - private List<SignupUser> allSignupUsers; - - public static final String DELIMITER = "::"; - - private String selectedAction = REPLACE_ACTION; - - private String selectedEditTimeslotId; - - private UIInput selectedTimeslotId; - - private Log logger = LogFactory.getLog(OrganizerSignupMBean.class); - - private boolean addNewAttendee; - - private UIInput addNewAttendeeUserEidOrEmail; - - private UIInput listPendingType; - - private String userActionType = REPLACE_ACTION; - - private String selectedFirstUser = "gl256"; - - private String currentUserId; - - private String currentSiteId; - - private CopyMeetingSignupMBean copyMeetingMBean; - - private EditMeetingSignupMBean editMeetingMBean; - - private EditCommentSignupMBean editCommentMBean; - - private CancelRestoreTimeslot cancelRestoreTimeslot; - - private boolean collapsedMeetingInfo; - - private boolean eidInputMode = false; - public String timeslottoGroup; - - /** - * This will initialize all the wrapper objects such as - * SignupMeetingWrapper, SignupTimeslotWrapper etc. - * - * @param meetingWrapper - * a SignupMeetingWrapper object. - */ - public void init(SignupMeetingWrapper meetingWrapper) throws Exception { - this.eidInputMode = false; - this.collapsedMeetingInfo = false; - reset(meetingWrapper); - loadAllAttendees(meetingWrapper.getMeeting()); - } - - /** - * This will basically update the Timeslot wrappers after event/meeting is - * updated - * - * @param meetingWrapper - * a SignupMeetingWrapper object. - */ - public void reset(SignupMeetingWrapper meetingWrapper) { - setMeetingWrapper(meetingWrapper); - updateTimeSlotWrappers(meetingWrapper); - setEidInputMode(meetingWrapper.getMeeting().isEidInputMode()); - if(!isEidInputMode() && (getAllAttendees()==null || getAllAttendees().isEmpty())){ - loadAllAttendees(meetingWrapper.getMeeting()); - } - - //reset email checkBox value setting - this.sendEmail = meetingWrapper.getMeeting().isSendEmailByOwner(); - - } - - /** - * This is a JSF action call method by UI to modify the event/meeting. - * - * @return an action outcome string. - */ - public String modifyMeeting() { - /* get latest copy of meeting */ - SignupMeeting meeting = null; - String goMainPageDueToError = updateMeetingwrapper(meeting, ORGANIZER_MEETING_PAGE_URL); - if (goMainPageDueToError.equals(MAIN_EVENTS_LIST_PAGE_URL)) - return goMainPageDueToError; - - editMeetingMBean.setMeetingWrapper(getMeetingWrapper()); - editMeetingMBean.reset(); - - return MODIFY_MEETING_PAGE_URL; - } - - /** - * This is a JSF action call method by UI to copy the event/meeting. - * - * @return an action outcome string. - */ - public String copyMeeting() { - copyMeetingMBean.setMeetingWrapper(getMeetingWrapper()); - copyMeetingMBean.reset(); - return COPTY_MEETING_PAGE_URL; - } - - /** - * This is a JSF action call method by UI to lock/unlock time slot of the - * event/meeting. - * - * @return an action outcome string. - */ - public String processLockTsAction() { - SignupMeeting meeting = null; - try { - TimeslotWrapper timeslotWrapper = (TimeslotWrapper) timeslotWrapperTable.getRowData(); - LockUnlockTimeslot lockTimeslot = new LockUnlockTimeslot(getMeetingWrapper().getMeeting(), timeslotWrapper - .getTimeSlot(), currentUserId(), currentSiteId(), signupMeetingService); - meeting = lockTimeslot.lockOrUnlock(); - } catch (SignupUserActionException ue) { - Utilities.addErrorMessage(ue.getMessage()); - } catch (Exception e) { - logger.error(Utilities.rb.getString("error.occurred_try_again") + " - " + e.getMessage()); - Utilities.addErrorMessage(Utilities.rb.getString("error.occurred_try_again")); - } - - return updateMeetingwrapper(meeting, ORGANIZER_MEETING_PAGE_URL); - } - - /** - * This is a JSF action call method by UI to go to Cancel confirmation page. - * - * @return an action outcome string. - */ - public String initiateCancelTimeslot() { - TimeslotWrapper timeslotWrapper = (TimeslotWrapper) timeslotWrapperTable.getRowData(); - cancelRestoreTimeslot = new CancelRestoreTimeslot(getMeetingWrapper().getMeeting(), timeslotWrapper - .getTimeSlot(), currentUserId(), currentSiteId(), signupMeetingService); - return cancelRestoreTimeslot(); - } - - /** - * This is a JSF action call method by UI to restore time slot of the - * event/meeting. - * - * @return an action outcome string - */ - public String restoreTimeslot() { - TimeslotWrapper timeslotWrapper = (TimeslotWrapper) timeslotWrapperTable.getRowData(); - cancelRestoreTimeslot = new CancelRestoreTimeslot(getMeetingWrapper().getMeeting(), timeslotWrapper - .getTimeSlot(), currentUserId(), currentSiteId(), signupMeetingService); - return cancelRestoreTimeslot(); - } - - /** - * This is a JSF action call method by UI to cancel time slot of the - * event/meeting. - * - * @return an action outcome string - */ - public String cancelTimeslot() { - return cancelRestoreTimeslot(); - } - - /** - * This is a JSF action call method by UI to view a specific attendee's - * comment of the event/meeting. - * - * @return an action outcome string. - */ - public String viewAttendeeComment() { - String attUserId = (String) Utilities.getRequestParam("attendeeUserId"); - String timeslotId = (String) Utilities.getRequestParam("timeslotId"); - if (attUserId == null || timeslotId == null) - return ""; - - AttendeeWrapper attWrp = findAttendee(timeslotId, attUserId); - if (attWrp == null) - return ""; - - this.editCommentMBean.init(attWrp, this.getAttendeeRole(attUserId), getMeetingWrapper(), timeslotId); - return VIEW_COMMENT_PAGE_URL; - } - - /** - * find an attendee in a specific time slot - * @param timeslotId - * @param userId - * @return - */ - private AttendeeWrapper findAttendee(String timeslotId, String userId) { - if (getTimeslotWrappers() == null || getTimeslotWrappers().isEmpty()) - return null; - - String timeslotPeriod = null; - for (TimeslotWrapper wrapper : getTimeslotWrappers()) { - if (wrapper.getTimeSlot().getId().toString().equals(timeslotId)) { - timeslotPeriod = getSakaiFacade().getTimeService().newTime( - wrapper.getTimeSlot().getStartTime().getTime()).toStringLocalTime() - + " - " - + getSakaiFacade().getTimeService().newTime(wrapper.getTimeSlot().getEndTime().getTime()) - .toStringLocalTime(); - List<AttendeeWrapper> attWrp = wrapper.getAttendeeWrappers(); - for (AttendeeWrapper att : attWrp) { - if (att.getSignupAttendee().getAttendeeUserId().equals(userId)) { - att.setTimeslotPeriod(timeslotPeriod); - return att; - } - } - break; - } - } - return null; - } - - private String getAttendeeRole(String attendeeUserId) { - SignupUser sUser = getSakaiFacade().getSignupUser(getMeetingWrapper().getMeeting(), attendeeUserId); - if (sUser == null) - return "unknown"; - else - return sUser.getUserRole().getId(); - } - - private String cancelRestoreTimeslot() { - if (cancelRestoreTimeslot == null) - return ORGANIZER_MEETING_PAGE_URL; - - SignupMeeting meeting = null; - try { - meeting = cancelRestoreTimeslot.cancelOrRestore(); - if (sendEmail) { - try { - signupMeetingService.sendEmailToParticipantsByOrganizerAction(cancelRestoreTimeslot - .getSignupEventTrackingInfo()); - } catch (Exception e) { - logger.error(Utilities.rb.getString("email.exception") + " - " + e.getMessage(), e); - Utilities.addErrorMessage(Utilities.rb.getString("email.exception")); - } - } - } catch (Exception e) { - logger.error(Utilities.rb.getString("error.occurred_try_again") + " - " + e.getMessage()); - Utilities.addErrorMessage(Utilities.rb.getString("error.occurred_try_again")); - } - - return updateMeetingwrapper(meeting, ORGANIZER_MEETING_PAGE_URL); - } - - /** - * This is a JSF action call method by UI to edit the attendee in the - * event/meeting. - * - * @return an action outcome string. - */ - public String editTimeslotAttendee() { - SignupMeeting meeting = null; - try { - SignupEventTrackingInfo signupEventTrackingInfo = null; - if (this.userActionType.equals(MOVE_ACTION)) { // old:selectedAction - signupEventTrackingInfo = moveAttendee(); - } - if (this.userActionType.equals(REPLACE_ACTION)) { - try { - signupEventTrackingInfo = replaceAttendee(); - } catch (UserNotDefinedException e) { - logger.warn(Utilities.rb.getString("exception.no.such.user") - + (String) replacedAttendeeEidOrEmail.getValue() + " -- " + e.getMessage()); - Utilities.addErrorMessage(Utilities.rb.getString("exception.no.such.user") - + (String) replacedAttendeeEidOrEmail.getValue()); - return ""; - } - } - - if (this.userActionType.equals(SWAP_ACTION)) { - signupEventTrackingInfo = swapAttendees(); - } - - if (sendEmail) { - try { - signupMeetingService.sendEmailToParticipantsByOrganizerAction(signupEventTrackingInfo); - } catch (Exception e) { - logger.error(Utilities.rb.getString("email.exception") + " - " + e.getMessage(), e); - Utilities.addErrorMessage(Utilities.rb.getString("email.exception")); - } - } - - } catch (SignupUserActionException ue) { - Utilities.addErrorMessage(ue.getMessage()); - - } catch (Exception e) { - logger.error(Utilities.rb.getString("error.occurred_try_again") + " - " + e.getMessage()); - Utilities.addErrorMessage(Utilities.rb.getString("error.occurred_try_again")); - } - - /* reset */ - setSelectedAction(REPLACE_ACTION); - - /* - * refresh meeting list to catch the changes when go back the main - * meetings list page - */ - if (Utilities.getSignupMeetingsBean().isShowMyAppointmentTime()) - Utilities.resetMeetingList(); - - return updateMeetingwrapper(meeting, ORGANIZER_MEETING_PAGE_URL); - } - - /* The logic below assumes an attendee appears only once in a timeslot */ - private SignupEventTrackingInfo swapAttendees() throws Exception { - SwapAttendee swapAttendee = new SwapAttendee(currentUserId(), currentSiteId(), signupMeetingService); - TimeslotWrapper currentTimeslotWrapper = (TimeslotWrapper) timeslotWrapperTable.getRowData(); - - swapAttendee.swapAttendee(getMeetingWrapper().getMeeting(), currentTimeslotWrapper.getTimeSlot(), - this.selectedFirstUser, (String) attendeeTimeSlotWithId.getValue()); - - return swapAttendee.getSignupEventTrackingInfo(); - } - - private SignupEventTrackingInfo replaceAttendee() throws Exception { - String userEidOrEmail = null; - if (isEidInputMode()) { - userEidOrEmail = getEidOrEmailInputByUser(); - } else { - userEidOrEmail = (String) replacedAttendeeEidOrEmail.getValue(); - } - - //check if there are multiple email addresses associated with input - List<String> associatedEids = getEidsForEmail(userEidOrEmail.trim()); - if(associatedEids.size() > 1) { - throw new SignupUserActionException(MessageFormat.format(Utilities.rb.getString("exception.multiple.eids"), new Object[] {userEidOrEmail, StringUtils.join(associatedEids, ", ")})); - } - - String replacerUserId = getUserIdForEidOrEmail(userEidOrEmail); - SignupUser replSignUser = getSakaiFacade().getSignupUser(getMeetingWrapper().getMeeting(), replacerUserId); - if(replSignUser ==null){ - throw new SignupUserActionException(MessageFormat.format(Utilities.rb.getString("user.has.no.permission.attend"), new Object[] {userEidOrEmail})); - } - - TimeslotWrapper wrapper = (TimeslotWrapper) timeslotWrapperTable.getRowData(); - - ReplaceAttendee replaceAttendee = new ReplaceAttendee(this.currentUserId(), this.currentSiteId(), - signupMeetingService); - replaceAttendee.replace(getMeetingWrapper().getMeeting(), wrapper.getTimeSlot(), this.selectedFirstUser, - replacerUserId, replSignUser.getMainSiteId()); - - return replaceAttendee.getSignupEventTrackingInfo(); - } - - private SignupEventTrackingInfo moveAttendee() throws Exception { - TimeslotWrapper wrapper = (TimeslotWrapper) timeslotWrapperTable.getRowData(); - - MoveAttendee moveAttendee = new MoveAttendee(this.currentUserId(), this.currentSiteId(), signupMeetingService); - moveAttendee.move(getMeetingWrapper().getMeeting(), wrapper.getTimeSlot(), this.selectedFirstUser, - (String) selectedTimeslotId.getValue()); - - return moveAttendee.getSignupEventTrackingInfo(); - - } - - /** - * This will load all the potential participants for an event/meeting and - * wrap it for UI purpose. Due to efficiency issue, it will auto rolled back - * to Eid-Input mode when the number of users are bigger thank 600 ( defined - * by <I>MAX_NUM_ATTENDEES_ALLOWED_BEFORE_AUTO_SWITCH_TO_EID_INPUT_MODE</I>} - * value). - * - * @param meeting - * a SignupMeeting object. - */ - public void loadAllAttendees(SignupMeeting meeting) { - if(meeting.isEidInputMode()){ - setEidInputMode(true); - return; - } - - - try { - Site site = getSakaiFacade().getSiteService().getSite(getSakaiFacade().getCurrentLocationId()); - if(site !=null){ - int allMemeberSize = site.getMembers()!=null? site.getMembers().size() : 0; - /* - * due to efficiency, user has to input EID instead of using dropdown - * user name list - */ - /*First check to avoid load all site member up if there is ten of thousends*/ - if(allMemeberSize > MAX_NUM_PARTICIPANTS_FOR_DROPDOWN_BEFORE_AUTO_SWITCH_TO_EID_INPUT_MODE){ - setEidInputMode(true); - return; - } - } - } catch (IdUnusedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - this.allSignupUsers = sakaiFacade.getAllPossibleAttendees(meeting); - /* - * due to efficiency, user has to input EID instead of using dropdown - * user name list - */ - if (allSignupUsers != null - && allSignupUsers.size() > MAX_NUM_PARTICIPANTS_FOR_DROPDOWN_BEFORE_AUTO_SWITCH_TO_EID_INPUT_MODE) { - setEidInputMode(true); - return; - } - - setEidInputMode(false); - allAttendees = new ArrayList<SelectItem>(); - String previous_displayName =""; - int index = 0; - for (SignupUser user : allSignupUsers) { - if(user.getDisplayName().equals(previous_displayName)){ - allAttendees.add(new SelectItem(user.getEid(), user.getDisplayName()+ "(" + user.getEid() +")")); - SelectItem prev_sItem = allAttendees.get(index-1); - //checking: not already has eid for triple duplicates case - if(!prev_sItem.getLabel().contains("(")){ - prev_sItem.setLabel(prev_sItem.getLabel() + " (" + prev_sItem.getValue() +")"); - } - - }else { - allAttendees.add(new SelectItem(user.getEid(), user.getDisplayName())); - } - - previous_displayName = user.getDisplayName(); - index++; - } - } - - /* This one overwrites the parent one due to two more stuffs to create */ - protected void updateTimeSlotWrappers(SignupMeetingWrapper meetingWrapper) { - super.updateTimeSlotWrappers(meetingWrapper); - /* for organizer UI swap-dropdown list */ - createUISwapListForEachTimeSlot(getTimeslotWrappers()); - createMoveAvailabelTimeSlots(getTimeslotWrappers()); - - } - - /* create the avaiable timeslot for UI purpose */ - private void createMoveAvailabelTimeSlots(List<TimeslotWrapper> timeslotWrapperList) { - - List<SelectItem> list = new ArrayList<SelectItem>(); - for (TimeslotWrapper wrapper : timeslotWrapperList) { - list.add(new SelectItem(wrapper.getTimeSlot().getId().toString(), wrapper.getLabel())); - } - - /* - * list of avalilable timeslot for move excluding the current timeslot - */ - for (int i = 0; i < list.size(); i++) { - List<SelectItem> moveAvailableTimeSlots = new ArrayList<SelectItem>(list); - moveAvailableTimeSlots.remove(i);// remove the current one - - TimeslotWrapper wrapper = timeslotWrapperList.get(i); - wrapper.setMoveAvailableTimeSlots(moveAvailableTimeSlots); - } - } - - /* create possible swap dropdown choices for UI purpose */ - private void createUISwapListForEachTimeSlot(List<TimeslotWrapper> timeslotWrapperList) { - List<SelectItem> tsAttendeeGroups = new ArrayList<SelectItem>(); - for (TimeslotWrapper wrapper : timeslotWrapperList) { - String grpLabel = wrapper.getLabel(); - List<SelectItem> attendeeOnTS = new ArrayList<SelectItem>(); - - //clean the list of attendees - List<SignupAttendee> attendees = getValidAttendees(wrapper.getTimeSlot().getAttendees()); - - if (attendees != null && !attendees.isEmpty()) { - for (SignupAttendee att : attendees) { - SelectItem sItem = new SelectItem(wrapper.getTimeSlot().getId() + DELIMITER + att.getAttendeeUserId(), sakaiFacade.getUserDisplayName(att.getAttendeeUserId())); - attendeeOnTS.add(sItem); - } - } - - SelectItemGroup sigrp = new SelectItemGroup(grpLabel, "Timeslot Name", false, (SelectItem[]) attendeeOnTS - .toArray(new SelectItem[0])); - tsAttendeeGroups.add(sigrp); - } - - /* - * list of avalilable timeslot for swap excluding the current timeslot - */ - for (int i = 0; i < tsAttendeeGroups.size(); i++) { - List<SelectItem> swapAvailableTimeSlots = new ArrayList<SelectItem>(tsAttendeeGroups); - swapAvailableTimeSlots.remove(i);// remove the current one - - TimeslotWrapper wrapper = timeslotWrapperList.get(i); - wrapper.setSwapDropDownList(swapAvailableTimeSlots); - } - } - - public UIData getTimeslotWrapperTable() { - return timeslotWrapperTable; - } - - public void setTimeslotWrapperTable(UIData timeslotWrapperTable) { - this.timeslotWrapperTable = timeslotWrapperTable; - } - - public UIInput getAttendeeTimeSlotWithId() { - return attendeeTimeSlotWithId; - } - - public void setAttendeeTimeSlotWithId(UIInput attendeeEid) { - this.attendeeTimeSlotWithId = attendeeEid; - } - - public UIInput getWaiterEidOrEmail() { - return waiterEidOrEmail; - } - - public void setWaiterEidOrEmail(UIInput waiterEidOrEmail) { - this.waiterEidOrEmail = waiterEidOrEmail; - } - - public String prepareAddAttendee() { - setAddNewAttendee(true); - setSelectedEditTimeslotId(null); - return ORGANIZER_MEETING_PAGE_URL; - } - - /** - * This is a JSF action call method by UI to add a new attendee into the - * event/meeting. - * - * @return an action outcome string. - */ - public String addAttendee() { - TimeslotWrapper timeslotWrapper = (TimeslotWrapper) timeslotWrapperTable.getRowData(); - - String newAttendeeEidOrEmail = null; - if (isEidInputMode()) { - newAttendeeEidOrEmail = getEidOrEmailInputByUser(); - } else { - if (addNewAttendeeUserEidOrEmail != null && ((String) addNewAttendeeUserEidOrEmail.getValue()).trim().length() > 0) { - newAttendeeEidOrEmail = ((String) addNewAttendeeUserEidOrEmail.getValue()).trim(); - } - } - - if (StringUtils.isBlank(newAttendeeEidOrEmail)) { - return ORGANIZER_MEETING_PAGE_URL; - } - - //check if there are multiple email addresses associated with input - List<String> associatedEids = getEidsForEmail(newAttendeeEidOrEmail.trim()); - if(associatedEids.size() > 1) { - Utilities.addErrorMessage(MessageFormat.format(Utilities.rb.getString("exception.multiple.eids"), new Object[] {newAttendeeEidOrEmail, StringUtils.join(associatedEids, ", ")})); - return ORGANIZER_MEETING_PAGE_URL; - } - - String newUserId = getUserIdForEidOrEmail(newAttendeeEidOrEmail.trim()); - if(StringUtils.isBlank(newUserId)){ - Utilities.addErrorMessage(Utilities.rb.getString("exception.no.such.user") + newAttendeeEidOrEmail); - return ORGANIZER_MEETING_PAGE_URL; - } - - SignupUser newAttendeeSignUser = getSakaiFacade().getSignupUser(getMeetingWrapper().getMeeting(), newUserId); - if(newAttendeeSignUser ==null){ - Utilities.addErrorMessage(MessageFormat.format(Utilities.rb.getString("user.has.no.permission.attend"), new Object[] {newAttendeeEidOrEmail})); - return ORGANIZER_MEETING_PAGE_URL; - } - - SignupAttendee newAttendee = new SignupAttendee(newUserId, newAttendeeSignUser.getMainSiteId()); - timeslotWrapper.setNewAttendee(newAttendee); - - SignupMeeting meeting = null; - try { - AddAttendee addAttendee = new AddAttendee(signupMeetingService, currentUserId(), currentSiteId(), true); - meeting = addAttendee.signup(getMeetingWrapper().getMeeting(), timeslotWrapper.getTimeSlot(), - timeslotWrapper.getNewAttendee()); - - /*TODO : we may need to re-think adding this sendAtteneeEmail condition here. We want that the Organizer will be enable to control - * the email notification via that checkBox on 'Organizer Meeting' page. - * */ - boolean sendAttendeeEmail = false;//Utilities.getSignupConfigParamVal("signup.email.notification.attendee.signed.up", true); - - if (sendEmail || sendAttendeeEmail) { - try { - signupMeetingService.sendEmailToParticipantsByOrganizerAction(addAttendee - .getSignupEventTrackingInfo()); - } catch (Exception e) { - logger.error(Utilities.rb.getString("email.exception") + " - " + e.getMessage(), e); - Utilities.addErrorMessage(Utilities.rb.getString("email.exception")); - } - } - } catch (SignupUserActionException ue) { - Utilities.addErrorMessage(ue.getMessage()); - - } catch (Exception e) { - logger.error(Utilities.rb.getString("error.occurred_try_again") + " - " + e.getMessage()); - Utilities.addErrorMessage(Utilities.rb.getString("error.occurred_try_again")); - } - - String nextPage = updateMeetingwrapper(meeting, ORGANIZER_MEETING_PAGE_URL); - // TODO calendar event id; - - if (ORGANIZER_MEETING_PAGE_URL.equals(nextPage)) { - setAddNewAttendee(false); - setSelectedTimeslotId(null); - } - return nextPage; - } - - /** - * This is a JSF action call method by UI to reset user input. - * - * @return an action outcome string. - */ - public String cancelAddAttendee() { - setAddNewAttendee(false); - setAddNewAttendeeUserEidOrEmail(null); - - return ORGANIZER_MEETING_PAGE_URL; - } - - /** - * This is a JSF action call method by UI to remove an attendee from the - * event/meeting. - * - * @return an action outcome string. - */ - public String removeAttendee() { - SignupMeeting meeting = null; - TimeslotWrapper timeslotWrapper = (TimeslotWrapper) timeslotWrapperTable.getRowData(); - String removedUserId = (String) Utilities.getRequestParam(ATTENDEE_USER_ID); - try { - CancelAttendee remove = new CancelAttendee(signupMeetingService, currentUserId(), currentSiteId(), true); - SignupAttendee removedAttendee = new SignupAttendee(removedUserId, currentSiteId()); - meeting = remove.cancelSignup(getMeetingWrapper().getMeeting(), timeslotWrapper.getTimeSlot(), - removedAttendee); - - if (sendEmail) { - try { - signupMeetingService.sendEmailToParticipantsByOrganizerAction(remove.getSignupEventTrackingInfo()); - } catch (Exception e) { - logger.error(Utilities.rb.getString("email.exception") + " - " + e.getMessage(), e); - Utilities.addErrorMessage(Utilities.rb.getString("email.exception")); - } - } - } catch (SignupUserActionException ue) { - Utilities.addErrorMessage(ue.getMessage()); - } catch (Exception e) { - logger.error(Utilities.rb.getString("error.occurred_try_again") + " - " + e.getMessage()); - Utilities.addErrorMessage(Utilities.rb.getString("error.occurred_try_again")); - } - - /* - * refresh meeting list to catch the changes when go back the main - * meeting list page - */ - if (Utilities.getSignupMeetingsBean().isShowMyAppointmentTime()) - Utilities.resetMeetingList(); - - return updateMeetingwrapper(meeting, ORGANIZER_MEETING_PAGE_URL); - } - - /** - * This is a JSF action call method by UI to add the attendee to a waiting - * list in the event/meeting. - * - * @return an action outcome string. - */ - public String addAttendeeToWList() { - TimeslotWrapper timeslotWrapper = (TimeslotWrapper) timeslotWrapperTable.getRowData(); - - String newWaiterEidOrEmail = null; - if (isEidInputMode()) { - newWaiterEidOrEmail = getEidOrEmailInputByUser(); - } else { - if (waiterEidOrEmail != null && ((String) waiterEidOrEmail.getValue()).trim().length() > 0) - newWaiterEidOrEmail = ((String) waiterEidOrEmail.getValue()).trim(); - } - - if (StringUtils.isBlank(newWaiterEidOrEmail)) { - return ORGANIZER_MEETING_PAGE_URL; - } - - //check if there are multiple email addresses associated with input - List<String> associatedEids = getEidsForEmail(newWaiterEidOrEmail.trim()); - if(associatedEids.size() > 1) { - Utilities.addErrorMessage(MessageFormat.format(Utilities.rb.getString("exception.multiple.eids"), new Object[] {newWaiterEidOrEmail, StringUtils.join(associatedEids, ", ")})); - return ORGANIZER_MEETING_PAGE_URL; - } - - String waiterUserId = getUserIdForEidOrEmail(newWaiterEidOrEmail.trim()); - if(StringUtils.isBlank(waiterUserId)){ - Utilities.addErrorMessage(Utilities.rb.getString("exception.no.such.user") + newWaiterEidOrEmail); - return ORGANIZER_MEETING_PAGE_URL; - } - - SignupUser waiterSignUser = getSakaiFacade().getSignupUser(getMeetingWrapper().getMeeting(), waiterUserId); - if(waiterSignUser ==null){ - Utilities.addErrorMessage(MessageFormat.format(Utilities.rb.getString("user.has.no.permission.attend"), new Object[] {newWaiterEidOrEmail})); - return ORGANIZER_MEETING_PAGE_URL; - } - - SignupAttendee newWaiter = new SignupAttendee(waiterUserId, waiterSignUser.getMainSiteId()); - SignupMeeting meeting = null; - try { - AddWaiter addWaiter = new AddWaiter(signupMeetingService, currentUserId(), currentSiteId(), - getListOperationType(), true); - meeting = addWaiter.addToWaitingList(getMeetingWrapper().getMeeting(), timeslotWrapper.getTimeSlot(), - newWaiter); - /* reset */ - resetWaitingListPendingType(); - } catch (SignupUserActionException ue) { - Utilities.addErrorMessage(ue.getMessage()); - } catch (Exception e) { - logger.error(Utilities.rb.getString("error.occurred_try_again") + " - " + e.getMessage()); - Utilities.addErrorMessage(Utilities.rb.getString("error.occurred_try_again")); - } - - // TODO calendar event id; - - return updateMeetingwrapper(meeting, ORGANIZER_MEETING_PAGE_URL); - } - - private void resetWaitingListPendingType() { - setListPendingType(null); - } - - /** - * This is a JSF action call method by UI to remove the attendee from the - * waiting list in the event/meeting. - * - * @return an action outcome string. - */ - public String removeAttendeeFromWList() { - TimeslotWrapper timeslotWrapper = (TimeslotWrapper) timeslotWrapperTable.getRowData(); - String removedUserId = (String) Utilities.getRequestParam(ATTENDEE_USER_ID); - - if (StringUtils.isBlank(removedUserId)) { - return ORGANIZER_MEETING_PAGE_URL; - } - SignupAttendee removedWaiter = new SignupAttendee(removedUserId, currentSiteId()); - SignupMeeting meeting = null; - - try { - RemoveWaiter removeWaiter = new RemoveWaiter(signupMeetingService, currentUserId(), currentSiteId(), - getListOperationType(), true); - meeting = removeWaiter.removeFromWaitingList(getMeetingWrapper().getMeeting(), timeslotWrapper - .getTimeSlot(), removedWaiter); - } catch (SignupUserActionException ue) { - Utilities.addErrorMessage(ue.getMessage()); - } catch (Exception e) { - logger.error(Utilities.rb.getString("error.occurred_try_again") + " - " + e.getMessage()); - Utilities.addErrorMessage(Utilities.rb.getString("error.occurred_try_again")); - } - - return updateMeetingwrapper(meeting, ORGANIZER_MEETING_PAGE_URL); - } - - /** - * This is a JSF getter method to get the selected attendee. - * - * @return an UIData object. - */ - public UIData getAttendeeWrapperTable() { - return attendeeWrapperTable; - } - - /** - * This is a setter. - * - * @param attendeeWrapperTable - * an UIData object, which is selected by user. - */ - public void setAttendeeWrapperTable(UIData attendeeWrapperTable) { - this.attendeeWrapperTable = attendeeWrapperTable; - } - - /** - * This is a getter method for UI. - * - * @return an UIData object. - */ - public UIData getWaiterWrapperTable() { - return waiterWrapperTable; - } - - /** - * This is a setter for UI. - * - * @param waiterWrapperTable - * an UIData object. - */ - public void setWaiterWrapperTable(UIData waiterWrapperTable) { - this.waiterWrapperTable = waiterWrapperTable; - } - - /** - * This is getter for UI. - * - * @return a list of SelectItem objects. - */ - public List<SelectItem> getAllAttendees() { - return allAttendees; - } - - /** - * This is a setter. - * - * @param allAttendees - */ - public void setAllAttendees(List<SelectItem> allAttendees) { - this.allAttendees = allAttendees; - } - - /** - * This is a getter for UI. - * - * @return a constant string. - */ - public String getAttendeeUserId() { - return ATTENDEE_USER_ID; - } - - /** - * This is a getter method for UI. - * - * @return a string value. - */ - public String getSelectedEditTimeslotId() { - return selectedEditTimeslotId; - } - - /** - * This is a setter. - * - * @param selectedEditTimeslotId - * a time slot Id string. - */ - public void setSelectedEditTimeslotId(String selectedEditTimeslotId) { - this.selectedEditTimeslotId = selectedEditTimeslotId; - } - - /** - * This is a getter for UI. - * - * @return a constant string. - */ - public String getMoveAction() { - return MOVE_ACTION; - } - - /** - * This is a getter for UI. - * - * @return a constant string - */ - public String getReplaceAction() { - return REPLACE_ACTION; - } - - /** - * This is a getter for UI. - * - * @return a constant string. - */ - public String getSwapAction() { - return SWAP_ACTION; - } - - /** - * This is a getter for UI. - * - * @return a constant string. - */ - public String getOnTopList() { - return ON_TOP_LIST; - } - - /** - * This is a getter for UI. - * - * @return a constant string. - */ - public String getOnBottomList() { - return ON_BOTTOM_LIST; - } - - /** - * This is a getter. - * - * @return a selected action string. - */ - public String getSelectedAction() { - return selectedAction; - } - - /** - * This is a setter. - * - * @param selectedAction - * a string value. - */ - public void setSelectedAction(String selectedAction) { - this.selectedAction = selectedAction; - } - - /** - * This is a getter for UI. - * - * @return an UIInput object. - */ - public UIInput getReplacedAttendeeEidOrEmail() { - return replacedAttendeeEidOrEmail; - } - - /** - * This is a setter. - * - * @param replacedAttendeeEid - * an UIInput object. - */ - public void setReplacedAttendeeEidOrEmail(UIInput replacedAttendeeEidOrEmail) { - this.replacedAttendeeEidOrEmail = replacedAttendeeEidOrEmail; - } - - /** - * This is a getter. - * - * @return an UIInput object. - */ - public UIInput getSelectedTimeslotId() { - return selectedTimeslotId; - } - - /** - * This is a setter. - * - * @param selectedTimeslotId - * a time slot Id string. - */ - public void setSelectedTimeslotId(UIInput selectedTimeslotId) { - this.selectedTimeslotId = selectedTimeslotId; - } - - /** - * Check if the action is a add-new-attendee. - */ - public boolean isAddNewAttendee() { - return addNewAttendee; - } - - /** - * This is a setter. - * - * @param addNewAttendee - * a boolean value. - */ - public void setAddNewAttendee(boolean addNewAttendee) { - this.addNewAttendee = addNewAttendee; - } - - /** - * This is a getter. - * - * @return am UIInput object. - */ - public UIInput getAddNewAttendeeUserEidOrEmail() { - return addNewAttendeeUserEidOrEmail; - } - - /** - * This is a setter. - * - * @param addNewAttendeeUserEidOrEmail - * an attendee's Eid or email string. - */ - public void setAddNewAttendeeUserEidOrEmail(UIInput addNewAttendeeUserEidOrEmail) { - this.addNewAttendeeUserEidOrEmail = addNewAttendeeUserEidOrEmail; - } - - /** - * This is a getter. - * - * @return a user-first selected attendee eid string. - */ - public String getSelectedFirstUser() { - return selectedFirstUser; - } - - /** - * This is a setter. - * - * @param selectedFirstUser - * an eid stirng. - */ - public void setSelectedFirstUser(String selectedFirstUser) { - this.selectedFirstUser = selectedFirstUser; - } - - /** - * This is a getter for UI. - * - * @return a action type string. - */ - public String getUserActionType() { - return userActionType; - } - - /** - * This is a setter. - * - * @param userActionType - * a action type string. - */ - public void setUserActionType(String userActionType) { - this.userActionType = userActionType; - } - - /** - * This is a getter, which tells how to pend an attendee into a waiting list - * (on top or on bottom). - * - * @return an UIInput object. - */ - public UIInput getListPendingType() { - return listPendingType; - } - - /** - * This is a setter. - * - * @param listPendingType - * a pending type string (on top or on bottom). - */ - public void setListPendingType(UIInput listPendingType) { - this.listPendingType = listPendingType; - } - - private String getListOperationType() { - if (this.listPendingType != null && this.listPendingType.getValue() != null - && ((String) this.listPendingType.getValue()).trim().length() > 0) - return ((String) this.listPendingType.getValue()).trim(); - - return ON_BOTTOM_LIST; - } - - private String currentUserId() { - if (this.currentUserId == null) - currentUserId = sakaiFacade.getCurrentUserId(); - - return currentUserId; - } - - private String currentSiteId() { - if (this.currentSiteId == null) - currentSiteId = sakaiFacade.getCurrentLocationId(); - - return currentSiteId; - } - - /** - * This is a getter method. - * - * @return a CopyMeetingSignupMBean object. - */ - public CopyMeetingSignupMBean getCopyMeetingMBean() { - return copyMeetingMBean; - } - - /** - * This is a setter. - * - * @param copyMeetingMBean - * a CopyMeetingSignupMBean object. - */ - public void setCopyMeetingMBean(CopyMeetingSignupMBean copyMeetingMBean) { - this.copyMeetingMBean = copyMeetingMBean; - } - - /** - * This is a getter method. - * - * @return an EditMeetingSignupMBean object. - */ - public EditMeetingSignupMBean getEditMeetingMBean() { - return editMeetingMBean; - } - - /** - * This is a setter. - * - * @param editMeetingMBean - * an EditMeetingSignupMBean object. - */ - public void setEditMeetingMBean(EditMeetingSignupMBean editMeetingMBean) { - this.editMeetingMBean = editMeetingMBean; - } - - /** - * This is a getter method. - * - * @return a EditCommentSignupMBean object. - */ - public EditCommentSignupMBean getEditCommentMBean() { - return editCommentMBean; - } - - /** - * This is a setter. - * - * @param editCommentMBean - * a EditCommentSignupMBean object. - */ - public void setEditCommentMBean(EditCommentSignupMBean editCommentMBean) { - this.editCommentMBean = editCommentMBean; - } - - /** - * Check if the user input mode is Eid mode or not. - * - * @return true if the user input mode is Eid mode - */ - public boolean isEidInputMode() { - return eidInputMode; - } - - /** - * This is a setter. - * - * @param eidInputMode - * a boolean value. - */ - public void setEidInputMode(boolean eidInputMode) { - this.eidInputMode = eidInputMode; - } - - /** - * This is for javascrip UI only. - * - * @return empty string. - */ - public String getUserInputEidOrEmail() { - return ""; - } - - /** - * This is a setter. - * - * @param value - * an user input eid or email address value . - */ - public void setUserInputEidOrEmail(String value) { - if (StringUtils.isNotBlank(value)) { - this.eidOrEmailByUser = value; - } - } - - /** - * It's a getter method for UI. - * - * @return a list of SignupSite objects. - */ - public List<SignupSite> getPublishedSignupSites() { - return getMeetingWrapper().getMeeting().getSignupSites(); - } - - /* proxy method */ - private String getEidOrEmailInputByUser() { - String value = this.eidOrEmailByUser; - this.eidOrEmailByUser = null;// reset for only use once - return value; - } - - /** - * It's a getter method for UI - * - * @return a boolean value - */ - public boolean isCollapsedMeetingInfo() { - return collapsedMeetingInfo; - } - - /** - * This is a setter method for UI. - * - * @param collapsedMeetingInfo - * a boolean value - */ - public void setCollapsedMeetingInfo(boolean collapsedMeetingInfo) { - this.collapsedMeetingInfo = collapsedMeetingInfo; - } - - /** - * This is to retrieve attr from UI Commandbutton - * - * @param timeslottoGroup - * a String value - */ - public void attrListener(ActionEvent event){ - - timeslottoGroup = (String) Utilities.getActionAttribute(event, "timeslottoGroup"); - - } - - /** - * It's a getter method for UI - * denotes the direction of the synchronize process - * @return a String value timeslottoGroup - */ - public String gettimeslottoGroup() { - return timeslottoGroup; - } - - /** - * This is a setter - * @return a String value - */ - public void setNickname(String timeslottoGroup) { - this.timeslottoGroup = timeslottoGroup; - } - - /** - * Synchronise the users in a timeslot with the users in a group. - * VT customized to allow the user choose the synchronize direction - - * @return url to the same page which will trigger a reload - */ - public String synchroniseGroupMembership() { - - TimeslotWrapper timeslotWrapper = (TimeslotWrapper) timeslotWrapperTable.getRowData(); - - //get groupId for timeslot - String groupId = timeslotWrapper.getGroupId(); - SignupMeeting meeting = null; - - if(StringUtils.isBlank(groupId)){ - //TODO. - //Create the group. Grab the list of attendees in the timeslot and add all at once. - //Will need to also save the groupId into the timeslot. - //For now, we just give a message. - - Utilities.addErrorMessage(Utilities.rb.getString("error.no_group_for_timeslot")); - return ORGANIZER_MEETING_PAGE_URL; - } else { - List<String> attendeeUserIds = convertAttendeeWrappersToUuids(timeslotWrapper.getAttendeeWrappers()); - - //process to synchronize the time slot attendees to group - - if(timeslottoGroup != null && !timeslottoGroup.trim().isEmpty() && !sakaiFacade.addUsersToGroup(attendeeUserIds, currentSiteId(), groupId, timeslottoGroup)) { - Utilities.addErrorMessage(Utilities.rb.getString("error.group_sync_failed")); - return ORGANIZER_MEETING_PAGE_URL; - } - - //retrieve all members in group - List<String> groupMembers = sakaiFacade.getGroupMembers(currentSiteId(), groupId); - - //process to synchronize from site group members to time slot - if (timeslottoGroup == null || timeslottoGroup.isEmpty()){ - - //1. first to keep the common members of timeslot and group - - List<String> commonmem = new ArrayList<String>(attendeeUserIds); - commonmem.retainAll(groupMembers); - - //2. only add the group members not existed in timeslot - groupMembers.removeAll(attendeeUserIds); - - //3. remove the time slot attendees that existed only in timeslot - try { - for (String mem: attendeeUserIds){ - if(!commonmem.contains(mem)){ - CancelAttendee remove = new CancelAttendee(signupMeetingService, currentUserId(), currentSiteId(), true); - SignupAttendee removedAttendee = new SignupAttendee(mem, currentSiteId()); - meeting = remove.cancelSignup(getMeetingWrapper().getMeeting(), timeslotWrapper.getTimeSlot(),removedAttendee); - if (sendEmail) { - try { - signupMeetingService.sendEmailToParticipantsByOrganizerAction(remove.getSignupEventTrackingInfo()); - } catch (Exception e) { - logger.error(Utilities.rb.getString("email.exception") + " - " + e.getMessage(), e); - Utilities.addErrorMessage(Utilities.rb.getString("email.exception")); - } - } - } - } - }catch (SignupUserActionException ue) { - Utilities.addErrorMessage(ue.getMessage()); - } catch (Exception e) { - logger.error(Utilities.rb.getString("error.occurred_try_again") + " - " + e.getMessage()); - Utilities.addErrorMessage(Utilities.rb.getString("error.occurred_try_again")); - } - } else{ - //remove all of the existing attendees from this list to remove duplicates - groupMembers.removeAll(attendeeUserIds); - } - - //add members and go to return page - return addAttendeesToTimeslot(currentSiteId(),timeslotWrapper, groupMembers); - } - } - - - /** - * Helper to add users to a timeslot and get the return URL - * @param userId - * @return - */ - private String addAttendeesToTimeslot(String siteId, TimeslotWrapper timeslotWrapper, List<String> userIds) { - - boolean errors = false; - SignupMeeting meeting = null; - - //foreach userId, add to timeslot - for(String userId: userIds) { - - SignupAttendee attendee = new SignupAttendee(userId, siteId); - timeslotWrapper.setNewAttendee(attendee); - - try { - AddAttendee addAttendee = new AddAttendee(signupMeetingService, currentUserId(), currentSiteId(), true); - meeting = addAttendee.signup(getMeetingWrapper().getMeeting(), timeslotWrapper.getTimeSlot(),timeslotWrapper.getNewAttendee()); - - if (sendEmail) { - try { - signupMeetingService.sendEmailToParticipantsByOrganizerAction(addAttendee.getSignupEventTrackingInfo()); - } catch (Exception e) { - logger.error(Utilities.rb.getString("email.exception") + " - " + e.getMessage(), e); - } - } - } catch (SignupUserActionException ue) { - Utilities.addErrorMessage(ue.getMessage()); - logger.error(ue.getMessage()); - errors = true; - break; - - } catch (Exception e) { - logger.error(Utilities.rb.getString("error.occurred_try_again") + " - " + e.getMessage(), e); - errors = true; - break; - } - } - - if(errors) { - Utilities.addErrorMessage(Utilities.rb.getString("error.occurred_try_again")); - return ORGANIZER_MEETING_PAGE_URL; - } - - String nextPage = updateMeetingwrapper(meeting, ORGANIZER_MEETING_PAGE_URL); - - if (ORGANIZER_MEETING_PAGE_URL.equals(nextPage)) { - setAddNewAttendee(false); - setSelectedTimeslotId(null); - - Utilities.addInfoMessage(Utilities.rb.getString("group_synchronise_done")); - } - return nextPage; - } - - /** - * Helper to check if we need to show the email link - * If we have email addresses, then the link shows up. - * @return true/false - */ - public boolean isShowEmailAllAttendeesLink() { - return StringUtils.isNotBlank(getAllAttendeesEmailAddressesFormatted()); - } - - /** - * Helper to get the email address for the current user - * @return - */ - public String getCurrentUserEmailAddress() { - return sakaiFacade.getUser(sakaiFacade.getCurrentUserId()).getEmail(); - } -} +/* +* Licensed to The Apereo Foundation under one or more contributor license +* agreements. See the NOTICE file distributed with this work for +* additional information regarding copyright ownership. +* +* The Apereo Foundation licenses this file to you 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: +* +* http://opensource.org/licenses/ecl2.txt +* +* 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.sakaiproject.signup.tool.jsf.organizer; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.List; + +import javax.faces.component.UIData; +import javax.faces.component.UIInput; +import javax.faces.event.ActionEvent; +import javax.faces.model.SelectItem; +import javax.faces.model.SelectItemGroup; + +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sakaiproject.exception.IdUnusedException; +import org.sakaiproject.signup.logic.SignupUser; +import org.sakaiproject.signup.logic.SignupUserActionException; +import org.sakaiproject.signup.logic.messages.SignupEventTrackingInfo; +import org.sakaiproject.signup.model.SignupAttendee; +import org.sakaiproject.signup.model.SignupMeeting; +import org.sakaiproject.signup.model.SignupSite; +import org.sakaiproject.signup.tool.jsf.AttendeeWrapper; +import org.sakaiproject.signup.tool.jsf.SignupMeetingWrapper; +import org.sakaiproject.signup.tool.jsf.SignupUIBaseBean; +import org.sakaiproject.signup.tool.jsf.TimeslotWrapper; +import org.sakaiproject.signup.tool.jsf.attendee.EditCommentSignupMBean; +import org.sakaiproject.signup.tool.jsf.organizer.action.AddAttendee; +import org.sakaiproject.signup.tool.jsf.organizer.action.AddWaiter; +import org.sakaiproject.signup.tool.jsf.organizer.action.CancelAttendee; +import org.sakaiproject.signup.tool.jsf.organizer.action.CancelRestoreTimeslot; +import org.sakaiproject.signup.tool.jsf.organizer.action.LockUnlockTimeslot; +import org.sakaiproject.signup.tool.jsf.organizer.action.MoveAttendee; +import org.sakaiproject.signup.tool.jsf.organizer.action.RemoveWaiter; +import org.sakaiproject.signup.tool.jsf.organizer.action.ReplaceAttendee; +import org.sakaiproject.signup.tool.jsf.organizer.action.SwapAttendee; +import org.sakaiproject.signup.tool.util.Utilities; +import org.sakaiproject.site.api.Site; +import org.sakaiproject.user.api.UserNotDefinedException; + +/** + * <p> + * This JSF UIBean class will handle information exchanges between Organizer's + * event/meeting view page:<b>orgSignupMeeting.jsp</b> and backbone system. It + * provides all the necessary business logic + * + * @author Peter Liu + * + * </P> + */ +public class OrganizerSignupMBean extends SignupUIBaseBean { + + private UIData timeslotWrapperTable; + + private UIInput attendeeTimeSlotWithId; + + private UIInput replacedAttendeeEidOrEmail; + + /* proxy param for eid by user input */ + private String eidOrEmailByUser; + + private UIInput waiterEidOrEmail; + + private UIData attendeeWrapperTable; + + private UIData waiterWrapperTable; + + private List<SelectItem> allAttendees; + + private List<SignupUser> allSignupUsers; + + public static final String DELIMITER = "::"; + + private String selectedAction = REPLACE_ACTION; + + private String selectedEditTimeslotId; + + private UIInput selectedTimeslotId; + + private Logger logger = LoggerFactory.getLogger(OrganizerSignupMBean.class); + + private boolean addNewAttendee; + + private UIInput addNewAttendeeUserEidOrEmail; + + private UIInput listPendingType; + + private String userActionType = REPLACE_ACTION; + + private String selectedFirstUser = "gl256"; + + private String currentUserId; + + private String currentSiteId; + + private CopyMeetingSignupMBean copyMeetingMBean; + + private EditMeetingSignupMBean editMeetingMBean; + + private EditCommentSignupMBean editCommentMBean; + + private CancelRestoreTimeslot cancelRestoreTimeslot; + + private boolean collapsedMeetingInfo; + + private boolean eidInputMode = false; + public String timeslottoGroup; + + /** + * This will initialize all the wrapper objects such as + * SignupMeetingWrapper, SignupTimeslotWrapper etc. + * + * @param meetingWrapper + * a SignupMeetingWrapper object. + */ + public void init(SignupMeetingWrapper meetingWrapper) throws Exception { + this.eidInputMode = false; + this.collapsedMeetingInfo = false; + reset(meetingWrapper); + loadAllAttendees(meetingWrapper.getMeeting()); + } + + /** + * This will basically update the Timeslot wrappers after event/meeting is + * updated + * + * @param meetingWrapper + * a SignupMeetingWrapper object. + */ + public void reset(SignupMeetingWrapper meetingWrapper) { + setMeetingWrapper(meetingWrapper); + updateTimeSlotWrappers(meetingWrapper); + setEidInputMode(meetingWrapper.getMeeting().isEidInputMode()); + if(!isEidInputMode() && (getAllAttendees()==null || getAllAttendees().isEmpty())){ + loadAllAttendees(meetingWrapper.getMeeting()); + } + + //reset email checkBox value setting + this.sendEmail = meetingWrapper.getMeeting().isSendEmailByOwner(); + + } + + /** + * This is a JSF action call method by UI to modify the event/meeting. + * + * @return an action outcome string. + */ + public String modifyMeeting() { + /* get latest copy of meeting */ + SignupMeeting meeting = null; + String goMainPageDueToError = updateMeetingwrapper(meeting, ORGANIZER_MEETING_PAGE_URL); + if (goMainPageDueToError.equals(MAIN_EVENTS_LIST_PAGE_URL)) + return goMainPageDueToError; + + editMeetingMBean.setMeetingWrapper(getMeetingWrapper()); + editMeetingMBean.reset(); + + return MODIFY_MEETING_PAGE_URL; + } + + /** + * This is a JSF action call method by UI to copy the event/meeting. + * + * @return an action outcome string. + */ + public String copyMeeting() { + copyMeetingMBean.setMeetingWrapper(getMeetingWrapper()); + copyMeetingMBean.reset(); + return COPTY_MEETING_PAGE_URL; + } + + /** + * This is a JSF action call method by UI to lock/unlock time slot of the + * event/meeting. + * + * @return an action outcome string. + */ + public String processLockTsAction() { + SignupMeeting meeting = null; + try { + TimeslotWrapper timeslotWrapper = (TimeslotWrapper) timeslotWrapperTable.getRowData(); + LockUnlockTimeslot lockTimeslot = new LockUnlockTimeslot(getMeetingWrapper().getMeeting(), timeslotWrapper + .getTimeSlot(), currentUserId(), currentSiteId(), signupMeetingService); + meeting = lockTimeslot.lockOrUnlock(); + } catch (SignupUserActionException ue) { + Utilities.addErrorMessage(ue.getMessage()); + } catch (Exception e) { + logger.error(Utilities.rb.getString("error.occurred_try_again") + " - " + e.getMessage()); + Utilities.addErrorMessage(Utilities.rb.getString("error.occurred_try_again")); + } + + return updateMeetingwrapper(meeting, ORGANIZER_MEETING_PAGE_URL); + } + + /** + * This is a JSF action call method by UI to go to Cancel confirmation page. + * + * @return an action outcome string. + */ + public String initiateCancelTimeslot() { + TimeslotWrapper timeslotWrapper = (TimeslotWrapper) timeslotWrapperTable.getRowData(); + cancelRestoreTimeslot = new CancelRestoreTimeslot(getMeetingWrapper().getMeeting(), timeslotWrapper + .getTimeSlot(), currentUserId(), currentSiteId(), signupMeetingService); + return cancelRestoreTimeslot(); + } + + /** + * This is a JSF action call method by UI to restore time slot of the + * event/meeting. + * + * @return an action outcome string + */ + public String restoreTimeslot() { + TimeslotWrapper timeslotWrapper = (TimeslotWrapper) timeslotWrapperTable.getRowData(); + cancelRestoreTimeslot = new CancelRestoreTimeslot(getMeetingWrapper().getMeeting(), timeslotWrapper + .getTimeSlot(), currentUserId(), currentSiteId(), signupMeetingService); + return cancelRestoreTimeslot(); + } + + /** + * This is a JSF action call method by UI to cancel time slot of the + * event/meeting. + * + * @return an action outcome string + */ + public String cancelTimeslot() { + return cancelRestoreTimeslot(); + } + + /** + * This is a JSF action call method by UI to view a specific attendee's + * comment of the event/meeting. + * + * @return an action outcome string. + */ + public String viewAttendeeComment() { + String attUserId = (String) Utilities.getRequestParam("attendeeUserId"); + String timeslotId = (String) Utilities.getRequestParam("timeslotId"); + if (attUserId == null || timeslotId == null) + return ""; + + AttendeeWrapper attWrp = findAttendee(timeslotId, attUserId); + if (attWrp == null) + return ""; + + this.editCommentMBean.init(attWrp, this.getAttendeeRole(attUserId), getMeetingWrapper(), timeslotId); + return VIEW_COMMENT_PAGE_URL; + } + + /** + * find an attendee in a specific time slot + * @param timeslotId + * @param userId + * @return + */ + private AttendeeWrapper findAttendee(String timeslotId, String userId) { + if (getTimeslotWrappers() == null || getTimeslotWrappers().isEmpty()) + return null; + + String timeslotPeriod = null; + for (TimeslotWrapper wrapper : getTimeslotWrappers()) { + if (wrapper.getTimeSlot().getId().toString().equals(timeslotId)) { + timeslotPeriod = getSakaiFacade().getTimeService().newTime( + wrapper.getTimeSlot().getStartTime().getTime()).toStringLocalTime() + + " - " + + getSakaiFacade().getTimeService().newTime(wrapper.getTimeSlot().getEndTime().getTime()) + .toStringLocalTime(); + List<AttendeeWrapper> attWrp = wrapper.getAttendeeWrappers(); + for (AttendeeWrapper att : attWrp) { + if (att.getSignupAttendee().getAttendeeUserId().equals(userId)) { + att.setTimeslotPeriod(timeslotPeriod); + return att; + } + } + break; + } + } + return null; + } + + private String getAttendeeRole(String attendeeUserId) { + SignupUser sUser = getSakaiFacade().getSignupUser(getMeetingWrapper().getMeeting(), attendeeUserId); + if (sUser == null) + return "unknown"; + else + return sUser.getUserRole().getId(); + } + + private String cancelRestoreTimeslot() { + if (cancelRestoreTimeslot == null) + return ORGANIZER_MEETING_PAGE_URL; + + SignupMeeting meeting = null; + try { + meeting = cancelRestoreTimeslot.cancelOrRestore(); + if (sendEmail) { + try { + signupMeetingService.sendEmailToParticipantsByOrganizerAction(cancelRestoreTimeslot + .getSignupEventTrackingInfo()); + } catch (Exception e) { + logger.error(Utilities.rb.getString("email.exception") + " - " + e.getMessage(), e); + Utilities.addErrorMessage(Utilities.rb.getString("email.exception")); + } + } + } catch (Exception e) { + logger.error(Utilities.rb.getString("error.occurred_try_again") + " - " + e.getMessage()); + Utilities.addErrorMessage(Utilities.rb.getString("error.occurred_try_again")); + } + + return updateMeetingwrapper(meeting, ORGANIZER_MEETING_PAGE_URL); + } + + /** + * This is a JSF action call method by UI to edit the attendee in the + * event/meeting. + * + * @return an action outcome string. + */ + public String editTimeslotAttendee() { + SignupMeeting meeting = null; + try { + SignupEventTrackingInfo signupEventTrackingInfo = null; + if (this.userActionType.equals(MOVE_ACTION)) { // old:selectedAction + signupEventTrackingInfo = moveAttendee(); + } + if (this.userActionType.equals(REPLACE_ACTION)) { + try { + signupEventTrackingInfo = replaceAttendee(); + } catch (UserNotDefinedException e) { + logger.warn(Utilities.rb.getString("exception.no.such.user") + + (String) replacedAttendeeEidOrEmail.getValue() + " -- " + e.getMessage()); + Utilities.addErrorMessage(Utilities.rb.getString("exception.no.such.user") + + (String) replacedAttendeeEidOrEmail.getValue()); + return ""; + } + } + + if (this.userActionType.equals(SWAP_ACTION)) { + signupEventTrackingInfo = swapAttendees(); + } + + if (sendEmail) { + try { + signupMeetingService.sendEmailToParticipantsByOrganizerAction(signupEventTrackingInfo); + } catch (Exception e) { + logger.error(Utilities.rb.getString("email.exception") + " - " + e.getMessage(), e); + Utilities.addErrorMessage(Utilities.rb.getString("email.exception")); + } + } + + } catch (SignupUserActionException ue) { + Utilities.addErrorMessage(ue.getMessage()); + + } catch (Exception e) { + logger.error(Utilities.rb.getString("error.occurred_try_again") + " - " + e.getMessage()); + Utilities.addErrorMessage(Utilities.rb.getString("error.occurred_try_again")); + } + + /* reset */ + setSelectedAction(REPLACE_ACTION); + + /* + * refresh meeting list to catch the changes when go back the main + * meetings list page + */ + if (Utilities.getSignupMeetingsBean().isShowMyAppointmentTime()) + Utilities.resetMeetingList(); + + return updateMeetingwrapper(meeting, ORGANIZER_MEETING_PAGE_URL); + } + + /* The logic below assumes an attendee appears only once in a timeslot */ + private SignupEventTrackingInfo swapAttendees() throws Exception { + SwapAttendee swapAttendee = new SwapAttendee(currentUserId(), currentSiteId(), signupMeetingService); + TimeslotWrapper currentTimeslotWrapper = (TimeslotWrapper) timeslotWrapperTable.getRowData(); + + swapAttendee.swapAttendee(getMeetingWrapper().getMeeting(), currentTimeslotWrapper.getTimeSlot(), + this.selectedFirstUser, (String) attendeeTimeSlotWithId.getValue()); + + return swapAttendee.getSignupEventTrackingInfo(); + } + + private SignupEventTrackingInfo replaceAttendee() throws Exception { + String userEidOrEmail = null; + if (isEidInputMode()) { + userEidOrEmail = getEidOrEmailInputByUser(); + } else { + userEidOrEmail = (String) replacedAttendeeEidOrEmail.getValue(); + } + + //check if there are multiple email addresses associated with input + List<String> associatedEids = getEidsForEmail(userEidOrEmail.trim()); + if(associatedEids.size() > 1) { + throw new SignupUserActionException(MessageFormat.format(Utilities.rb.getString("exception.multiple.eids"), new Object[] {userEidOrEmail, StringUtils.join(associatedEids, ", ")})); + } + + String replacerUserId = getUserIdForEidOrEmail(userEidOrEmail); + SignupUser replSignUser = getSakaiFacade().getSignupUser(getMeetingWrapper().getMeeting(), replacerUserId); + if(replSignUser ==null){ + throw new SignupUserActionException(MessageFormat.format(Utilities.rb.getString("user.has.no.permission.attend"), new Object[] {userEidOrEmail})); + } + + TimeslotWrapper wrapper = (TimeslotWrapper) timeslotWrapperTable.getRowData(); + + ReplaceAttendee replaceAttendee = new ReplaceAttendee(this.currentUserId(), this.currentSiteId(), + signupMeetingService); + replaceAttendee.replace(getMeetingWrapper().getMeeting(), wrapper.getTimeSlot(), this.selectedFirstUser, + replacerUserId, replSignUser.getMainSiteId()); + + return replaceAttendee.getSignupEventTrackingInfo(); + } + + private SignupEventTrackingInfo moveAttendee() throws Exception { + TimeslotWrapper wrapper = (TimeslotWrapper) timeslotWrapperTable.getRowData(); + + MoveAttendee moveAttendee = new MoveAttendee(this.currentUserId(), this.currentSiteId(), signupMeetingService); + moveAttendee.move(getMeetingWrapper().getMeeting(), wrapper.getTimeSlot(), this.selectedFirstUser, + (String) selectedTimeslotId.getValue()); + + return moveAttendee.getSignupEventTrackingInfo(); + + } + + /** + * This will load all the potential participants for an event/meeting and + * wrap it for UI purpose. Due to efficiency issue, it will auto rolled back + * to Eid-Input mode when the number of users are bigger thank 600 ( defined + * by <I>MAX_NUM_ATTENDEES_ALLOWED_BEFORE_AUTO_SWITCH_TO_EID_INPUT_MODE</I>} + * value). + * + * @param meeting + * a SignupMeeting object. + */ + public void loadAllAttendees(SignupMeeting meeting) { + if(meeting.isEidInputMode()){ + setEidInputMode(true); + return; + } + + + try { + Site site = getSakaiFacade().getSiteService().getSite(getSakaiFacade().getCurrentLocationId()); + if(site !=null){ + int allMemeberSize = site.getMembers()!=null? site.getMembers().size() : 0; + /* + * due to efficiency, user has to input EID instead of using dropdown + * user name list + */ + /*First check to avoid load all site member up if there is ten of thousends*/ + if(allMemeberSize > MAX_NUM_PARTICIPANTS_FOR_DROPDOWN_BEFORE_AUTO_SWITCH_TO_EID_INPUT_MODE){ + setEidInputMode(true); + return; + } + } + } catch (IdUnusedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + this.allSignupUsers = sakaiFacade.getAllPossibleAttendees(meeting); + /* + * due to efficiency, user has to input EID instead of using dropdown + * user name list + */ + if (allSignupUsers != null + && allSignupUsers.size() > MAX_NUM_PARTICIPANTS_FOR_DROPDOWN_BEFORE_AUTO_SWITCH_TO_EID_INPUT_MODE) { + setEidInputMode(true); + return; + } + + setEidInputMode(false); + allAttendees = new ArrayList<SelectItem>(); + String previous_displayName =""; + int index = 0; + for (SignupUser user : allSignupUsers) { + if(user.getDisplayName().equals(previous_displayName)){ + allAttendees.add(new SelectItem(user.getEid(), user.getDisplayName()+ "(" + user.getEid() +")")); + SelectItem prev_sItem = allAttendees.get(index-1); + //checking: not already has eid for triple duplicates case + if(!prev_sItem.getLabel().contains("(")){ + prev_sItem.setLabel(prev_sItem.getLabel() + " (" + prev_sItem.getValue() +")"); + } + + }else { + allAttendees.add(new SelectItem(user.getEid(), user.getDisplayName())); + } + + previous_displayName = user.getDisplayName(); + index++; + } + } + + /* This one overwrites the parent one due to two more stuffs to create */ + protected void updateTimeSlotWrappers(SignupMeetingWrapper meetingWrapper) { + super.updateTimeSlotWrappers(meetingWrapper); + /* for organizer UI swap-dropdown list */ + createUISwapListForEachTimeSlot(getTimeslotWrappers()); + createMoveAvailabelTimeSlots(getTimeslotWrappers()); + + } + + /* create the avaiable timeslot for UI purpose */ + private void createMoveAvailabelTimeSlots(List<TimeslotWrapper> timeslotWrapperList) { + + List<SelectItem> list = new ArrayList<SelectItem>(); + for (TimeslotWrapper wrapper : timeslotWrapperList) { + list.add(new SelectItem(wrapper.getTimeSlot().getId().toString(), wrapper.getLabel())); + } + + /* + * list of avalilable timeslot for move excluding the current timeslot + */ + for (int i = 0; i < list.size(); i++) { + List<SelectItem> moveAvailableTimeSlots = new ArrayList<SelectItem>(list); + moveAvailableTimeSlots.remove(i);// remove the current one + + TimeslotWrapper wrapper = timeslotWrapperList.get(i); + wrapper.setMoveAvailableTimeSlots(moveAvailableTimeSlots); + } + } + + /* create possible swap dropdown choices for UI purpose */ + private void createUISwapListForEachTimeSlot(List<TimeslotWrapper> timeslotWrapperList) { + List<SelectItem> tsAttendeeGroups = new ArrayList<SelectItem>(); + for (TimeslotWrapper wrapper : timeslotWrapperList) { + String grpLabel = wrapper.getLabel(); + List<SelectItem> attendeeOnTS = new ArrayList<SelectItem>(); + + //clean the list of attendees + List<SignupAttendee> attendees = getValidAttendees(wrapper.getTimeSlot().getAttendees()); + + if (attendees != null && !attendees.isEmpty()) { + for (SignupAttendee att : attendees) { + SelectItem sItem = new SelectItem(wrapper.getTimeSlot().getId() + DELIMITER + att.getAttendeeUserId(), sakaiFacade.getUserDisplayName(att.getAttendeeUserId())); + attendeeOnTS.add(sItem); + } + } + + SelectItemGroup sigrp = new SelectItemGroup(grpLabel, "Timeslot Name", false, (SelectItem[]) attendeeOnTS + .toArray(new SelectItem[0])); + tsAttendeeGroups.add(sigrp); + } + + /* + * list of avalilable timeslot for swap excluding the current timeslot + */ + for (int i = 0; i < tsAttendeeGroups.size(); i++) { + List<SelectItem> swapAvailableTimeSlots = new ArrayList<SelectItem>(tsAttendeeGroups); + swapAvailableTimeSlots.remove(i);// remove the current one + + TimeslotWrapper wrapper = timeslotWrapperList.get(i); + wrapper.setSwapDropDownList(swapAvailableTimeSlots); + } + } + + public UIData getTimeslotWrapperTable() { + return timeslotWrapperTable; + } + + public void setTimeslotWrapperTable(UIData timeslotWrapperTable) { + this.timeslotWrapperTable = timeslotWrapperTable; + } + + public UIInput getAttendeeTimeSlotWithId() { + return attendeeTimeSlotWithId; + } + + public void setAttendeeTimeSlotWithId(UIInput attendeeEid) { + this.attendeeTimeSlotWithId = attendeeEid; + } + + public UIInput getWaiterEidOrEmail() { + return waiterEidOrEmail; + } + + public void setWaiterEidOrEmail(UIInput waiterEidOrEmail) { + this.waiterEidOrEmail = waiterEidOrEmail; + } + + public String prepareAddAttendee() { + setAddNewAttendee(true); + setSelectedEditTimeslotId(null); + return ORGANIZER_MEETING_PAGE_URL; + } + + /** + * This is a JSF action call method by UI to add a new attendee into the + * event/meeting. + * + * @return an action outcome string. + */ + public String addAttendee() { + TimeslotWrapper timeslotWrapper = (TimeslotWrapper) timeslotWrapperTable.getRowData(); + + String newAttendeeEidOrEmail = null; + if (isEidInputMode()) { + newAttendeeEidOrEmail = getEidOrEmailInputByUser(); + } else { + if (addNewAttendeeUserEidOrEmail != null && ((String) addNewAttendeeUserEidOrEmail.getValue()).trim().length() > 0) { + newAttendeeEidOrEmail = ((String) addNewAttendeeUserEidOrEmail.getValue()).trim(); + } + } + + if (StringUtils.isBlank(newAttendeeEidOrEmail)) { + return ORGANIZER_MEETING_PAGE_URL; + } + + //check if there are multiple email addresses associated with input + List<String> associatedEids = getEidsForEmail(newAttendeeEidOrEmail.trim()); + if(associatedEids.size() > 1) { + Utilities.addErrorMessage(MessageFormat.format(Utilities.rb.getString("exception.multiple.eids"), new Object[] {newAttendeeEidOrEmail, StringUtils.join(associatedEids, ", ")})); + return ORGANIZER_MEETING_PAGE_URL; + } + + String newUserId = getUserIdForEidOrEmail(newAttendeeEidOrEmail.trim()); + if(StringUtils.isBlank(newUserId)){ + Utilities.addErrorMessage(Utilities.rb.getString("exception.no.such.user") + newAttendeeEidOrEmail); + return ORGANIZER_MEETING_PAGE_URL; + } + + SignupUser newAttendeeSignUser = getSakaiFacade().getSignupUser(getMeetingWrapper().getMeeting(), newUserId); + if(newAttendeeSignUser ==null){ + Utilities.addErrorMessage(MessageFormat.format(Utilities.rb.getString("user.has.no.permission.attend"), new Object[] {newAttendeeEidOrEmail})); + return ORGANIZER_MEETING_PAGE_URL; + } + + SignupAttendee newAttendee = new SignupAttendee(newUserId, newAttendeeSignUser.getMainSiteId()); + timeslotWrapper.setNewAttendee(newAttendee); + + SignupMeeting meeting = null; + try { + AddAttendee addAttendee = new AddAttendee(signupMeetingService, currentUserId(), currentSiteId(), true); + meeting = addAttendee.signup(getMeetingWrapper().getMeeting(), timeslotWrapper.getTimeSlot(), + timeslotWrapper.getNewAttendee()); + + /*TODO : we may need to re-think adding this sendAtteneeEmail condition here. We want that the Organizer will be enable to control + * the email notification via that checkBox on 'Organizer Meeting' page. + * */ + boolean sendAttendeeEmail = false;//Utilities.getSignupConfigParamVal("signup.email.notification.attendee.signed.up", true); + + if (sendEmail || sendAttendeeEmail) { + try { + signupMeetingService.sendEmailToParticipantsByOrganizerAction(addAttendee + .getSignupEventTrackingInfo()); + } catch (Exception e) { + logger.error(Utilities.rb.getString("email.exception") + " - " + e.getMessage(), e); + Utilities.addErrorMessage(Utilities.rb.getString("email.exception")); + } + } + } catch (SignupUserActionException ue) { + Utilities.addErrorMessage(ue.getMessage()); + + } catch (Exception e) { + logger.error(Utilities.rb.getString("error.occurred_try_again") + " - " + e.getMessage()); + Utilities.addErrorMessage(Utilities.rb.getString("error.occurred_try_again")); + } + + String nextPage = updateMeetingwrapper(meeting, ORGANIZER_MEETING_PAGE_URL); + // TODO calendar event id; + + if (ORGANIZER_MEETING_PAGE_URL.equals(nextPage)) { + setAddNewAttendee(false); + setSelectedTimeslotId(null); + } + return nextPage; + } + + /** + * This is a JSF action call method by UI to reset user input. + * + * @return an action outcome string. + */ + public String cancelAddAttendee() { + setAddNewAttendee(false); + setAddNewAttendeeUserEidOrEmail(null); + + return ORGANIZER_MEETING_PAGE_URL; + } + + /** + * This is a JSF action call method by UI to remove an attendee from the + * event/meeting. + * + * @return an action outcome string. + */ + public String removeAttendee() { + SignupMeeting meeting = null; + TimeslotWrapper timeslotWrapper = (TimeslotWrapper) timeslotWrapperTable.getRowData(); + String removedUserId = (String) Utilities.getRequestParam(ATTENDEE_USER_ID); + try { + CancelAttendee remove = new CancelAttendee(signupMeetingService, currentUserId(), currentSiteId(), true); + SignupAttendee removedAttendee = new SignupAttendee(removedUserId, currentSiteId()); + meeting = remove.cancelSignup(getMeetingWrapper().getMeeting(), timeslotWrapper.getTimeSlot(), + removedAttendee); + + if (sendEmail) { + try { + signupMeetingService.sendEmailToParticipantsByOrganizerAction(remove.getSignupEventTrackingInfo()); + } catch (Exception e) { + logger.error(Utilities.rb.getString("email.exception") + " - " + e.getMessage(), e); + Utilities.addErrorMessage(Utilities.rb.getString("email.exception")); + } + } + } catch (SignupUserActionException ue) { + Utilities.addErrorMessage(ue.getMessage()); + } catch (Exception e) { + logger.error(Utilities.rb.getString("error.occurred_try_again") + " - " + e.getMessage()); + Utilities.addErrorMessage(Utilities.rb.getString("error.occurred_try_again")); + } + + /* + * refresh meeting list to catch the changes when go back the main + * meeting list page + */ + if (Utilities.getSignupMeetingsBean().isShowMyAppointmentTime()) + Utilities.resetMeetingList(); + + return updateMeetingwrapper(meeting, ORGANIZER_MEETING_PAGE_URL); + } + + /** + * This is a JSF action call method by UI to add the attendee to a waiting + * list in the event/meeting. + * + * @return an action outcome string. + */ + public String addAttendeeToWList() { + TimeslotWrapper timeslotWrapper = (TimeslotWrapper) timeslotWrapperTable.getRowData(); + + String newWaiterEidOrEmail = null; + if (isEidInputMode()) { + newWaiterEidOrEmail = getEidOrEmailInputByUser(); + } else { + if (waiterEidOrEmail != null && ((String) waiterEidOrEmail.getValue()).trim().length() > 0) + newWaiterEidOrEmail = ((String) waiterEidOrEmail.getValue()).trim(); + } + + if (StringUtils.isBlank(newWaiterEidOrEmail)) { + return ORGANIZER_MEETING_PAGE_URL; + } + + //check if there are multiple email addresses associated with input + List<String> associatedEids = getEidsForEmail(newWaiterEidOrEmail.trim()); + if(associatedEids.size() > 1) { + Utilities.addErrorMessage(MessageFormat.format(Utilities.rb.getString("exception.multiple.eids"), new Object[] {newWaiterEidOrEmail, StringUtils.join(associatedEids, ", ")})); + return ORGANIZER_MEETING_PAGE_URL; + } + + String waiterUserId = getUserIdForEidOrEmail(newWaiterEidOrEmail.trim()); + if(StringUtils.isBlank(waiterUserId)){ + Utilities.addErrorMessage(Utilities.rb.getString("exception.no.such.user") + newWaiterEidOrEmail); + return ORGANIZER_MEETING_PAGE_URL; + } + + SignupUser waiterSignUser = getSakaiFacade().getSignupUser(getMeetingWrapper().getMeeting(), waiterUserId); + if(waiterSignUser ==null){ + Utilities.addErrorMessage(MessageFormat.format(Utilities.rb.getString("user.has.no.permission.attend"), new Object[] {newWaiterEidOrEmail})); + return ORGANIZER_MEETING_PAGE_URL; + } + + SignupAttendee newWaiter = new SignupAttendee(waiterUserId, waiterSignUser.getMainSiteId()); + SignupMeeting meeting = null; + try { + AddWaiter addWaiter = new AddWaiter(signupMeetingService, currentUserId(), currentSiteId(), + getListOperationType(), true); + meeting = addWaiter.addToWaitingList(getMeetingWrapper().getMeeting(), timeslotWrapper.getTimeSlot(), + newWaiter); + /* reset */ + resetWaitingListPendingType(); + } catch (SignupUserActionException ue) { + Utilities.addErrorMessage(ue.getMessage()); + } catch (Exception e) { + logger.error(Utilities.rb.getString("error.occurred_try_again") + " - " + e.getMessage()); + Utilities.addErrorMessage(Utilities.rb.getString("error.occurred_try_again")); + } + + // TODO calendar event id; + + return updateMeetingwrapper(meeting, ORGANIZER_MEETING_PAGE_URL); + } + + private void resetWaitingListPendingType() { + setListPendingType(null); + } + + /** + * This is a JSF action call method by UI to remove the attendee from the + * waiting list in the event/meeting. + * + * @return an action outcome string. + */ + public String removeAttendeeFromWList() { + TimeslotWrapper timeslotWrapper = (TimeslotWrapper) timeslotWrapperTable.getRowData(); + String removedUserId = (String) Utilities.getRequestParam(ATTENDEE_USER_ID); + + if (StringUtils.isBlank(removedUserId)) { + return ORGANIZER_MEETING_PAGE_URL; + } + SignupAttendee removedWaiter = new SignupAttendee(removedUserId, currentSiteId()); + SignupMeeting meeting = null; + + try { + RemoveWaiter removeWaiter = new RemoveWaiter(signupMeetingService, currentUserId(), currentSiteId(), + getListOperationType(), true); + meeting = removeWaiter.removeFromWaitingList(getMeetingWrapper().getMeeting(), timeslotWrapper + .getTimeSlot(), removedWaiter); + } catch (SignupUserActionException ue) { + Utilities.addErrorMessage(ue.getMessage()); + } catch (Exception e) { + logger.error(Utilities.rb.getString("error.occurred_try_again") + " - " + e.getMessage()); + Utilities.addErrorMessage(Utilities.rb.getString("error.occurred_try_again")); + } + + return updateMeetingwrapper(meeting, ORGANIZER_MEETING_PAGE_URL); + } + + /** + * This is a JSF getter method to get the selected attendee. + * + * @return an UIData object. + */ + public UIData getAttendeeWrapperTable() { + return attendeeWrapperTable; + } + + /** + * This is a setter. + * + * @param attendeeWrapperTable + * an UIData object, which is selected by user. + */ + public void setAttendeeWrapperTable(UIData attendeeWrapperTable) { + this.attendeeWrapperTable = attendeeWrapperTable; + } + + /** + * This is a getter method for UI. + * + * @return an UIData object. + */ + public UIData getWaiterWrapperTable() { + return waiterWrapperTable; + } + + /** + * This is a setter for UI. + * + * @param waiterWrapperTable + * an UIData object. + */ + public void setWaiterWrapperTable(UIData waiterWrapperTable) { + this.waiterWrapperTable = waiterWrapperTable; + } + + /** + * This is getter for UI. + * + * @return a list of SelectItem objects. + */ + public List<SelectItem> getAllAttendees() { + return allAttendees; + } + + /** + * This is a setter. + * + * @param allAttendees + */ + public void setAllAttendees(List<SelectItem> allAttendees) { + this.allAttendees = allAttendees; + } + + /** + * This is a getter for UI. + * + * @return a constant string. + */ + public String getAttendeeUserId() { + return ATTENDEE_USER_ID; + } + + /** + * This is a getter method for UI. + * + * @return a string value. + */ + public String getSelectedEditTimeslotId() { + return selectedEditTimeslotId; + } + + /** + * This is a setter. + * + * @param selectedEditTimeslotId + * a time slot Id string. + */ + public void setSelectedEditTimeslotId(String selectedEditTimeslotId) { + this.selectedEditTimeslotId = selectedEditTimeslotId; + } + + /** + * This is a getter for UI. + * + * @return a constant string. + */ + public String getMoveAction() { + return MOVE_ACTION; + } + + /** + * This is a getter for UI. + * + * @return a constant string + */ + public String getReplaceAction() { + return REPLACE_ACTION; + } + + /** + * This is a getter for UI. + * + * @return a constant string. + */ + public String getSwapAction() { + return SWAP_ACTION; + } + + /** + * This is a getter for UI. + * + * @return a constant string. + */ + public String getOnTopList() { + return ON_TOP_LIST; + } + + /** + * This is a getter for UI. + * + * @return a constant string. + */ + public String getOnBottomList() { + return ON_BOTTOM_LIST; + } + + /** + * This is a getter. + * + * @return a selected action string. + */ + public String getSelectedAction() { + return selectedAction; + } + + /** + * This is a setter. + * + * @param selectedAction + * a string value. + */ + public void setSelectedAction(String selectedAction) { + this.selectedAction = selectedAction; + } + + /** + * This is a getter for UI. + * + * @return an UIInput object. + */ + public UIInput getReplacedAttendeeEidOrEmail() { + return replacedAttendeeEidOrEmail; + } + + /** + * This is a setter. + * + * @param replacedAttendeeEid + * an UIInput object. + */ + public void setReplacedAttendeeEidOrEmail(UIInput replacedAttendeeEidOrEmail) { + this.replacedAttendeeEidOrEmail = replacedAttendeeEidOrEmail; + } + + /** + * This is a getter. + * + * @return an UIInput object. + */ + public UIInput getSelectedTimeslotId() { + return selectedTimeslotId; + } + + /** + * This is a setter. + * + * @param selectedTimeslotId + * a time slot Id string. + */ + public void setSelectedTimeslotId(UIInput selectedTimeslotId) { + this.selectedTimeslotId = selectedTimeslotId; + } + + /** + * Check if the action is a add-new-attendee. + */ + public boolean isAddNewAttendee() { + return addNewAttendee; + } + + /** + * This is a setter. + * + * @param addNewAttendee + * a boolean value. + */ + public void setAddNewAttendee(boolean addNewAttendee) { + this.addNewAttendee = addNewAttendee; + } + + /** + * This is a getter. + * + * @return am UIInput object. + */ + public UIInput getAddNewAttendeeUserEidOrEmail() { + return addNewAttendeeUserEidOrEmail; + } + + /** + * This is a setter. + * + * @param addNewAttendeeUserEidOrEmail + * an attendee's Eid or email string. + */ + public void setAddNewAttendeeUserEidOrEmail(UIInput addNewAttendeeUserEidOrEmail) { + this.addNewAttendeeUserEidOrEmail = addNewAttendeeUserEidOrEmail; + } + + /** + * This is a getter. + * + * @return a user-first selected attendee eid string. + */ + public String getSelectedFirstUser() { + return selectedFirstUser; + } + + /** + * This is a setter. + * + * @param selectedFirstUser + * an eid stirng. + */ + public void setSelectedFirstUser(String selectedFirstUser) { + this.selectedFirstUser = selectedFirstUser; + } + + /** + * This is a getter for UI. + * + * @return a action type string. + */ + public String getUserActionType() { + return userActionType; + } + + /** + * This is a setter. + * + * @param userActionType + * a action type string. + */ + public void setUserActionType(String userActionType) { + this.userActionType = userActionType; + } + + /** + * This is a getter, which tells how to pend an attendee into a waiting list + * (on top or on bottom). + * + * @return an UIInput object. + */ + public UIInput getListPendingType() { + return listPendingType; + } + + /** + * This is a setter. + * + * @param listPendingType + * a pending type string (on top or on bottom). + */ + public void setListPendingType(UIInput listPendingType) { + this.listPendingType = listPendingType; + } + + private String getListOperationType() { + if (this.listPendingType != null && this.listPendingType.getValue() != null + && ((String) this.listPendingType.getValue()).trim().length() > 0) + return ((String) this.listPendingType.getValue()).trim(); + + return ON_BOTTOM_LIST; + } + + private String currentUserId() { + if (this.currentUserId == null) + currentUserId = sakaiFacade.getCurrentUserId(); + + return currentUserId; + } + + private String currentSiteId() { + if (this.currentSiteId == null) + currentSiteId = sakaiFacade.getCurrentLocationId(); + + return currentSiteId; + } + + /** + * This is a getter method. + * + * @return a CopyMeetingSignupMBean object. + */ + public CopyMeetingSignupMBean getCopyMeetingMBean() { + return copyMeetingMBean; + } + + /** + * This is a setter. + * + * @param copyMeetingMBean + * a CopyMeetingSignupMBean object. + */ + public void setCopyMeetingMBean(CopyMeetingSignupMBean copyMeetingMBean) { + this.copyMeetingMBean = copyMeetingMBean; + } + + /** + * This is a getter method. + * + * @return an EditMeetingSignupMBean object. + */ + public EditMeetingSignupMBean getEditMeetingMBean() { + return editMeetingMBean; + } + + /** + * This is a setter. + * + * @param editMeetingMBean + * an EditMeetingSignupMBean object. + */ + public void setEditMeetingMBean(EditMeetingSignupMBean editMeetingMBean) { + this.editMeetingMBean = editMeetingMBean; + } + + /** + * This is a getter method. + * + * @return a EditCommentSignupMBean object. + */ + public EditCommentSignupMBean getEditCommentMBean() { + return editCommentMBean; + } + + /** + * This is a setter. + * + * @param editCommentMBean + * a EditCommentSignupMBean object. + */ + public void setEditCommentMBean(EditCommentSignupMBean editCommentMBean) { + this.editCommentMBean = editCommentMBean; + } + + /** + * Check if the user input mode is Eid mode or not. + * + * @return true if the user input mode is Eid mode + */ + public boolean isEidInputMode() { + return eidInputMode; + } + + /** + * This is a setter. + * + * @param eidInputMode + * a boolean value. + */ + public void setEidInputMode(boolean eidInputMode) { + this.eidInputMode = eidInputMode; + } + + /** + * This is for javascrip UI only. + * + * @return empty string. + */ + public String getUserInputEidOrEmail() { + return ""; + } + + /** + * This is a setter. + * + * @param value + * an user input eid or email address value . + */ + public void setUserInputEidOrEmail(String value) { + if (StringUtils.isNotBlank(value)) { + this.eidOrEmailByUser = value; + } + } + + /** + * It's a getter method for UI. + * + * @return a list of SignupSite objects. + */ + public List<SignupSite> getPublishedSignupSites() { + return getMeetingWrapper().getMeeting().getSignupSites(); + } + + /* proxy method */ + private String getEidOrEmailInputByUser() { + String value = this.eidOrEmailByUser; + this.eidOrEmailByUser = null;// reset for only use once + return value; + } + + /** + * It's a getter method for UI + * + * @return a boolean value + */ + public boolean isCollapsedMeetingInfo() { + return collapsedMeetingInfo; + } + + /** + * This is a setter method for UI. + * + * @param collapsedMeetingInfo + * a boolean value + */ + public void setCollapsedMeetingInfo(boolean collapsedMeetingInfo) { + this.collapsedMeetingInfo = collapsedMeetingInfo; + } + + /** + * This is to retrieve attr from UI Commandbutton + * + * @param timeslottoGroup + * a String value + */ + public void attrListener(ActionEvent event){ + + timeslottoGroup = (String) Utilities.getActionAttribute(event, "timeslottoGroup"); + + } + + /** + * It's a getter method for UI + * denotes the direction of the synchronize process + * @return a String value timeslottoGroup + */ + public String gettimeslottoGroup() { + return timeslottoGroup; + } + + /** + * This is a setter + * @return a String value + */ + public void setNickname(String timeslottoGroup) { + this.timeslottoGroup = timeslottoGroup; + } + + /** + * Synchronise the users in a timeslot with the users in a group. + * VT customized to allow the user choose the synchronize direction + + * @return url to the same page which will trigger a reload + */ + public String synchroniseGroupMembership() { + + TimeslotWrapper timeslotWrapper = (TimeslotWrapper) timeslotWrapperTable.getRowData(); + + //get groupId for timeslot + String groupId = timeslotWrapper.getGroupId(); + SignupMeeting meeting = null; + + if(StringUtils.isBlank(groupId)){ + //TODO. + //Create the group. Grab the list of attendees in the timeslot and add all at once. + //Will need to also save the groupId into the timeslot. + //For now, we just give a message. + + Utilities.addErrorMessage(Utilities.rb.getString("error.no_group_for_timeslot")); + return ORGANIZER_MEETING_PAGE_URL; + } else { + List<String> attendeeUserIds = convertAttendeeWrappersToUuids(timeslotWrapper.getAttendeeWrappers()); + + //process to synchronize the time slot attendees to group + + if(timeslottoGroup != null && !timeslottoGroup.trim().isEmpty() && !sakaiFacade.addUsersToGroup(attendeeUserIds, currentSiteId(), groupId, timeslottoGroup)) { + Utilities.addErrorMessage(Utilities.rb.getString("error.group_sync_failed")); + return ORGANIZER_MEETING_PAGE_URL; + } + + //retrieve all members in group + List<String> groupMembers = sakaiFacade.getGroupMembers(currentSiteId(), groupId); + + //process to synchronize from site group members to time slot + if (timeslottoGroup == null || timeslottoGroup.isEmpty()){ + + //1. first to keep the common members of timeslot and group + + List<String> commonmem = new ArrayList<String>(attendeeUserIds); + commonmem.retainAll(groupMembers); + + //2. only add the group members not existed in timeslot + groupMembers.removeAll(attendeeUserIds); + + //3. remove the time slot attendees that existed only in timeslot + try { + for (String mem: attendeeUserIds){ + if(!commonmem.contains(mem)){ + CancelAttendee remove = new CancelAttendee(signupMeetingService, currentUserId(), currentSiteId(), true); + SignupAttendee removedAttendee = new SignupAttendee(mem, currentSiteId()); + meeting = remove.cancelSignup(getMeetingWrapper().getMeeting(), timeslotWrapper.getTimeSlot(),removedAttendee); + if (sendEmail) { + try { + signupMeetingService.sendEmailToParticipantsByOrganizerAction(remove.getSignupEventTrackingInfo()); + } catch (Exception e) { + logger.error(Utilities.rb.getString("email.exception") + " - " + e.getMessage(), e); + Utilities.addErrorMessage(Utilities.rb.getString("email.exception")); + } + } + } + } + }catch (SignupUserActionException ue) { + Utilities.addErrorMessage(ue.getMessage()); + } catch (Exception e) { + logger.error(Utilities.rb.getString("error.occurred_try_again") + " - " + e.getMessage()); + Utilities.addErrorMessage(Utilities.rb.getString("error.occurred_try_again")); + } + } else{ + //remove all of the existing attendees from this list to remove duplicates + groupMembers.removeAll(attendeeUserIds); + } + + //add members and go to return page + return addAttendeesToTimeslot(currentSiteId(),timeslotWrapper, groupMembers); + } + } + + + /** + * Helper to add users to a timeslot and get the return URL + * @param userId + * @return + */ + private String addAttendeesToTimeslot(String siteId, TimeslotWrapper timeslotWrapper, List<String> userIds) { + + boolean errors = false; + SignupMeeting meeting = null; + + //foreach userId, add to timeslot + for(String userId: userIds) { + + SignupAttendee attendee = new SignupAttendee(userId, siteId); + timeslotWrapper.setNewAttendee(attendee); + + try { + AddAttendee addAttendee = new AddAttendee(signupMeetingService, currentUserId(), currentSiteId(), true); + meeting = addAttendee.signup(getMeetingWrapper().getMeeting(), timeslotWrapper.getTimeSlot(),timeslotWrapper.getNewAttendee()); + + if (sendEmail) { + try { + signupMeetingService.sendEmailToParticipantsByOrganizerAction(addAttendee.getSignupEventTrackingInfo()); + } catch (Exception e) { + logger.error(Utilities.rb.getString("email.exception") + " - " + e.getMessage(), e); + } + } + } catch (SignupUserActionException ue) { + Utilities.addErrorMessage(ue.getMessage()); + logger.error(ue.getMessage()); + errors = true; + break; + + } catch (Exception e) { + logger.error(Utilities.rb.getString("error.occurred_try_again") + " - " + e.getMessage(), e); + errors = true; + break; + } + } + + if(errors) { + Utilities.addErrorMessage(Utilities.rb.getString("error.occurred_try_again")); + return ORGANIZER_MEETING_PAGE_URL; + } + + String nextPage = updateMeetingwrapper(meeting, ORGANIZER_MEETING_PAGE_URL); + + if (ORGANIZER_MEETING_PAGE_URL.equals(nextPage)) { + setAddNewAttendee(false); + setSelectedTimeslotId(null); + + Utilities.addInfoMessage(Utilities.rb.getString("group_synchronise_done")); + } + return nextPage; + } + + /** + * Helper to check if we need to show the email link + * If we have email addresses, then the link shows up. + * @return true/false + */ + public boolean isShowEmailAllAttendeesLink() { + return StringUtils.isNotBlank(getAllAttendeesEmailAddressesFormatted()); + } + + /** + * Helper to get the email address for the current user + * @return + */ + public String getCurrentUserEmailAddress() { + return sakaiFacade.getUser(sakaiFacade.getCurrentUserId()).getEmail(); + } +} diff --git a/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/organizer/action/RemoveWaiter.java b/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/organizer/action/RemoveWaiter.java index bac9dfa1635b..1b3fa50aaced 100644 --- a/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/organizer/action/RemoveWaiter.java +++ b/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/organizer/action/RemoveWaiter.java @@ -1,175 +1,175 @@ -/* -* Licensed to The Apereo Foundation under one or more contributor license -* agreements. See the NOTICE file distributed with this work for -* additional information regarding copyright ownership. -* -* The Apereo Foundation licenses this file to you 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: -* -* http://opensource.org/licenses/ecl2.txt -* -* 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.sakaiproject.signup.tool.jsf.organizer.action; - -import java.util.Iterator; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.sakaiproject.exception.PermissionException; -import org.sakaiproject.signup.logic.SignupEventTypes; -import org.sakaiproject.signup.logic.SignupMeetingService; -import org.sakaiproject.signup.logic.SignupUserActionException; -import org.sakaiproject.signup.model.SignupAttendee; -import org.sakaiproject.signup.model.SignupMeeting; -import org.sakaiproject.signup.model.SignupTimeslot; -import org.sakaiproject.signup.tool.util.SignupBeanConstants; -import org.sakaiproject.signup.tool.util.Utilities; -import org.sakaiproject.signup.util.SignupDateFormat; -import org.sakaiproject.tool.cover.ToolManager; -import org.springframework.dao.OptimisticLockingFailureException; - -/** - * <p> - * This class will provide business logic for 'Remove-attendee' action by user. - * </P> - */ -public class RemoveWaiter implements SignupBeanConstants { - - private static final int MAX_NUMBER_OF_RETRY = 20; - - private final SignupMeetingService signupMeetingService; - - private final String currentUserId; - - private final String currentSiteId; - - private Log logger = LogFactory.getLog(getClass()); - - private final boolean isOrganizer; - - /** - * Constructor - * - * @param signupMeetingService - * a SignupMeetingService object. - * @param currentUserId - * an unique sakai internal user id. - * @param currentSiteId - * an unique sakai site id. - * @param operationType - * a string value. - */ - public RemoveWaiter(SignupMeetingService signupMeetingService, String currentUserId, String currentSiteId, - String operationType, boolean isOrganizer) { - this.signupMeetingService = signupMeetingService; - this.currentUserId = currentUserId; - this.currentSiteId = currentSiteId; - this.isOrganizer = isOrganizer; - } - - private SignupMeeting reloadMeeting(Long meetingId) { - SignupMeeting m = signupMeetingService.loadSignupMeeting(meetingId, currentUserId, currentSiteId); - return m; - } - - /** - * This method perform Remove process for removing attendee from the waiting - * list in the event/meeting. - * - * @param meeting - * a SignupMeeting object. - * @param timeslot - * a SignupTimeslot object. - * @param waiter - * a SignupAttendee object. - * @return a SignupMeeting object, which is a refreshed updat-to-date data. - * @throws Exception - * throw if anything goes wrong. - */ - public SignupMeeting removeFromWaitingList(SignupMeeting meeting, SignupTimeslot timeslot, SignupAttendee waiter) - throws Exception { - try { - - handleVersion(meeting, timeslot, waiter); - if (ToolManager.getCurrentPlacement() != null) { - String signupEventType = isOrganizer ? SignupEventTypes.EVENT_SIGNUP_REMOVE_ATTENDEE_WL_L - : SignupEventTypes.EVENT_SIGNUP_REMOVE_ATTENDEE_WL_S; - Utilities.postEventTracking(signupEventType, ToolManager.getCurrentPlacement().getContext() - + " meetingId:" + meeting.getId() + " -removed from wlist on TS:" - + SignupDateFormat.format_date_h_mm_a(timeslot.getStartTime())); - } - logger.debug("Meeting Name:" + meeting.getTitle() + " - UserId:" + currentUserId - + " - has removed attendee(userId):" + waiter.getAttendeeUserId() + " from waiting list" - + " at timeslot started at:" + SignupDateFormat.format_date_h_mm_a(timeslot.getStartTime())); - } catch (PermissionException pe) { - throw new SignupUserActionException(Utilities.rb.getString("no.permissoin.do_it")); - } finally { - meeting = reloadMeeting(meeting.getId()); - } - // TODO calendar event id; - return meeting; - - } - - /** - * Give it a number of tries to update the event/meeting object into DB - * storage if this still satisfy the pre-condition regardless some changes - * in DB storage - */ - private void handleVersion(SignupMeeting meeting, SignupTimeslot timeslot, SignupAttendee waiter) throws Exception { - boolean success = false; - for (int i = 0; i < MAX_NUMBER_OF_RETRY; i++) { - try { - meeting = reloadMeeting(meeting.getId()); - prepareRemoveFromWaitingList(meeting, timeslot, waiter); - signupMeetingService.updateSignupMeeting(meeting, isOrganizer); - success = true; - break; // add attendee is successful - } catch (OptimisticLockingFailureException oe) { - // don't do any thing - } - } - if (!success) - throw new SignupUserActionException(Utilities.rb.getString("someone.already.updated.db")); - - } - - private void prepareRemoveFromWaitingList(SignupMeeting meeting, SignupTimeslot timeSlot, - SignupAttendee removedWaiter) throws Exception { - - SignupTimeslot currentTimeSlot = timeSlot; - List<SignupTimeslot> signupTimeSlots = meeting.getSignupTimeSlots(); - for (SignupTimeslot upToDateTimeslot : signupTimeSlots) { - if (currentTimeSlot.getId().equals(upToDateTimeslot.getId())) { - currentTimeSlot = upToDateTimeslot; - break; - } - } - boolean found = false; - List<SignupAttendee> waiters = currentTimeSlot.getWaitingList(); - if (waiters != null) { - for (Iterator iter = waiters.iterator(); iter.hasNext();) { - SignupAttendee waiter = (SignupAttendee) iter.next(); - if (removedWaiter.getAttendeeUserId().equals(waiter.getAttendeeUserId())) { - iter.remove(); - found = true; - } - } - if (!found) { - throw new SignupUserActionException(Utilities.rb - .getString("someone.already.removed_or_promoted_attendee")); - } - } - - } - -} +/* +* Licensed to The Apereo Foundation under one or more contributor license +* agreements. See the NOTICE file distributed with this work for +* additional information regarding copyright ownership. +* +* The Apereo Foundation licenses this file to you 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: +* +* http://opensource.org/licenses/ecl2.txt +* +* 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.sakaiproject.signup.tool.jsf.organizer.action; + +import java.util.Iterator; +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sakaiproject.exception.PermissionException; +import org.sakaiproject.signup.logic.SignupEventTypes; +import org.sakaiproject.signup.logic.SignupMeetingService; +import org.sakaiproject.signup.logic.SignupUserActionException; +import org.sakaiproject.signup.model.SignupAttendee; +import org.sakaiproject.signup.model.SignupMeeting; +import org.sakaiproject.signup.model.SignupTimeslot; +import org.sakaiproject.signup.tool.util.SignupBeanConstants; +import org.sakaiproject.signup.tool.util.Utilities; +import org.sakaiproject.signup.util.SignupDateFormat; +import org.sakaiproject.tool.cover.ToolManager; +import org.springframework.dao.OptimisticLockingFailureException; + +/** + * <p> + * This class will provide business logic for 'Remove-attendee' action by user. + * </P> + */ +public class RemoveWaiter implements SignupBeanConstants { + + private static final int MAX_NUMBER_OF_RETRY = 20; + + private final SignupMeetingService signupMeetingService; + + private final String currentUserId; + + private final String currentSiteId; + + private Logger logger = LoggerFactory.getLogger(getClass()); + + private final boolean isOrganizer; + + /** + * Constructor + * + * @param signupMeetingService + * a SignupMeetingService object. + * @param currentUserId + * an unique sakai internal user id. + * @param currentSiteId + * an unique sakai site id. + * @param operationType + * a string value. + */ + public RemoveWaiter(SignupMeetingService signupMeetingService, String currentUserId, String currentSiteId, + String operationType, boolean isOrganizer) { + this.signupMeetingService = signupMeetingService; + this.currentUserId = currentUserId; + this.currentSiteId = currentSiteId; + this.isOrganizer = isOrganizer; + } + + private SignupMeeting reloadMeeting(Long meetingId) { + SignupMeeting m = signupMeetingService.loadSignupMeeting(meetingId, currentUserId, currentSiteId); + return m; + } + + /** + * This method perform Remove process for removing attendee from the waiting + * list in the event/meeting. + * + * @param meeting + * a SignupMeeting object. + * @param timeslot + * a SignupTimeslot object. + * @param waiter + * a SignupAttendee object. + * @return a SignupMeeting object, which is a refreshed updat-to-date data. + * @throws Exception + * throw if anything goes wrong. + */ + public SignupMeeting removeFromWaitingList(SignupMeeting meeting, SignupTimeslot timeslot, SignupAttendee waiter) + throws Exception { + try { + + handleVersion(meeting, timeslot, waiter); + if (ToolManager.getCurrentPlacement() != null) { + String signupEventType = isOrganizer ? SignupEventTypes.EVENT_SIGNUP_REMOVE_ATTENDEE_WL_L + : SignupEventTypes.EVENT_SIGNUP_REMOVE_ATTENDEE_WL_S; + Utilities.postEventTracking(signupEventType, ToolManager.getCurrentPlacement().getContext() + + " meetingId:" + meeting.getId() + " -removed from wlist on TS:" + + SignupDateFormat.format_date_h_mm_a(timeslot.getStartTime())); + } + logger.debug("Meeting Name:" + meeting.getTitle() + " - UserId:" + currentUserId + + " - has removed attendee(userId):" + waiter.getAttendeeUserId() + " from waiting list" + + " at timeslot started at:" + SignupDateFormat.format_date_h_mm_a(timeslot.getStartTime())); + } catch (PermissionException pe) { + throw new SignupUserActionException(Utilities.rb.getString("no.permissoin.do_it")); + } finally { + meeting = reloadMeeting(meeting.getId()); + } + // TODO calendar event id; + return meeting; + + } + + /** + * Give it a number of tries to update the event/meeting object into DB + * storage if this still satisfy the pre-condition regardless some changes + * in DB storage + */ + private void handleVersion(SignupMeeting meeting, SignupTimeslot timeslot, SignupAttendee waiter) throws Exception { + boolean success = false; + for (int i = 0; i < MAX_NUMBER_OF_RETRY; i++) { + try { + meeting = reloadMeeting(meeting.getId()); + prepareRemoveFromWaitingList(meeting, timeslot, waiter); + signupMeetingService.updateSignupMeeting(meeting, isOrganizer); + success = true; + break; // add attendee is successful + } catch (OptimisticLockingFailureException oe) { + // don't do any thing + } + } + if (!success) + throw new SignupUserActionException(Utilities.rb.getString("someone.already.updated.db")); + + } + + private void prepareRemoveFromWaitingList(SignupMeeting meeting, SignupTimeslot timeSlot, + SignupAttendee removedWaiter) throws Exception { + + SignupTimeslot currentTimeSlot = timeSlot; + List<SignupTimeslot> signupTimeSlots = meeting.getSignupTimeSlots(); + for (SignupTimeslot upToDateTimeslot : signupTimeSlots) { + if (currentTimeSlot.getId().equals(upToDateTimeslot.getId())) { + currentTimeSlot = upToDateTimeslot; + break; + } + } + boolean found = false; + List<SignupAttendee> waiters = currentTimeSlot.getWaitingList(); + if (waiters != null) { + for (Iterator iter = waiters.iterator(); iter.hasNext();) { + SignupAttendee waiter = (SignupAttendee) iter.next(); + if (removedWaiter.getAttendeeUserId().equals(waiter.getAttendeeUserId())) { + iter.remove(); + found = true; + } + } + if (!found) { + throw new SignupUserActionException(Utilities.rb + .getString("someone.already.removed_or_promoted_attendee")); + } + } + + } + +} diff --git a/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/organizer/action/SignupAction.java b/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/organizer/action/SignupAction.java index 5e648bd2111e..87b2243916b1 100644 --- a/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/organizer/action/SignupAction.java +++ b/signup/tool/src/java/org/sakaiproject/signup/tool/jsf/organizer/action/SignupAction.java @@ -1,299 +1,299 @@ -/* -* Licensed to The Apereo Foundation under one or more contributor license -* agreements. See the NOTICE file distributed with this work for -* additional information regarding copyright ownership. -* -* The Apereo Foundation licenses this file to you 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: -* -* http://opensource.org/licenses/ecl2.txt -* -* 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.sakaiproject.signup.tool.jsf.organizer.action; - -import java.text.DateFormat; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.Iterator; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.sakaiproject.signup.logic.SakaiFacade; -import org.sakaiproject.signup.logic.SignupEmailFacade; -import org.sakaiproject.signup.logic.SignupMeetingService; -import org.sakaiproject.signup.logic.SignupMessageTypes; -import org.sakaiproject.signup.logic.messages.SignupEventTrackingInfo; -import org.sakaiproject.signup.logic.messages.SignupEventTrackingInfoImpl; -import org.sakaiproject.signup.model.SignupAttachment; -import org.sakaiproject.signup.model.SignupAttendee; -import org.sakaiproject.signup.model.SignupMeeting; -import org.sakaiproject.signup.model.SignupTimeslot; -import org.sakaiproject.signup.tool.util.SignupBeanConstants; -import org.sakaiproject.signup.tool.util.Utilities; - -/** - * <p> - * This is a abstract base class, which will provide most commen members and - * shared methods for children user action classes. - * </P> - */ -public abstract class SignupAction implements SignupBeanConstants{ - - protected final String userId; - - protected final String siteId; - - protected final SignupMeetingService signupMeetingService; - - protected SignupEventTrackingInfo signupEventTrackingInfo; - - protected Log logger = LogFactory.getLog(getClass()); - - protected final boolean isOrganizer; - - /** - * Constructor - * - * @param userId - * an unique sakai internal user id. - * @param siteId - * an unique sakai site id. - * @param signupMeetingService - * a SignupMeetingService obect. - */ - public SignupAction(String userId, String siteId, SignupMeetingService signupMeetingService, boolean isOrganizer) { - this.userId = userId; - this.siteId = siteId; - this.signupMeetingService = signupMeetingService; - this.isOrganizer = isOrganizer; - - this.signupEventTrackingInfo = new SignupEventTrackingInfoImpl(); - } - - /** - * Remove the attendee from the waiting list in an event/meeting. - * - * @param meeting - * a SignupMeeting object. - * @param attendee - * a SignupAttendee object. - */ - public void removeAttendeeFromWaitingList(SignupMeeting meeting, SignupAttendee attendee) { - List<SignupTimeslot> signupTimeSlots = meeting.getSignupTimeSlots(); - for (SignupTimeslot timeslot : signupTimeSlots) { - List<SignupAttendee> waiters = timeslot.getWaitingList(); - SignupAttendee waiter = timeslot.getWaiter(attendee.getAttendeeUserId()); - if (waiter != null) - waiters.remove(waiter); - } - - } - - /** - * Remove the attendee from the waiting list at a specific time slot. - * - * @param timeslot - * a SingupTimeslot object. - * @param attendee - * a SignupAttendee object. - */ - protected void removeAttendeeFromWaitingList(SignupTimeslot timeslot, SignupAttendee attendee) { - List<SignupAttendee> waiters = timeslot.getWaitingList(); - SignupAttendee waiter = timeslot.getWaiter(attendee.getAttendeeUserId()); - if (waiter != null) - waiters.remove(waiter); - - } - - /** remove the promoted attendee from all the waiting list */ - protected void promoteAttendeeFromWaitingList(SignupMeeting meeting, SignupTimeslot timeSlot) { - - List<SignupAttendee> attendees = timeSlot.getAttendees(); - /* - * if timeslot has more attendees than the max since orgranizer can add - * any number of attendees -> then don't promote - */ - if (attendees != null && timeSlot.getMaxNoOfAttendees() <= attendees.size()) - return; - - List<SignupAttendee> waitingList = timeSlot.getWaitingList(); - if (waitingList == null || waitingList.isEmpty()) - return; - - SignupAttendee promotedAttendee = waitingList.get(0); - - SignupAttendee att = new SignupAttendee(); - att.setAttendeeUserId(promotedAttendee.getAttendeeUserId()); - att.setComments(promotedAttendee.getComments()); - // TODO: att.setCalendarEventId(promotedAttendee.getCalendarEventId()); - att.setSignupSiteId(promotedAttendee.getSignupSiteId()); - timeSlot.getAttendees().add(att); - /** - * Removing from waiting list first is important. This will prevent - * infinite loop - */ - removeAttendeeFromWaitingList(meeting, promotedAttendee); - - signupEventTrackingInfo.addOrUpdateAttendeeAllocationInfo(att, timeSlot, - SignupEmailFacade.SIGNUP_ATTENDEE_PROMOTE, false); - - removeAttendeeFromAttendeesList(meeting, timeSlot, promotedAttendee); - - } - - /** - * when one attendee is removed from the Singup list, the people on waiting - * list will be promoted into this spot. - */ - protected void removeAttendeeFromAttendeesList(SignupMeeting meeting, SignupTimeslot currentTimeslot, - SignupAttendee attendee) { - String attendeeUserId = attendee.getAttendeeUserId(); - List<SignupTimeslot> signupTimeSlots = meeting.getSignupTimeSlots(); - int maxAllowedTimeslotsPerAttn = meeting.getMaxNumOfSlots(); - int currentCountForAttn = 1; - for (SignupTimeslot upToDateTimeslot : signupTimeSlots) { - /* prevent from removing this attendee from just promoted spot */ - if (currentTimeslot.getId().equals(upToDateTimeslot.getId())) - continue; - - List<SignupAttendee> attendees = upToDateTimeslot.getAttendees(); - /*TODO we only remove attn one time (randomly by now) since it allows multiple timeslots*/ - boolean foundAttendee = false; - for (Iterator iter = attendees.iterator(); iter.hasNext();) { - SignupAttendee att = (SignupAttendee) iter.next(); - if (attendeeUserId.equals(att.getAttendeeUserId())) { - currentCountForAttn++; - if(currentCountForAttn > maxAllowedTimeslotsPerAttn){ - iter.remove(); - signupEventTrackingInfo.addOrUpdateAttendeeAllocationInfo(att, upToDateTimeslot, - SignupEmailFacade.SIGNUP_ATTENDEE_CANCEL, false); - - promoteAttendeeFromWaitingList(meeting, upToDateTimeslot); - foundAttendee=true; - break; - } - } - } - - if(foundAttendee){ - break; - } - } - } - - /** - * Get the SignupEventTrackingInfo object. - * - * @return a SignupEventTrackingInfo object. - */ - public SignupEventTrackingInfo getSignupEventTrackingInfo() { - return signupEventTrackingInfo; - } - - /** - * This is a setter method. - * - * @param signupEventTrackingInfo - * a SignupEventTrackingInfo object. - */ - public void setSignupEventTrackingInfo(SignupEventTrackingInfo signupEventTrackingInfo) { - this.signupEventTrackingInfo = signupEventTrackingInfo; - } - - public List<SignupAttachment> getAttendeeAttachments(List<SignupAttachment> sAttachList) { - return getCorrespondingAttachment(sAttachList, false); - } - - - public List<SignupAttachment> getEventMainAttachments(List<SignupAttachment> sAttachList) { - return getCorrespondingAttachment(sAttachList, true); - } - - private List<SignupAttachment> getCorrespondingAttachment(List<SignupAttachment> sAttachList, boolean isMainEventAttachs){ - List<SignupAttachment> tmp = new ArrayList<SignupAttachment>(); - if(sAttachList != null){ - for (SignupAttachment attach: sAttachList) { - if(isMainEventAttachs){ - if( attach.getTimeslotId() ==null) - tmp.add(attach); - }else { - if(attach.getTimeslotId() !=null && ! attach.getViewByAll()) - tmp.add(attach); - } - - - //TODO other cases: such as attachment for a specific time slot only. - } - } - return tmp; - } - - // Generate a group title based on the input given - public String generateGroupTitle(String meetingTitle, SignupTimeslot timeslot, int rowNum) { - - //Based on the database limitation - final int TITLE_MAX_LENGTH = 99; - final char SEPARATOR = '-'; - - final DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT); - int titleSize = TITLE_MAX_LENGTH - SakaiFacade.GROUP_PREFIX.length(); - String dateString = df.format(timeslot.getStartTime()); - StringBuilder sb = new StringBuilder(titleSize); - - sb.append(" "); - sb.append(SEPARATOR); - sb.append(Utilities.rb.getString("group_slot_in_group_titlename")); - sb.append(" " + rowNum); - titleSize -= sb.length(); - //take the dateString length away with " _" prefix, it fixed recurring events duplicate groupName issue - titleSize -= dateString.length() + 2; - - if (titleSize > 0) - sb.insert(0, meetingTitle.substring(0, Math.min(titleSize, meetingTitle.length()))); - - //fixes recurring meeting with the same tile, which causes the same groupName - sb.append(" _" + dateString); - - return sb.toString(); - } - - public String getFormatTimeslotDateTime(SignupTimeslot timeslot){ - - final DateFormat df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); - final char SEPARATOR = '-'; - StringBuilder sb = new StringBuilder(); - sb.append(df.format(timeslot.getStartTime())); - sb.append(SEPARATOR); - sb.append(df.format(timeslot.getEndTime())); - - return sb.toString(); - } - - //generate a group description - public String generateGroupDescription(String meetingTitle, SignupTimeslot timeslot) { - Object[] params = new Object[] { getFormatTimeslotDateTime(timeslot)}; - return MessageFormat.format(Utilities.rb.getString("group_description_default"),params); - } - //convert a list of SignupAttendees to a list of userIds - public List<String> convertAttendeesToUuids(List<SignupAttendee> attendees) { - - List<String> uuids = new ArrayList<String>(); - - for(SignupAttendee a: attendees) { - uuids.add(a.getAttendeeUserId()); - } - - return uuids; - } - -} +/* +* Licensed to The Apereo Foundation under one or more contributor license +* agreements. See the NOTICE file distributed with this work for +* additional information regarding copyright ownership. +* +* The Apereo Foundation licenses this file to you 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: +* +* http://opensource.org/licenses/ecl2.txt +* +* 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.sakaiproject.signup.tool.jsf.organizer.action; + +import java.text.DateFormat; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.Iterator; +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sakaiproject.signup.logic.SakaiFacade; +import org.sakaiproject.signup.logic.SignupEmailFacade; +import org.sakaiproject.signup.logic.SignupMeetingService; +import org.sakaiproject.signup.logic.SignupMessageTypes; +import org.sakaiproject.signup.logic.messages.SignupEventTrackingInfo; +import org.sakaiproject.signup.logic.messages.SignupEventTrackingInfoImpl; +import org.sakaiproject.signup.model.SignupAttachment; +import org.sakaiproject.signup.model.SignupAttendee; +import org.sakaiproject.signup.model.SignupMeeting; +import org.sakaiproject.signup.model.SignupTimeslot; +import org.sakaiproject.signup.tool.util.SignupBeanConstants; +import org.sakaiproject.signup.tool.util.Utilities; + +/** + * <p> + * This is a abstract base class, which will provide most commen members and + * shared methods for children user action classes. + * </P> + */ +public abstract class SignupAction implements SignupBeanConstants{ + + protected final String userId; + + protected final String siteId; + + protected final SignupMeetingService signupMeetingService; + + protected SignupEventTrackingInfo signupEventTrackingInfo; + + protected Logger logger = LoggerFactory.getLogger(getClass()); + + protected final boolean isOrganizer; + + /** + * Constructor + * + * @param userId + * an unique sakai internal user id. + * @param siteId + * an unique sakai site id. + * @param signupMeetingService + * a SignupMeetingService obect. + */ + public SignupAction(String userId, String siteId, SignupMeetingService signupMeetingService, boolean isOrganizer) { + this.userId = userId; + this.siteId = siteId; + this.signupMeetingService = signupMeetingService; + this.isOrganizer = isOrganizer; + + this.signupEventTrackingInfo = new SignupEventTrackingInfoImpl(); + } + + /** + * Remove the attendee from the waiting list in an event/meeting. + * + * @param meeting + * a SignupMeeting object. + * @param attendee + * a SignupAttendee object. + */ + public void removeAttendeeFromWaitingList(SignupMeeting meeting, SignupAttendee attendee) { + List<SignupTimeslot> signupTimeSlots = meeting.getSignupTimeSlots(); + for (SignupTimeslot timeslot : signupTimeSlots) { + List<SignupAttendee> waiters = timeslot.getWaitingList(); + SignupAttendee waiter = timeslot.getWaiter(attendee.getAttendeeUserId()); + if (waiter != null) + waiters.remove(waiter); + } + + } + + /** + * Remove the attendee from the waiting list at a specific time slot. + * + * @param timeslot + * a SingupTimeslot object. + * @param attendee + * a SignupAttendee object. + */ + protected void removeAttendeeFromWaitingList(SignupTimeslot timeslot, SignupAttendee attendee) { + List<SignupAttendee> waiters = timeslot.getWaitingList(); + SignupAttendee waiter = timeslot.getWaiter(attendee.getAttendeeUserId()); + if (waiter != null) + waiters.remove(waiter); + + } + + /** remove the promoted attendee from all the waiting list */ + protected void promoteAttendeeFromWaitingList(SignupMeeting meeting, SignupTimeslot timeSlot) { + + List<SignupAttendee> attendees = timeSlot.getAttendees(); + /* + * if timeslot has more attendees than the max since orgranizer can add + * any number of attendees -> then don't promote + */ + if (attendees != null && timeSlot.getMaxNoOfAttendees() <= attendees.size()) + return; + + List<SignupAttendee> waitingList = timeSlot.getWaitingList(); + if (waitingList == null || waitingList.isEmpty()) + return; + + SignupAttendee promotedAttendee = waitingList.get(0); + + SignupAttendee att = new SignupAttendee(); + att.setAttendeeUserId(promotedAttendee.getAttendeeUserId()); + att.setComments(promotedAttendee.getComments()); + // TODO: att.setCalendarEventId(promotedAttendee.getCalendarEventId()); + att.setSignupSiteId(promotedAttendee.getSignupSiteId()); + timeSlot.getAttendees().add(att); + /** + * Removing from waiting list first is important. This will prevent + * infinite loop + */ + removeAttendeeFromWaitingList(meeting, promotedAttendee); + + signupEventTrackingInfo.addOrUpdateAttendeeAllocationInfo(att, timeSlot, + SignupEmailFacade.SIGNUP_ATTENDEE_PROMOTE, false); + + removeAttendeeFromAttendeesList(meeting, timeSlot, promotedAttendee); + + } + + /** + * when one attendee is removed from the Singup list, the people on waiting + * list will be promoted into this spot. + */ + protected void removeAttendeeFromAttendeesList(SignupMeeting meeting, SignupTimeslot currentTimeslot, + SignupAttendee attendee) { + String attendeeUserId = attendee.getAttendeeUserId(); + List<SignupTimeslot> signupTimeSlots = meeting.getSignupTimeSlots(); + int maxAllowedTimeslotsPerAttn = meeting.getMaxNumOfSlots(); + int currentCountForAttn = 1; + for (SignupTimeslot upToDateTimeslot : signupTimeSlots) { + /* prevent from removing this attendee from just promoted spot */ + if (currentTimeslot.getId().equals(upToDateTimeslot.getId())) + continue; + + List<SignupAttendee> attendees = upToDateTimeslot.getAttendees(); + /*TODO we only remove attn one time (randomly by now) since it allows multiple timeslots*/ + boolean foundAttendee = false; + for (Iterator iter = attendees.iterator(); iter.hasNext();) { + SignupAttendee att = (SignupAttendee) iter.next(); + if (attendeeUserId.equals(att.getAttendeeUserId())) { + currentCountForAttn++; + if(currentCountForAttn > maxAllowedTimeslotsPerAttn){ + iter.remove(); + signupEventTrackingInfo.addOrUpdateAttendeeAllocationInfo(att, upToDateTimeslot, + SignupEmailFacade.SIGNUP_ATTENDEE_CANCEL, false); + + promoteAttendeeFromWaitingList(meeting, upToDateTimeslot); + foundAttendee=true; + break; + } + } + } + + if(foundAttendee){ + break; + } + } + } + + /** + * Get the SignupEventTrackingInfo object. + * + * @return a SignupEventTrackingInfo object. + */ + public SignupEventTrackingInfo getSignupEventTrackingInfo() { + return signupEventTrackingInfo; + } + + /** + * This is a setter method. + * + * @param signupEventTrackingInfo + * a SignupEventTrackingInfo object. + */ + public void setSignupEventTrackingInfo(SignupEventTrackingInfo signupEventTrackingInfo) { + this.signupEventTrackingInfo = signupEventTrackingInfo; + } + + public List<SignupAttachment> getAttendeeAttachments(List<SignupAttachment> sAttachList) { + return getCorrespondingAttachment(sAttachList, false); + } + + + public List<SignupAttachment> getEventMainAttachments(List<SignupAttachment> sAttachList) { + return getCorrespondingAttachment(sAttachList, true); + } + + private List<SignupAttachment> getCorrespondingAttachment(List<SignupAttachment> sAttachList, boolean isMainEventAttachs){ + List<SignupAttachment> tmp = new ArrayList<SignupAttachment>(); + if(sAttachList != null){ + for (SignupAttachment attach: sAttachList) { + if(isMainEventAttachs){ + if( attach.getTimeslotId() ==null) + tmp.add(attach); + }else { + if(attach.getTimeslotId() !=null && ! attach.getViewByAll()) + tmp.add(attach); + } + + + //TODO other cases: such as attachment for a specific time slot only. + } + } + return tmp; + } + + // Generate a group title based on the input given + public String generateGroupTitle(String meetingTitle, SignupTimeslot timeslot, int rowNum) { + + //Based on the database limitation + final int TITLE_MAX_LENGTH = 99; + final char SEPARATOR = '-'; + + final DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT); + int titleSize = TITLE_MAX_LENGTH - SakaiFacade.GROUP_PREFIX.length(); + String dateString = df.format(timeslot.getStartTime()); + StringBuilder sb = new StringBuilder(titleSize); + + sb.append(" "); + sb.append(SEPARATOR); + sb.append(Utilities.rb.getString("group_slot_in_group_titlename")); + sb.append(" " + rowNum); + titleSize -= sb.length(); + //take the dateString length away with " _" prefix, it fixed recurring events duplicate groupName issue + titleSize -= dateString.length() + 2; + + if (titleSize > 0) + sb.insert(0, meetingTitle.substring(0, Math.min(titleSize, meetingTitle.length()))); + + //fixes recurring meeting with the same tile, which causes the same groupName + sb.append(" _" + dateString); + + return sb.toString(); + } + + public String getFormatTimeslotDateTime(SignupTimeslot timeslot){ + + final DateFormat df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); + final char SEPARATOR = '-'; + StringBuilder sb = new StringBuilder(); + sb.append(df.format(timeslot.getStartTime())); + sb.append(SEPARATOR); + sb.append(df.format(timeslot.getEndTime())); + + return sb.toString(); + } + + //generate a group description + public String generateGroupDescription(String meetingTitle, SignupTimeslot timeslot) { + Object[] params = new Object[] { getFormatTimeslotDateTime(timeslot)}; + return MessageFormat.format(Utilities.rb.getString("group_description_default"),params); + } + //convert a list of SignupAttendees to a list of userIds + public List<String> convertAttendeesToUuids(List<SignupAttendee> attendees) { + + List<String> uuids = new ArrayList<String>(); + + for(SignupAttendee a: attendees) { + uuids.add(a.getAttendeeUserId()); + } + + return uuids; + } + +} diff --git a/signup/tool/src/java/org/sakaiproject/signup/tool/util/Utilities.java b/signup/tool/src/java/org/sakaiproject/signup/tool/util/Utilities.java index ee01c27afb55..bf1745ccd58d 100644 --- a/signup/tool/src/java/org/sakaiproject/signup/tool/util/Utilities.java +++ b/signup/tool/src/java/org/sakaiproject/signup/tool/util/Utilities.java @@ -1,530 +1,530 @@ -/* -* Licensed to The Apereo Foundation under one or more contributor license -* agreements. See the NOTICE file distributed with this work for -* additional information regarding copyright ownership. -* -* The Apereo Foundation licenses this file to you 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: -* -* http://opensource.org/licenses/ecl2.txt -* -* 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.sakaiproject.signup.tool.util; - -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.List; -import java.util.Map; - -import javax.faces.context.FacesContext; -import javax.faces.event.ActionEvent; -import javax.faces.model.SelectItem; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.sakaiproject.component.cover.ServerConfigurationService; -import org.sakaiproject.event.api.UsageSession; -import org.sakaiproject.event.cover.EventTrackingService; -import org.sakaiproject.event.cover.UsageSessionService; -import org.sakaiproject.signup.logic.SakaiFacade; -import org.sakaiproject.signup.logic.SignupUser; -import org.sakaiproject.signup.model.MeetingTypes; -import org.sakaiproject.signup.model.SignupAttendee; -import org.sakaiproject.signup.model.SignupMeeting; -import org.sakaiproject.signup.model.SignupTimeslot; -import org.sakaiproject.signup.tool.jsf.MessageUIBean; -import org.sakaiproject.signup.tool.jsf.SignupMeetingsBean; -import org.sakaiproject.signup.tool.jsf.organizer.UserDefineTimeslotBean; -import org.sakaiproject.util.ResourceLoader; - -/** - * <p> - * This Utility class provides the common used logic by Signup tool. - * - * @author Peter Liu - * - * </P> - */ -public final class Utilities implements SignupBeanConstants, MeetingTypes { - - /** - * Get the resource bundle for messages.properties file - */ - public static ResourceLoader rb = new ResourceLoader("messages"); - - /** - * Get the resource bundle for signupConfig.properties file - */ - public static ResourceLoader rbConf = new ResourceLoader("signupConfig"); - - /** - * Defined a constant name for ,essageUIBean - */ - public static final String MESSAGE_UIBEAN = "messageUIBean"; - - /** - * Message types - */ - private static final int TYPE_ERROR=1; - private static final int TYPE_INFO=2; - - protected static Log logger = LogFactory.getLog(Utilities.class); - - /** - * Add the error message to mssageUIBean for UI purpose. - * - * @param errorMsg - * a error message string. - */ - public static void addErrorMessage(String errorMsg) { - addMessage(MESSAGE_UIBEAN, TYPE_ERROR, errorMsg); - } - - /** - * Add the info message to messageUIBean for UI purpose. - * - * @param infoMsg - * an info message string. - */ - public static void addInfoMessage(String infoMsg) { - addMessage(MESSAGE_UIBEAN, TYPE_INFO, infoMsg); - } - - private static void addMessage(String key, int type, String msg) { - FacesContext context = FacesContext.getCurrentInstance(); - Map sessionMap = FacesContext.getCurrentInstance().getExternalContext().getSessionMap(); - MessageUIBean msgBean = (MessageUIBean) sessionMap.get(MESSAGE_UIBEAN); - - switch(type) { - case 1: msgBean.setErrorMessage(msg); break; - case 2: msgBean.setInfoMessage(msg); break; - default: logger.error("Invalid mesage type ("+type +"). No message will be set"); break; - } - - sessionMap.put(key, msgBean); - context.renderResponse(); - } - - - - - /** - * This method will retrieve the value from Request object by the Request - * parameter/attribute name - * - * @param attrName - * a string value - * @return a string value - */ - public static String getRequestParam(String attrName) { - - String value = (String) FacesContext.getCurrentInstance() - .getExternalContext().getRequestParameterMap().get(attrName); - - if (value == null || value.trim().length() == 0) { - value = (String) FacesContext.getCurrentInstance() - .getExternalContext().getRequestMap().get(attrName); - } - - return value; - } - - /** - * This method will retrieve the value from UI CommandButton - * parameter/attribute name - * - * @param attrName - * a string value - * @return a string value - */ - public static String getActionAttribute(ActionEvent event, String name) { - return (String) event.getComponent().getAttributes().get(name); - } - - - /** - * Reset the meetings in the SignupMeetingsBean to null so we will fetch all - * the up-to-date meeting data again - */ - public static void resetMeetingList() { - SignupMeetingsBean meetingsBean = (SignupMeetingsBean) FacesContext - .getCurrentInstance().getExternalContext().getSessionMap().get( - "SignupMeetingsBean"); - meetingsBean.setSignupMeetings(null); - } - - /** - * Get the SignupMeetingsBean in JSF as a session bean - * - * @return a SignupMeetingsBean JSF object - */ - public static SignupMeetingsBean getSignupMeetingsBean() { - return (SignupMeetingsBean) FacesContext.getCurrentInstance() - .getExternalContext().getSessionMap().get("SignupMeetingsBean"); - } - - /** - * Relocate the timeslots in the event/meeting around according to the new - * data. - * - * @param startTime - * a Date object. - * @param timeSlotDuration - * an int value, which indicate the length of the time slot. - * @param numOfTimeslot - * an int value, which indicate how many time slots are there. - * @param tsList - * a list of SignupTimeslot objects. This object is a reference - * object and after this call, it will hold the relocated new - * data. - * @return a Date object, which holds the ending time of the event/meeting. - */ - public static Date reAllocateTimeslots(Date startTime, - int timeSlotDuration, int numOfTimeslot, List<SignupTimeslot> tsList) { - Calendar calendar = Calendar.getInstance(); - calendar.setTime(startTime);// new starting time - if (tsList == null || tsList.isEmpty()) - return startTime; - - for (SignupTimeslot timeslot : tsList) { - timeslot.setStartTime(calendar.getTime()); - calendar.add(Calendar.MINUTE, timeSlotDuration); - timeslot.setEndTime(calendar.getTime()); - } - - return calendar.getTime(); - } - - /** - * Calculate the time according to the input parameters. - * - * @param date - * a Date object. - * @param time - * an int value. - * @param dateType - * a string value. - * @return a converted Date object according to the input parameters. - */ - public static Date subTractTimeToDate(Date date, int time, String dateType) { - if (time == 0) - return date; - - int type = -1; - if (dateType.equals(MINUTES)) - type = Calendar.MINUTE; - else if (dateType.equals(HOURS)) - type = Calendar.HOUR; - else if (dateType.equals(START_NOW)){ - Calendar cal = Calendar.getInstance(); - cal.setTime(new Date()); - cal.set(Calendar.SECOND, 0); - cal.set(Calendar.MILLISECOND, 0); - return cal.getTime(); - }else {// days{ - time = 24 * time; // convert to hours - type = Calendar.HOUR; - } - Calendar calendar = Calendar.getInstance(); - calendar.setTime(date); - calendar.add(type, -1 * time); - - return calendar.getTime(); - } - - /** - * Get the Signup tool defined time unit type. - * - * @param timeLength - * a long value. - * @return a time unit value string such as 'hours', 'minutes' and 'days'. - */ - public static String getTimeScaleType(long timeLength) { - String timeUnitType = MINUTES; - if (timeLength == (((long) (timeLength / DAY_IN_MINUTES)) * DAY_IN_MINUTES)) - timeUnitType = DAYS; - else if (timeLength == (((long) (timeLength / Hour_In_MINUTES)) * Hour_In_MINUTES)) - timeUnitType = HOURS; - - return timeUnitType; - } - - /** - * Get the relative time value according to the time unit type. - * - * @param timeScaleType - * a string value. - * @param timeLength - * a long value - * @return a int value. - */ - public static int getRelativeTimeValue(String timeScaleType, long timeLength) { - long rValue = timeLength; - if (DAYS.equals(timeScaleType)) - rValue = timeLength / DAY_IN_MINUTES; - if (HOURS.equals(timeScaleType)) - rValue = timeLength / Hour_In_MINUTES; - - return (int) rValue; - } - - /** - * This method will determine whether the recurring events have been previously setup by 'Start_Now' - * type. - * @param recurringMeetings - * a list of SignupMeeting objects. - * @return true if the events have been set up as 'start_now' type previously - */ - public static boolean testSignupBeginStartNowType(List<SignupMeeting> recurringMeetings){ - boolean isStartNowTypeForRecurEvents=false; - if(recurringMeetings !=null && recurringMeetings.size()>1){ - long signupBeginsTimeSecLastOne = recurringMeetings.get(recurringMeetings.size()-2).getSignupBegins() == null ? new Date().getTime() : recurringMeetings.get(recurringMeetings.size()-2).getSignupBegins() - .getTime(); - long signupBeginsTimeLastOne = recurringMeetings.get(recurringMeetings.size()-1).getSignupBegins() == null ? new Date().getTime() : recurringMeetings.get(recurringMeetings.size()-1).getSignupBegins() - .getTime(); - //check for SignupBegin time and it should be the same. - if(signupBeginsTimeSecLastOne ==signupBeginsTimeLastOne){ - isStartNowTypeForRecurEvents=true; - for (SignupMeeting sm : recurringMeetings) { - //double check, it has to be started now for sign-up process - if (!sm.getSignupBegins().before(new Date())){ - isStartNowTypeForRecurEvents=false; - break; - } - } - } - } - return isStartNowTypeForRecurEvents; - } - - /** - * It provides a list of meeting type choices for user. - * - * @param mSelectedType - * a String value, which indicates that the passed-in meeting - * type will not disabled. - * @param disableNotSelectedOnes - * a boolean value which indicate whether to disable other - * meeting types except this one. - * @return a list of SelectItem objects. - */ - public static List<SelectItem> getMeetingTypeSelectItems( - String mSelectedType, boolean disableNotSelectedOnes) { - List<SelectItem> meetingTypeItems = new ArrayList<SelectItem>(); - SelectItem announ = new SelectItem(ANNOUNCEMENT, Utilities.rb - .getString("label_announcement"), "anouncment"); - SelectItem multiple = new SelectItem(INDIVIDUAL, Utilities.rb - .getString("label_individaul"), "individaul"); - SelectItem group = new SelectItem(GROUP, Utilities.rb - .getString("label_group"), "group"); - - if (disableNotSelectedOnes) { - if (!ANNOUNCEMENT.equals(mSelectedType)) - announ.setDisabled(true); - if (!GROUP.equals(mSelectedType)) - group.setDisabled(true); - if (!INDIVIDUAL.equals(mSelectedType)) - multiple.setDisabled(true); - } - meetingTypeItems.add(announ); - meetingTypeItems.add(group); - meetingTypeItems.add(multiple); - - return meetingTypeItems; - } - - private static boolean postToDatabase = "false".equals(getSignupConfigParamVal("signup.post.eventTracking.info.to.DB", "true")) ? false : true; - - /** - * This method will post user action event to DB by using - * Sakai-event-tracking mechanism. This event tracking can be turned off by - * setting value of post.eventTracking.info.to.DB in message.properties file - * to <b>false</b> - * - * @param mainSignupEventType - * a sign-up event type string - * @param eventActionInfo - * a detailed action info string - */ - public static void postEventTracking(String mainSignupEventType, - String eventActionInfo) { - if (postToDatabase) { - UsageSession usageSession = UsageSessionService.getSession(); - if (eventActionInfo != null && eventActionInfo.length() >= 256) { - /* truncate it due to DB field size(255) constraint */ - eventActionInfo = eventActionInfo.substring(0, 252) + "..."; - } - EventTrackingService.post(EventTrackingService.newEvent( - mainSignupEventType, eventActionInfo, false), usageSession); - } - - } - - /** - * It will obtain user current sign-up status in an event. - * - * @param meeting - * a SignupMeeting object - * @param currentUserId - * a unique user internal id. - * @param sakaiFacade - * a SakaiFacade object - * @return a String object - */ - public static String retrieveAvailStatus(SignupMeeting meeting, - String currentUserId, SakaiFacade sakaiFacade) { - long curTime = (new Date()).getTime(); - long meetingStartTime = meeting.getStartTime().getTime(); - long meetingEndTime = meeting.getEndTime().getTime(); - long meetingSignupBegin = meeting.getSignupBegins().getTime(); - if (meetingEndTime < curTime) - return rb.getString("event.closed"); - if (meetingEndTime > curTime && meetingStartTime < curTime) - return rb.getString("event.inProgress"); - - if (meeting.getMeetingType().equals(SignupMeeting.ANNOUNCEMENT)) { - return rb.getString("event.SignupNotRequire"); - } - - String availableStatus = rb.getString("event.unavailable"); - boolean isSignupBegin = true; - if (meetingSignupBegin > curTime) { - isSignupBegin = false; - availableStatus = rb.getString("event.Signup.not.started.yet") - + " " - + sakaiFacade.getTimeService().newTime( - meeting.getSignupBegins().getTime()) - .toStringLocalShortDate(); - } - - boolean isOnWaitingList = false; - boolean isMeetingSpaceAvail = false; - List<SignupTimeslot> signupTimeSlots = meeting.getSignupTimeSlots(); - for (SignupTimeslot timeslot : signupTimeSlots) { - List<SignupAttendee> attendees = timeslot.getAttendees(); - for (SignupAttendee attendee : attendees) { - if (attendee.getAttendeeUserId().equals(currentUserId)) - return rb.getString("event.youSignedUp"); - } - - List<SignupAttendee> waiters = timeslot.getWaitingList(); - if (!isOnWaitingList) { - for (SignupAttendee waiter : waiters) { - if (waiter.getAttendeeUserId().equals(currentUserId)) { - availableStatus = rb.getString("event.youOnWaitList"); - isOnWaitingList = true; - break; - } - } - } - - int size = (attendees == null) ? 0 : attendees.size(); - if (!isOnWaitingList - && isSignupBegin - && !timeslot.isLocked() - && !timeslot.isCanceled() - && (size < timeslot.getMaxNoOfAttendees() || timeslot - .getMaxNoOfAttendees() == SignupTimeslot.UNLIMITED)) { - availableStatus = rb.getString("event.available"); - isMeetingSpaceAvail =true; - } - } - - if(isMeetingSpaceAvail && meeting.isLocked()){ - availableStatus = rb.getString("event.meeting.locked"); - } - - return availableStatus; - } - - /** - * This method will convert int days to a Date object - * - * @param days - * it indicates how many days from current time into the future - * @return a Date object - */ - public static Date getUserDefinedDate(int days) { - Calendar cal = Calendar.getInstance(); - cal.setTime(new Date()); - cal.add(Calendar.HOUR, 24 * days); - return cal.getTime(); - } - - public static String getSignupConfigParamVal(String paramName, String defaultValue) { - /* first look at sakai.properties and the tool bundle*/ - String myConfigValue=defaultValue; - if (paramName != null) { - try { - myConfigValue = ServerConfigurationService.getString(paramName); - if(myConfigValue ==null || myConfigValue.trim().length() < 1){ - myConfigValue = rbConf.getString(paramName); - int index = myConfigValue.indexOf("missing key");/*return value by rb if no key defined-- hard coded!!!*/ - if (index >=0) - myConfigValue = defaultValue; - } - } catch (Exception e) { - myConfigValue = defaultValue; - } - } - - return myConfigValue; - - } - - /** - * Gets a boolean value for a configuration, instead of a string value. - * @param paramname the name of the config parameter - * @param defaultValue the default boolean value to use - * @return <code>true</code> if and only if the config parameter is <code>"true"</code>. - */ - public static boolean getSignupConfigParamVal(final String paramname, final boolean defaultValue) { - String stringValue = getSignupConfigParamVal(paramname, String.valueOf(defaultValue)); - return "true".equalsIgnoreCase(stringValue); - } - - public static boolean isDataIntegritySafe(boolean isUserDefinedTS, String callerBeanType, UserDefineTimeslotBean uBean){ - if(isUserDefinedTS && !callerBeanType.equals(uBean.getPlaceOrderBean())){ - Utilities.addErrorMessage("You may have opened multiple Tabs in your browser, please close them and try again.");// Utilities.rb.getString("event_endtime_auto_adjusted_warning")); - return false; - } - return true; - } - - /** - * Turn list of signup users into list of ids for storage into db. - * SIGNUP-216 removed the restriction that an organizer cannot be in this list (unsure why they couldnt since they have the option of being chosen but are then removed?) - * @param coordinators - * @param organizerId - * @return - */ - public static String getSelectedCoordinators(List<SignupUser> coordinators, String organizerId){ - StringBuilder sb = new StringBuilder(); - boolean isFirst = true; - for (SignupUser co : coordinators) { - if(co.isChecked()){ - if(isFirst){ - sb.append(co.getInternalUserId()); - isFirst = false; - }else{ - //safeguard -db column max size, hardly have over 10 coordinators per meeting - //SS note, this would still blow the DB limit since the check was for up to 1000, and then adding text to that - //and the limit is 1000 (why was this number chosen and why wasn't this list normalised?) - //so the limit has been lowered to 950 to be safer. - if(sb.length() < 950) - sb.append("|" + co.getInternalUserId()); - } - } - } - return sb.length()<1? null : sb.toString(); - } -} +/* +* Licensed to The Apereo Foundation under one or more contributor license +* agreements. See the NOTICE file distributed with this work for +* additional information regarding copyright ownership. +* +* The Apereo Foundation licenses this file to you 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: +* +* http://opensource.org/licenses/ecl2.txt +* +* 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.sakaiproject.signup.tool.util; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import javax.faces.context.FacesContext; +import javax.faces.event.ActionEvent; +import javax.faces.model.SelectItem; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sakaiproject.component.cover.ServerConfigurationService; +import org.sakaiproject.event.api.UsageSession; +import org.sakaiproject.event.cover.EventTrackingService; +import org.sakaiproject.event.cover.UsageSessionService; +import org.sakaiproject.signup.logic.SakaiFacade; +import org.sakaiproject.signup.logic.SignupUser; +import org.sakaiproject.signup.model.MeetingTypes; +import org.sakaiproject.signup.model.SignupAttendee; +import org.sakaiproject.signup.model.SignupMeeting; +import org.sakaiproject.signup.model.SignupTimeslot; +import org.sakaiproject.signup.tool.jsf.MessageUIBean; +import org.sakaiproject.signup.tool.jsf.SignupMeetingsBean; +import org.sakaiproject.signup.tool.jsf.organizer.UserDefineTimeslotBean; +import org.sakaiproject.util.ResourceLoader; + +/** + * <p> + * This Utility class provides the common used logic by Signup tool. + * + * @author Peter Liu + * + * </P> + */ +public final class Utilities implements SignupBeanConstants, MeetingTypes { + + /** + * Get the resource bundle for messages.properties file + */ + public static ResourceLoader rb = new ResourceLoader("messages"); + + /** + * Get the resource bundle for signupConfig.properties file + */ + public static ResourceLoader rbConf = new ResourceLoader("signupConfig"); + + /** + * Defined a constant name for ,essageUIBean + */ + public static final String MESSAGE_UIBEAN = "messageUIBean"; + + /** + * Message types + */ + private static final int TYPE_ERROR=1; + private static final int TYPE_INFO=2; + + protected static Logger logger = LoggerFactory.getLogger(Utilities.class); + + /** + * Add the error message to mssageUIBean for UI purpose. + * + * @param errorMsg + * a error message string. + */ + public static void addErrorMessage(String errorMsg) { + addMessage(MESSAGE_UIBEAN, TYPE_ERROR, errorMsg); + } + + /** + * Add the info message to messageUIBean for UI purpose. + * + * @param infoMsg + * an info message string. + */ + public static void addInfoMessage(String infoMsg) { + addMessage(MESSAGE_UIBEAN, TYPE_INFO, infoMsg); + } + + private static void addMessage(String key, int type, String msg) { + FacesContext context = FacesContext.getCurrentInstance(); + Map sessionMap = FacesContext.getCurrentInstance().getExternalContext().getSessionMap(); + MessageUIBean msgBean = (MessageUIBean) sessionMap.get(MESSAGE_UIBEAN); + + switch(type) { + case 1: msgBean.setErrorMessage(msg); break; + case 2: msgBean.setInfoMessage(msg); break; + default: logger.error("Invalid mesage type ("+type +"). No message will be set"); break; + } + + sessionMap.put(key, msgBean); + context.renderResponse(); + } + + + + + /** + * This method will retrieve the value from Request object by the Request + * parameter/attribute name + * + * @param attrName + * a string value + * @return a string value + */ + public static String getRequestParam(String attrName) { + + String value = (String) FacesContext.getCurrentInstance() + .getExternalContext().getRequestParameterMap().get(attrName); + + if (value == null || value.trim().length() == 0) { + value = (String) FacesContext.getCurrentInstance() + .getExternalContext().getRequestMap().get(attrName); + } + + return value; + } + + /** + * This method will retrieve the value from UI CommandButton + * parameter/attribute name + * + * @param attrName + * a string value + * @return a string value + */ + public static String getActionAttribute(ActionEvent event, String name) { + return (String) event.getComponent().getAttributes().get(name); + } + + + /** + * Reset the meetings in the SignupMeetingsBean to null so we will fetch all + * the up-to-date meeting data again + */ + public static void resetMeetingList() { + SignupMeetingsBean meetingsBean = (SignupMeetingsBean) FacesContext + .getCurrentInstance().getExternalContext().getSessionMap().get( + "SignupMeetingsBean"); + meetingsBean.setSignupMeetings(null); + } + + /** + * Get the SignupMeetingsBean in JSF as a session bean + * + * @return a SignupMeetingsBean JSF object + */ + public static SignupMeetingsBean getSignupMeetingsBean() { + return (SignupMeetingsBean) FacesContext.getCurrentInstance() + .getExternalContext().getSessionMap().get("SignupMeetingsBean"); + } + + /** + * Relocate the timeslots in the event/meeting around according to the new + * data. + * + * @param startTime + * a Date object. + * @param timeSlotDuration + * an int value, which indicate the length of the time slot. + * @param numOfTimeslot + * an int value, which indicate how many time slots are there. + * @param tsList + * a list of SignupTimeslot objects. This object is a reference + * object and after this call, it will hold the relocated new + * data. + * @return a Date object, which holds the ending time of the event/meeting. + */ + public static Date reAllocateTimeslots(Date startTime, + int timeSlotDuration, int numOfTimeslot, List<SignupTimeslot> tsList) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(startTime);// new starting time + if (tsList == null || tsList.isEmpty()) + return startTime; + + for (SignupTimeslot timeslot : tsList) { + timeslot.setStartTime(calendar.getTime()); + calendar.add(Calendar.MINUTE, timeSlotDuration); + timeslot.setEndTime(calendar.getTime()); + } + + return calendar.getTime(); + } + + /** + * Calculate the time according to the input parameters. + * + * @param date + * a Date object. + * @param time + * an int value. + * @param dateType + * a string value. + * @return a converted Date object according to the input parameters. + */ + public static Date subTractTimeToDate(Date date, int time, String dateType) { + if (time == 0) + return date; + + int type = -1; + if (dateType.equals(MINUTES)) + type = Calendar.MINUTE; + else if (dateType.equals(HOURS)) + type = Calendar.HOUR; + else if (dateType.equals(START_NOW)){ + Calendar cal = Calendar.getInstance(); + cal.setTime(new Date()); + cal.set(Calendar.SECOND, 0); + cal.set(Calendar.MILLISECOND, 0); + return cal.getTime(); + }else {// days{ + time = 24 * time; // convert to hours + type = Calendar.HOUR; + } + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.add(type, -1 * time); + + return calendar.getTime(); + } + + /** + * Get the Signup tool defined time unit type. + * + * @param timeLength + * a long value. + * @return a time unit value string such as 'hours', 'minutes' and 'days'. + */ + public static String getTimeScaleType(long timeLength) { + String timeUnitType = MINUTES; + if (timeLength == (((long) (timeLength / DAY_IN_MINUTES)) * DAY_IN_MINUTES)) + timeUnitType = DAYS; + else if (timeLength == (((long) (timeLength / Hour_In_MINUTES)) * Hour_In_MINUTES)) + timeUnitType = HOURS; + + return timeUnitType; + } + + /** + * Get the relative time value according to the time unit type. + * + * @param timeScaleType + * a string value. + * @param timeLength + * a long value + * @return a int value. + */ + public static int getRelativeTimeValue(String timeScaleType, long timeLength) { + long rValue = timeLength; + if (DAYS.equals(timeScaleType)) + rValue = timeLength / DAY_IN_MINUTES; + if (HOURS.equals(timeScaleType)) + rValue = timeLength / Hour_In_MINUTES; + + return (int) rValue; + } + + /** + * This method will determine whether the recurring events have been previously setup by 'Start_Now' + * type. + * @param recurringMeetings + * a list of SignupMeeting objects. + * @return true if the events have been set up as 'start_now' type previously + */ + public static boolean testSignupBeginStartNowType(List<SignupMeeting> recurringMeetings){ + boolean isStartNowTypeForRecurEvents=false; + if(recurringMeetings !=null && recurringMeetings.size()>1){ + long signupBeginsTimeSecLastOne = recurringMeetings.get(recurringMeetings.size()-2).getSignupBegins() == null ? new Date().getTime() : recurringMeetings.get(recurringMeetings.size()-2).getSignupBegins() + .getTime(); + long signupBeginsTimeLastOne = recurringMeetings.get(recurringMeetings.size()-1).getSignupBegins() == null ? new Date().getTime() : recurringMeetings.get(recurringMeetings.size()-1).getSignupBegins() + .getTime(); + //check for SignupBegin time and it should be the same. + if(signupBeginsTimeSecLastOne ==signupBeginsTimeLastOne){ + isStartNowTypeForRecurEvents=true; + for (SignupMeeting sm : recurringMeetings) { + //double check, it has to be started now for sign-up process + if (!sm.getSignupBegins().before(new Date())){ + isStartNowTypeForRecurEvents=false; + break; + } + } + } + } + return isStartNowTypeForRecurEvents; + } + + /** + * It provides a list of meeting type choices for user. + * + * @param mSelectedType + * a String value, which indicates that the passed-in meeting + * type will not disabled. + * @param disableNotSelectedOnes + * a boolean value which indicate whether to disable other + * meeting types except this one. + * @return a list of SelectItem objects. + */ + public static List<SelectItem> getMeetingTypeSelectItems( + String mSelectedType, boolean disableNotSelectedOnes) { + List<SelectItem> meetingTypeItems = new ArrayList<SelectItem>(); + SelectItem announ = new SelectItem(ANNOUNCEMENT, Utilities.rb + .getString("label_announcement"), "anouncment"); + SelectItem multiple = new SelectItem(INDIVIDUAL, Utilities.rb + .getString("label_individaul"), "individaul"); + SelectItem group = new SelectItem(GROUP, Utilities.rb + .getString("label_group"), "group"); + + if (disableNotSelectedOnes) { + if (!ANNOUNCEMENT.equals(mSelectedType)) + announ.setDisabled(true); + if (!GROUP.equals(mSelectedType)) + group.setDisabled(true); + if (!INDIVIDUAL.equals(mSelectedType)) + multiple.setDisabled(true); + } + meetingTypeItems.add(announ); + meetingTypeItems.add(group); + meetingTypeItems.add(multiple); + + return meetingTypeItems; + } + + private static boolean postToDatabase = "false".equals(getSignupConfigParamVal("signup.post.eventTracking.info.to.DB", "true")) ? false : true; + + /** + * This method will post user action event to DB by using + * Sakai-event-tracking mechanism. This event tracking can be turned off by + * setting value of post.eventTracking.info.to.DB in message.properties file + * to <b>false</b> + * + * @param mainSignupEventType + * a sign-up event type string + * @param eventActionInfo + * a detailed action info string + */ + public static void postEventTracking(String mainSignupEventType, + String eventActionInfo) { + if (postToDatabase) { + UsageSession usageSession = UsageSessionService.getSession(); + if (eventActionInfo != null && eventActionInfo.length() >= 256) { + /* truncate it due to DB field size(255) constraint */ + eventActionInfo = eventActionInfo.substring(0, 252) + "..."; + } + EventTrackingService.post(EventTrackingService.newEvent( + mainSignupEventType, eventActionInfo, false), usageSession); + } + + } + + /** + * It will obtain user current sign-up status in an event. + * + * @param meeting + * a SignupMeeting object + * @param currentUserId + * a unique user internal id. + * @param sakaiFacade + * a SakaiFacade object + * @return a String object + */ + public static String retrieveAvailStatus(SignupMeeting meeting, + String currentUserId, SakaiFacade sakaiFacade) { + long curTime = (new Date()).getTime(); + long meetingStartTime = meeting.getStartTime().getTime(); + long meetingEndTime = meeting.getEndTime().getTime(); + long meetingSignupBegin = meeting.getSignupBegins().getTime(); + if (meetingEndTime < curTime) + return rb.getString("event.closed"); + if (meetingEndTime > curTime && meetingStartTime < curTime) + return rb.getString("event.inProgress"); + + if (meeting.getMeetingType().equals(SignupMeeting.ANNOUNCEMENT)) { + return rb.getString("event.SignupNotRequire"); + } + + String availableStatus = rb.getString("event.unavailable"); + boolean isSignupBegin = true; + if (meetingSignupBegin > curTime) { + isSignupBegin = false; + availableStatus = rb.getString("event.Signup.not.started.yet") + + " " + + sakaiFacade.getTimeService().newTime( + meeting.getSignupBegins().getTime()) + .toStringLocalShortDate(); + } + + boolean isOnWaitingList = false; + boolean isMeetingSpaceAvail = false; + List<SignupTimeslot> signupTimeSlots = meeting.getSignupTimeSlots(); + for (SignupTimeslot timeslot : signupTimeSlots) { + List<SignupAttendee> attendees = timeslot.getAttendees(); + for (SignupAttendee attendee : attendees) { + if (attendee.getAttendeeUserId().equals(currentUserId)) + return rb.getString("event.youSignedUp"); + } + + List<SignupAttendee> waiters = timeslot.getWaitingList(); + if (!isOnWaitingList) { + for (SignupAttendee waiter : waiters) { + if (waiter.getAttendeeUserId().equals(currentUserId)) { + availableStatus = rb.getString("event.youOnWaitList"); + isOnWaitingList = true; + break; + } + } + } + + int size = (attendees == null) ? 0 : attendees.size(); + if (!isOnWaitingList + && isSignupBegin + && !timeslot.isLocked() + && !timeslot.isCanceled() + && (size < timeslot.getMaxNoOfAttendees() || timeslot + .getMaxNoOfAttendees() == SignupTimeslot.UNLIMITED)) { + availableStatus = rb.getString("event.available"); + isMeetingSpaceAvail =true; + } + } + + if(isMeetingSpaceAvail && meeting.isLocked()){ + availableStatus = rb.getString("event.meeting.locked"); + } + + return availableStatus; + } + + /** + * This method will convert int days to a Date object + * + * @param days + * it indicates how many days from current time into the future + * @return a Date object + */ + public static Date getUserDefinedDate(int days) { + Calendar cal = Calendar.getInstance(); + cal.setTime(new Date()); + cal.add(Calendar.HOUR, 24 * days); + return cal.getTime(); + } + + public static String getSignupConfigParamVal(String paramName, String defaultValue) { + /* first look at sakai.properties and the tool bundle*/ + String myConfigValue=defaultValue; + if (paramName != null) { + try { + myConfigValue = ServerConfigurationService.getString(paramName); + if(myConfigValue ==null || myConfigValue.trim().length() < 1){ + myConfigValue = rbConf.getString(paramName); + int index = myConfigValue.indexOf("missing key");/*return value by rb if no key defined-- hard coded!!!*/ + if (index >=0) + myConfigValue = defaultValue; + } + } catch (Exception e) { + myConfigValue = defaultValue; + } + } + + return myConfigValue; + + } + + /** + * Gets a boolean value for a configuration, instead of a string value. + * @param paramname the name of the config parameter + * @param defaultValue the default boolean value to use + * @return <code>true</code> if and only if the config parameter is <code>"true"</code>. + */ + public static boolean getSignupConfigParamVal(final String paramname, final boolean defaultValue) { + String stringValue = getSignupConfigParamVal(paramname, String.valueOf(defaultValue)); + return "true".equalsIgnoreCase(stringValue); + } + + public static boolean isDataIntegritySafe(boolean isUserDefinedTS, String callerBeanType, UserDefineTimeslotBean uBean){ + if(isUserDefinedTS && !callerBeanType.equals(uBean.getPlaceOrderBean())){ + Utilities.addErrorMessage("You may have opened multiple Tabs in your browser, please close them and try again.");// Utilities.rb.getString("event_endtime_auto_adjusted_warning")); + return false; + } + return true; + } + + /** + * Turn list of signup users into list of ids for storage into db. + * SIGNUP-216 removed the restriction that an organizer cannot be in this list (unsure why they couldnt since they have the option of being chosen but are then removed?) + * @param coordinators + * @param organizerId + * @return + */ + public static String getSelectedCoordinators(List<SignupUser> coordinators, String organizerId){ + StringBuilder sb = new StringBuilder(); + boolean isFirst = true; + for (SignupUser co : coordinators) { + if(co.isChecked()){ + if(isFirst){ + sb.append(co.getInternalUserId()); + isFirst = false; + }else{ + //safeguard -db column max size, hardly have over 10 coordinators per meeting + //SS note, this would still blow the DB limit since the check was for up to 1000, and then adding text to that + //and the limit is 1000 (why was this number chosen and why wasn't this list normalised?) + //so the limit has been lowered to 950 to be safer. + if(sb.length() < 950) + sb.append("|" + co.getInternalUserId()); + } + } + } + return sb.length()<1? null : sb.toString(); + } +} diff --git a/simple-rss-portlet/src/main/java/au/edu/anu/portal/portlets/rss/SimpleRSSPortlet.java b/simple-rss-portlet/src/main/java/au/edu/anu/portal/portlets/rss/SimpleRSSPortlet.java index 807f2d7635b3..5d3d1a0fb7a8 100644 --- a/simple-rss-portlet/src/main/java/au/edu/anu/portal/portlets/rss/SimpleRSSPortlet.java +++ b/simple-rss-portlet/src/main/java/au/edu/anu/portal/portlets/rss/SimpleRSSPortlet.java @@ -42,8 +42,8 @@ import org.apache.commons.lang.StringEscapeUtils; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import au.edu.anu.portal.portlets.rss.model.Attachment; import au.edu.anu.portal.portlets.rss.utils.Constants; diff --git a/site-manage/pageorder/tool/src/java/org/sakaiproject/site/tool/helper/order/rsf/ErrorUtil.java b/site-manage/pageorder/tool/src/java/org/sakaiproject/site/tool/helper/order/rsf/ErrorUtil.java index 8665759479e1..a9bc056fe67c 100644 --- a/site-manage/pageorder/tool/src/java/org/sakaiproject/site/tool/helper/order/rsf/ErrorUtil.java +++ b/site-manage/pageorder/tool/src/java/org/sakaiproject/site/tool/helper/order/rsf/ErrorUtil.java @@ -3,20 +3,20 @@ */ package org.sakaiproject.site.tool.helper.order.rsf; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import uk.org.ponder.rsf.components.UIBranchContainer; import uk.org.ponder.rsf.components.UIContainer; import uk.org.ponder.rsf.components.UIOutput; public class ErrorUtil { - private static Log M_log = LogFactory.getLog(PageListProducer.class); + private static Logger M_log = LoggerFactory.getLogger(PageListProducer.class); public static final void renderError(UIContainer tofill, Exception e) { UIBranchContainer mode = UIBranchContainer.make(tofill, "mode-failed:"); UIOutput.make(mode, "message", e.getLocalizedMessage()); - M_log.warn(e); + M_log.warn(e.getMessage()); } } diff --git a/site-manage/site-association-tool/tool/src/java/org/sakaiproject/siteassociation/tool/helper/siteAssoc/SiteAssociationBean.java b/site-manage/site-association-tool/tool/src/java/org/sakaiproject/siteassociation/tool/helper/siteAssoc/SiteAssociationBean.java index f06fb1d29b4f..0b61af43c870 100644 --- a/site-manage/site-association-tool/tool/src/java/org/sakaiproject/siteassociation/tool/helper/siteAssoc/SiteAssociationBean.java +++ b/site-manage/site-association-tool/tool/src/java/org/sakaiproject/siteassociation/tool/helper/siteAssoc/SiteAssociationBean.java @@ -27,8 +27,8 @@ import java.util.Iterator; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.exception.IdUnusedException; import org.sakaiproject.site.api.Site; import org.sakaiproject.site.api.SiteService; @@ -45,8 +45,7 @@ public class SiteAssociationBean extends BaseBean { // Sort strings static final String ID = "id", TITLE = "title"; - private static final Log logger = LogFactory - .getLog(SiteAssociationBean.class); + private static final Logger logger = LoggerFactory.getLogger(SiteAssociationBean.class); // Pager sitesPager; See GM-47 diff --git a/site-manage/site-association-util/util/src/java/org/sakaiproject/siteassociation/tool/servlet/SiteAssocJsfTool.java b/site-manage/site-association-util/util/src/java/org/sakaiproject/siteassociation/tool/servlet/SiteAssocJsfTool.java index c5431f6d6f30..2d44a902f573 100644 --- a/site-manage/site-association-util/util/src/java/org/sakaiproject/siteassociation/tool/servlet/SiteAssocJsfTool.java +++ b/site-manage/site-association-util/util/src/java/org/sakaiproject/siteassociation/tool/servlet/SiteAssocJsfTool.java @@ -31,8 +31,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.tool.api.ToolSession; import org.sakaiproject.tool.api.SessionManager; @@ -51,7 +51,7 @@ public class SiteAssocJsfTool extends JsfTool { */ private static final long serialVersionUID = -976719461956856669L; - private static final Log logger = LogFactory.getLog(SiteAssocJsfTool.class); + private static final Logger logger = LoggerFactory.getLogger(SiteAssocJsfTool.class); private SessionManager sessionManager; diff --git a/site-manage/site-manage-group-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroup/impl/SiteManageGroupHandler.java b/site-manage/site-manage-group-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroup/impl/SiteManageGroupHandler.java index 92006aebeb26..dd9a3774e77b 100644 --- a/site-manage/site-manage-group-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroup/impl/SiteManageGroupHandler.java +++ b/site-manage/site-manage-group-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroup/impl/SiteManageGroupHandler.java @@ -9,8 +9,8 @@ import java.util.Set; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroupService; import org.sakaiproject.authz.api.Member; import org.sakaiproject.authz.api.Role; @@ -40,7 +40,7 @@ public class SiteManageGroupHandler { /** Our log (commons). */ - private static final Log M_log = LogFactory.getLog(SiteManageGroupHandler.class); + private static final Logger M_log = LoggerFactory.getLogger(SiteManageGroupHandler.class); private Collection<Member> groupMembers; private final GroupComparator groupComparator = new GroupComparator(); @@ -187,7 +187,7 @@ public void init() { } catch (IdUnusedException e) { // The siteId we were given was bogus - M_log.warn( e ); + M_log.warn(e.getMessage()); } } title = ""; @@ -282,7 +282,7 @@ public String reset() { } catch (IdUnusedException | PermissionException e) { - M_log.warn( e ); + M_log.warn(e.getMessage()); } return ""; diff --git a/site-manage/site-manage-group-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroup/rsf/GroupDelProducer.java b/site-manage/site-manage-group-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroup/rsf/GroupDelProducer.java index 755ec109e65a..07b6713b5482 100644 --- a/site-manage/site-manage-group-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroup/rsf/GroupDelProducer.java +++ b/site-manage/site-manage-group-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroup/rsf/GroupDelProducer.java @@ -3,8 +3,8 @@ import java.util.Iterator; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroupService; import org.sakaiproject.authz.api.GroupNotDefinedException; import org.sakaiproject.site.api.Group; @@ -40,7 +40,7 @@ public class GroupDelProducer implements ViewComponentProducer, ActionResultInterceptor { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(GroupDelProducer.class); + private static Logger M_log = LoggerFactory.getLogger(GroupDelProducer.class); public static final String VIEW_ID = "GroupDel"; public MessageLocator messageLocator; diff --git a/site-manage/site-manage-group-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroup/rsf/GroupEditProducer.java b/site-manage/site-manage-group-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroup/rsf/GroupEditProducer.java index a9e6a77dc04b..f2d6f0473a1f 100644 --- a/site-manage/site-manage-group-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroup/rsf/GroupEditProducer.java +++ b/site-manage/site-manage-group-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroup/rsf/GroupEditProducer.java @@ -6,8 +6,8 @@ import java.util.List; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.Member; import org.sakaiproject.site.api.Group; import org.sakaiproject.site.api.SiteService; @@ -48,7 +48,7 @@ public class GroupEditProducer implements ViewComponentProducer, ActionResultInterceptor, ViewParamsReporter { /** Our log (commons). */ - private static final Log M_log = LogFactory.getLog(GroupEditProducer.class); + private static final Logger M_log = LoggerFactory.getLogger(GroupEditProducer.class); public SiteManageGroupHandler handler; public static final String VIEW_ID = "GroupEdit"; diff --git a/site-manage/site-manage-group-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroup/rsf/GroupListProducer.java b/site-manage/site-manage-group-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroup/rsf/GroupListProducer.java index 687c6161835c..e9e37a5b5c3b 100644 --- a/site-manage/site-manage-group-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroup/rsf/GroupListProducer.java +++ b/site-manage/site-manage-group-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroup/rsf/GroupListProducer.java @@ -5,8 +5,8 @@ import java.util.Map; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.site.api.Group; import org.sakaiproject.site.tool.helper.managegroup.impl.SiteManageGroupHandler; import org.sakaiproject.authz.api.AuthzGroup; @@ -54,7 +54,7 @@ public class GroupListProducer implements ViewComponentProducer, ActionResultInterceptor, DefaultView { /** Our log (commons). */ - private static final Log M_log = LogFactory.getLog(GroupListProducer.class); + private static final Logger M_log = LoggerFactory.getLogger(GroupListProducer.class); public static final String VIEW_ID = "GroupList"; public Map siteGroups; diff --git a/site-manage/site-manage-group-section-role-helper/pack/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/impl/RoleGroupEventWatcher.java b/site-manage/site-manage-group-section-role-helper/pack/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/impl/RoleGroupEventWatcher.java index b2ad9fedbc6d..1b023db581fb 100644 --- a/site-manage/site-manage-group-section-role-helper/pack/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/impl/RoleGroupEventWatcher.java +++ b/site-manage/site-manage-group-section-role-helper/pack/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/impl/RoleGroupEventWatcher.java @@ -26,8 +26,8 @@ import java.util.Observer; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.lang.StringUtils; import org.sakaiproject.authz.api.AuthzGroup; import org.sakaiproject.authz.api.AuthzGroupService; @@ -59,7 +59,7 @@ public class RoleGroupEventWatcher implements Observer { - private static Log log = LogFactory.getLog(RoleGroupEventWatcher.class); + private static Logger log = LoggerFactory.getLogger(RoleGroupEventWatcher.class); /******************************************************************************* * Dependencies and their setter methods diff --git a/site-manage/site-manage-group-section-role-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/impl/SiteManageGroupSectionRoleHandler.java b/site-manage/site-manage-group-section-role-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/impl/SiteManageGroupSectionRoleHandler.java index bec24c6f9e1a..91e66cf15f6e 100644 --- a/site-manage/site-manage-group-section-role-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/impl/SiteManageGroupSectionRoleHandler.java +++ b/site-manage/site-manage-group-section-role-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/impl/SiteManageGroupSectionRoleHandler.java @@ -21,8 +21,8 @@ import org.apache.commons.fileupload.FileItem; import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroup; import org.sakaiproject.authz.api.AuthzGroupService; import org.sakaiproject.authz.api.GroupNotDefinedException; @@ -70,7 +70,7 @@ public class SiteManageGroupSectionRoleHandler { private static final String REQ_ATTR_GROUPFILE = "groupfile"; /** Our log (commons). */ - private static final Log M_log = LogFactory.getLog(SiteManageGroupSectionRoleHandler.class); + private static final Logger M_log = LoggerFactory.getLogger(SiteManageGroupSectionRoleHandler.class); private List<Member> groupMembers; private final GroupComparator groupComparator = new GroupComparator(); @@ -485,9 +485,9 @@ public void init() { siteId = sessionManager.getCurrentToolSession() .getAttribute(HELPER_ID + ".siteId").toString(); } - catch (java.lang.NullPointerException npe) { + catch (NullPointerException npe) { // Site ID wasn't set in the helper call!! - M_log.warn( npe ); + M_log.warn(npe.getMessage()); } if (siteId == null) { @@ -501,7 +501,7 @@ public void init() { } catch (IdUnusedException e) { // The siteId we were given was bogus - M_log.warn( e ); + M_log.warn(e.getMessage()); } } title = ""; @@ -595,7 +595,7 @@ public String reset() { } catch (IdUnusedException | PermissionException e) { - M_log.warn( e ); + M_log.warn(e.getMessage()); } return ""; @@ -845,7 +845,7 @@ public String processConfirmGroupDelete() } catch (Exception e) { - M_log.error( e ); + M_log.error(e.getMessage()); } } return "confirm"; @@ -1801,7 +1801,7 @@ private void saveSite() } catch( IdUnusedException | PermissionException ex ) { - M_log.error( ex ); + M_log.error(ex.getMessage()); } } diff --git a/site-manage/site-manage-group-section-role-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/rsf/CreateJoinableGroupsProducer.java b/site-manage/site-manage-group-section-role-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/rsf/CreateJoinableGroupsProducer.java index d452768c33d4..6a8be968b164 100644 --- a/site-manage/site-manage-group-section-role-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/rsf/CreateJoinableGroupsProducer.java +++ b/site-manage/site-manage-group-section-role-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/rsf/CreateJoinableGroupsProducer.java @@ -5,8 +5,8 @@ import java.util.List; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.site.api.Group; import org.sakaiproject.site.tool.helper.managegroupsectionrole.impl.SiteManageGroupSectionRoleHandler; import org.sakaiproject.user.api.User; @@ -40,7 +40,7 @@ public class CreateJoinableGroupsProducer implements ViewComponentProducer, ActionResultInterceptor, ViewParamsReporter{ public static final String VIEW_ID = "CreateJoinableGroups"; - private static final Log M_log = LogFactory.getLog(CreateJoinableGroupsProducer.class); + private static final Logger M_log = LoggerFactory.getLogger(CreateJoinableGroupsProducer.class); public SiteManageGroupSectionRoleHandler handler; public MessageLocator messageLocator; diff --git a/site-manage/site-manage-group-section-role-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/rsf/GroupAutoCreateProducer.java b/site-manage/site-manage-group-section-role-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/rsf/GroupAutoCreateProducer.java index e960f1bba5e9..89df2b6dbff9 100644 --- a/site-manage/site-manage-group-section-role-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/rsf/GroupAutoCreateProducer.java +++ b/site-manage/site-manage-group-section-role-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/rsf/GroupAutoCreateProducer.java @@ -2,8 +2,8 @@ import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.Role; import org.sakaiproject.site.api.Group; import org.sakaiproject.site.api.SiteService; @@ -47,7 +47,7 @@ public class GroupAutoCreateProducer implements ViewComponentProducer, ActionResultInterceptor, ViewParamsReporter { /** Our log (commons). */ - private static final Log M_log = LogFactory.getLog(GroupAutoCreateProducer.class); + private static final Logger M_log = LoggerFactory.getLogger(GroupAutoCreateProducer.class); public SiteManageGroupSectionRoleHandler handler; public static final String VIEW_ID = "GroupAutoCreate"; diff --git a/site-manage/site-manage-group-section-role-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/rsf/GroupDelProducer.java b/site-manage/site-manage-group-section-role-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/rsf/GroupDelProducer.java index 28e1de9e3318..caf013cdc228 100644 --- a/site-manage/site-manage-group-section-role-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/rsf/GroupDelProducer.java +++ b/site-manage/site-manage-group-section-role-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/rsf/GroupDelProducer.java @@ -6,8 +6,8 @@ import java.util.Locale; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroupService; import org.sakaiproject.authz.api.GroupNotDefinedException; import org.sakaiproject.site.api.Group; @@ -58,7 +58,7 @@ public class GroupDelProducer implements ViewComponentProducer, ActionResultInterceptor{ /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(GroupDelProducer.class); + private static Logger M_log = LoggerFactory.getLogger(GroupDelProducer.class); public static final String VIEW_ID = "GroupDel"; public MessageLocator messageLocator; diff --git a/site-manage/site-manage-group-section-role-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/rsf/GroupEditProducer.java b/site-manage/site-manage-group-section-role-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/rsf/GroupEditProducer.java index 914883c2f169..a357a18c3474 100644 --- a/site-manage/site-manage-group-section-role-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/rsf/GroupEditProducer.java +++ b/site-manage/site-manage-group-section-role-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/rsf/GroupEditProducer.java @@ -11,8 +11,8 @@ import java.util.Set; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.Member; import org.sakaiproject.authz.api.Role; import org.sakaiproject.site.api.Group; @@ -57,7 +57,7 @@ public class GroupEditProducer implements ViewComponentProducer, ActionResultInterceptor, ViewParamsReporter{ /** Our log (commons). */ - private static final Log M_log = LogFactory.getLog(GroupEditProducer.class); + private static final Logger M_log = LoggerFactory.getLogger(GroupEditProducer.class); private static final String SECTION_PREFIX = "Section: "; private static final String ROLE_PREFIX = "Role: "; diff --git a/site-manage/site-manage-group-section-role-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/rsf/GroupImportStep1Producer.java b/site-manage/site-manage-group-section-role-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/rsf/GroupImportStep1Producer.java index 22dad1497689..e9b7f61d9ab7 100644 --- a/site-manage/site-manage-group-section-role-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/rsf/GroupImportStep1Producer.java +++ b/site-manage/site-manage-group-section-role-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/rsf/GroupImportStep1Producer.java @@ -4,8 +4,8 @@ import java.util.List; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.site.tool.helper.managegroupsectionrole.impl.SiteManageGroupSectionRoleHandler; import org.sakaiproject.tool.api.SessionManager; import org.sakaiproject.tool.api.Tool; @@ -36,7 +36,7 @@ */ public class GroupImportStep1Producer implements ViewComponentProducer, NavigationCaseReporter, ViewParamsReporter, ActionResultInterceptor { - private static Log M_log = LogFactory.getLog(GroupImportStep1Producer.class); + private static Logger M_log = LoggerFactory.getLogger(GroupImportStep1Producer.class); public SiteManageGroupSectionRoleHandler handler; public static final String VIEW_ID = "GroupImportStep1"; public MessageLocator messageLocator; diff --git a/site-manage/site-manage-group-section-role-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/rsf/GroupImportStep2Producer.java b/site-manage/site-manage-group-section-role-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/rsf/GroupImportStep2Producer.java index 21c158feb5a3..2c847c5d308a 100644 --- a/site-manage/site-manage-group-section-role-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/rsf/GroupImportStep2Producer.java +++ b/site-manage/site-manage-group-section-role-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/rsf/GroupImportStep2Producer.java @@ -8,8 +8,8 @@ import java.util.Set; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.site.api.Group; import org.sakaiproject.site.tool.helper.managegroupsectionrole.impl.ImportedGroup; import org.sakaiproject.site.tool.helper.managegroupsectionrole.impl.SiteManageGroupSectionRoleHandler; @@ -43,7 +43,7 @@ */ public class GroupImportStep2Producer implements ViewComponentProducer, NavigationCaseReporter, ViewParamsReporter, ActionResultInterceptor { - private static Log M_log = LogFactory.getLog(GroupImportStep2Producer.class); + private static Logger M_log = LoggerFactory.getLogger(GroupImportStep2Producer.class); public SiteManageGroupSectionRoleHandler handler; public static final String VIEW_ID = "GroupImportStep2"; public MessageLocator messageLocator; diff --git a/site-manage/site-manage-group-section-role-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/rsf/GroupListProducer.java b/site-manage/site-manage-group-section-role-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/rsf/GroupListProducer.java index 7d9f1aec0cde..a277328377af 100644 --- a/site-manage/site-manage-group-section-role-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/rsf/GroupListProducer.java +++ b/site-manage/site-manage-group-section-role-helper/tool/src/java/org/sakaiproject/site/tool/helper/managegroupsectionrole/rsf/GroupListProducer.java @@ -7,8 +7,8 @@ import java.util.ArrayList; import java.util.Collections; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroup; import org.sakaiproject.authz.api.AuthzGroupService; import org.sakaiproject.authz.api.GroupNotDefinedException; @@ -59,7 +59,7 @@ public class GroupListProducer implements ViewComponentProducer, ActionResultInterceptor, DefaultView { /** Our log (commons). */ - private static final Log M_log = LogFactory.getLog(GroupListProducer.class); + private static final Logger M_log = LoggerFactory.getLogger(GroupListProducer.class); public static final String VIEW_ID = "GroupList"; public Map siteGroups; diff --git a/site-manage/site-manage-impl/impl/src/java/org/sakaiproject/sitemanage/impl/AffiliatedSectionProviderImpl.java b/site-manage/site-manage-impl/impl/src/java/org/sakaiproject/sitemanage/impl/AffiliatedSectionProviderImpl.java index 1444ba24a3c0..b170c513ad59 100644 --- a/site-manage/site-manage-impl/impl/src/java/org/sakaiproject/sitemanage/impl/AffiliatedSectionProviderImpl.java +++ b/site-manage/site-manage-impl/impl/src/java/org/sakaiproject/sitemanage/impl/AffiliatedSectionProviderImpl.java @@ -22,8 +22,8 @@ import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.sitemanage.api.AffiliatedSectionProvider; /** @@ -33,7 +33,7 @@ public class AffiliatedSectionProviderImpl implements AffiliatedSectionProvider { - private static final Log log = LogFactory.getLog(AffiliatedSectionProviderImpl.class); + private static final Logger log = LoggerFactory.getLogger(AffiliatedSectionProviderImpl.class); public List getAffiliatedSectionEids(String userEid, String academicSessionEid) { diff --git a/site-manage/site-manage-impl/impl/src/java/org/sakaiproject/sitemanage/impl/ETSUserNotificationProviderImpl.java b/site-manage/site-manage-impl/impl/src/java/org/sakaiproject/sitemanage/impl/ETSUserNotificationProviderImpl.java index 1399134c176b..d9ddd605631d 100644 --- a/site-manage/site-manage-impl/impl/src/java/org/sakaiproject/sitemanage/impl/ETSUserNotificationProviderImpl.java +++ b/site-manage/site-manage-impl/impl/src/java/org/sakaiproject/sitemanage/impl/ETSUserNotificationProviderImpl.java @@ -12,8 +12,8 @@ import java.util.Locale; import org.apache.commons.lang.LocaleUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.jdom.Document; import org.jdom.Element; import org.jdom.JDOMException; @@ -36,7 +36,7 @@ public class ETSUserNotificationProviderImpl implements UserNotificationProvider { - private static final Log M_log = LogFactory.getLog(ETSUserNotificationProviderImpl.class); + private static final Logger M_log = LoggerFactory.getLogger(ETSUserNotificationProviderImpl.class); private static final String NOTIFY_ADDED_PARTICIPANT ="sitemange.notifyAddedParticipant"; @@ -404,7 +404,7 @@ private void loadTemplate(String templateFileName, String templateRegistrationSt xmlToTemplate(xmlTemplate, templateRegistrationString); } } catch (IOException | JDOMException e) { - M_log.warn( e ); + M_log.warn(e.getMessage()); } finally { diff --git a/site-manage/site-manage-impl/impl/src/java/org/sakaiproject/sitemanage/impl/SectionFieldProviderImpl.java b/site-manage/site-manage-impl/impl/src/java/org/sakaiproject/sitemanage/impl/SectionFieldProviderImpl.java index bf504b88998c..eff2bc6703b3 100644 --- a/site-manage/site-manage-impl/impl/src/java/org/sakaiproject/sitemanage/impl/SectionFieldProviderImpl.java +++ b/site-manage/site-manage-impl/impl/src/java/org/sakaiproject/sitemanage/impl/SectionFieldProviderImpl.java @@ -23,15 +23,15 @@ import java.util.ArrayList; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.sitemanage.api.SectionField; import org.sakaiproject.sitemanage.api.SectionFieldProvider; import org.sakaiproject.util.ResourceLoader; import org.sakaiproject.component.api.ServerConfigurationService; public class SectionFieldProviderImpl implements SectionFieldProvider { - private static final Log log = LogFactory.getLog(SectionFieldProviderImpl.class); + private static final Logger log = LoggerFactory.getLogger(SectionFieldProviderImpl.class); private static ServerConfigurationService serverConfigurationService; public void setServerConfigurationService(ServerConfigurationService serverConfigurationService) { diff --git a/site-manage/site-manage-impl/impl/src/java/org/sakaiproject/sitemanage/impl/SiteSetupQuestionServiceImpl.java b/site-manage/site-manage-impl/impl/src/java/org/sakaiproject/sitemanage/impl/SiteSetupQuestionServiceImpl.java index 0a720e9d17e2..9a1662d231da 100644 --- a/site-manage/site-manage-impl/impl/src/java/org/sakaiproject/sitemanage/impl/SiteSetupQuestionServiceImpl.java +++ b/site-manage/site-manage-impl/impl/src/java/org/sakaiproject/sitemanage/impl/SiteSetupQuestionServiceImpl.java @@ -28,8 +28,8 @@ import java.util.HashSet; import java.util.Vector; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.Criteria; import org.hibernate.Session; @@ -52,14 +52,14 @@ public class SiteSetupQuestionServiceImpl extends HibernateDaoSupport implements private static final String QUERY_ANSWER_BY_ID = "findAnswerById"; - private final static Log Log = LogFactory.getLog(SiteSetupQuestionServiceImpl.class); + private final static Logger Logger = LoggerFactory.getLogger(SiteSetupQuestionServiceImpl.class); /** * Init */ public void init() { - Log.info("init()"); + Logger.info("init()"); } /** @@ -67,7 +67,7 @@ public void init() */ public void destroy() { - Log.info("destroy()"); + Logger.info("destroy()"); } /** @@ -155,7 +155,7 @@ public boolean saveSiteSetupQuestion(SiteSetupQuestion q) catch (DataAccessException e) { e.printStackTrace(); - Log.warn(this + ".saveSiteSetupQuestion() Hibernate could not save. question=" + q.getQuestion()); + Logger.warn(this + ".saveSiteSetupQuestion() Hibernate could not save. question=" + q.getQuestion()); return false; } } @@ -173,9 +173,7 @@ public boolean removeSiteSetupQuestion(SiteSetupQuestion question) } catch (DataAccessException e) { - e.printStackTrace(); - if(Log.isErrorEnabled()) - Log.error(this + ".removeSiteSetupQuestion() Hibernate could not delete: question=" + question.getQuestion() ); + Logger.error("Hibernate could not delete: question={}", question.getQuestion(), e); return false; } } @@ -204,8 +202,7 @@ public boolean saveSiteSetupQuestionAnswer(SiteSetupQuestionAnswer answer) } catch (DataAccessException e) { - e.printStackTrace(); - Log.warn(this + ".saveSiteSetupQuestionAnswer() Hibernate could not save. answer=" + answer.getAnswer()); + Logger.warn("Hibernate could not save. answer={}", answer.getAnswer(), e); return false; } } @@ -223,9 +220,7 @@ public boolean removeSiteSetupQuestionAnswer(SiteSetupQuestionAnswer answer) } catch (DataAccessException e) { - e.printStackTrace(); - if(Log.isErrorEnabled()) - Log.error(this + ".removeSiteSetupQuestionAnswer() Hibernate could not delete: answer=" + answer.getAnswer()); + Logger.error("Hibernate could not delete: answer={}", answer.getAnswer(), e); return false; } } @@ -254,8 +249,7 @@ public boolean saveSiteTypeQuestions(SiteTypeQuestions siteTypeQuestions) } catch (DataAccessException e) { - e.printStackTrace(); - Log.warn(this + ".saveSiteTypeQuestions() Hibernate could not save. siteType=" + siteTypeQuestions.getSiteType()); + Logger.warn("Hibernate could not save. siteType={}", siteTypeQuestions.getSiteType()); return false; } } @@ -273,9 +267,7 @@ public boolean removeSiteTypeQuestions(SiteTypeQuestions siteTypeQuestions) } catch (DataAccessException e) { - e.printStackTrace(); - if(Log.isErrorEnabled()) - Log.error(this + ".removeSiteTypeQuestions() Hibernate could not delete: siteType=" + siteTypeQuestions.getSiteType()); + Logger.error("Hibernate could not delete: siteType={}", siteTypeQuestions.getSiteType(), e); return false; } } @@ -304,8 +296,7 @@ public boolean saveSiteSetupUserAnswer(SiteSetupUserAnswer siteSetupUserAnswer) } catch (DataAccessException e) { - e.printStackTrace(); - Log.warn(this + ".saveSiteSetupUserAnswer() Hibernate could not save. Site=" + siteSetupUserAnswer.getSiteId() + " user=" + siteSetupUserAnswer.getUserId() + " question=" + siteSetupUserAnswer.getQuestionId()); + Logger.warn("Hibernate could not save. Site={} user={} question={}", siteSetupUserAnswer.getSiteId(), siteSetupUserAnswer.getUserId(), siteSetupUserAnswer.getQuestionId(), e); return false; } } @@ -323,9 +314,7 @@ public boolean removeSiteSetupUserAnswer(SiteSetupUserAnswer siteSetupUserAnswer } catch (DataAccessException e) { - e.printStackTrace(); - if(Log.isErrorEnabled()) - Log.error(this + ".deleteSiteSetupUserAnswer() Hibernate could not delete: Site=" + siteSetupUserAnswer.getSiteId() + " user=" + siteSetupUserAnswer.getUserId() + " question=" + siteSetupUserAnswer.getQuestionId()); + Logger.error("Hibernate could not delete: Site={} user={} question={}", siteSetupUserAnswer.getSiteId(), siteSetupUserAnswer.getUserId(), siteSetupUserAnswer.getQuestionId()); return false; } } diff --git a/site-manage/site-manage-impl/impl/src/java/org/sakaiproject/sitemanage/impl/SiteTypeProviderImpl.java b/site-manage/site-manage-impl/impl/src/java/org/sakaiproject/sitemanage/impl/SiteTypeProviderImpl.java index 4542cd4e1bcd..fc1fd660f347 100644 --- a/site-manage/site-manage-impl/impl/src/java/org/sakaiproject/sitemanage/impl/SiteTypeProviderImpl.java +++ b/site-manage/site-manage-impl/impl/src/java/org/sakaiproject/sitemanage/impl/SiteTypeProviderImpl.java @@ -28,8 +28,8 @@ import java.util.HashMap; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.site.cover.SiteService; @@ -44,7 +44,7 @@ public class SiteTypeProviderImpl implements org.sakaiproject.sitemanage.api.SiteTypeProvider { - private static final Log log = LogFactory.getLog(SiteTypeProviderImpl.class); + private static final Logger log = LoggerFactory.getLogger(SiteTypeProviderImpl.class); private static ResourceLoader rb = new ResourceLoader("SiteTypeProvider"); diff --git a/site-manage/site-manage-impl/impl/src/java/org/sakaiproject/sitemanage/impl/UserNotificationProviderImpl.java b/site-manage/site-manage-impl/impl/src/java/org/sakaiproject/sitemanage/impl/UserNotificationProviderImpl.java index d7936dc153f4..acd1f8ab17dd 100644 --- a/site-manage/site-manage-impl/impl/src/java/org/sakaiproject/sitemanage/impl/UserNotificationProviderImpl.java +++ b/site-manage/site-manage-impl/impl/src/java/org/sakaiproject/sitemanage/impl/UserNotificationProviderImpl.java @@ -8,8 +8,8 @@ import java.util.HashMap; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.coursemanagement.api.AcademicSession; import org.sakaiproject.email.api.EmailService; @@ -26,7 +26,7 @@ public class UserNotificationProviderImpl implements UserNotificationProvider { - private static Log M_log = LogFactory.getLog(UserNotificationProviderImpl.class); + private static Logger M_log = LoggerFactory.getLogger(UserNotificationProviderImpl.class); private EmailService emailService; public void setEmailService(EmailService es) { diff --git a/site-manage/site-manage-link-helper/src/java/org/sakaiproject/site/tool/LinkAction.java b/site-manage/site-manage-link-helper/src/java/org/sakaiproject/site/tool/LinkAction.java index ae40ecb68946..63eef30461d0 100644 --- a/site-manage/site-manage-link-helper/src/java/org/sakaiproject/site/tool/LinkAction.java +++ b/site-manage/site-manage-link-helper/src/java/org/sakaiproject/site/tool/LinkAction.java @@ -31,8 +31,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroup; import org.sakaiproject.authz.api.GroupNotDefinedException; import org.sakaiproject.authz.api.Role; @@ -80,7 +80,7 @@ public class LinkAction extends VelocityPortletPaneledAction /** Name of state attribute for Site instance id */ private static final String STATE_SITE_INSTANCE_ID = "site.instance.id"; - private static final Log logger = LogFactory.getLog(LinkAction.class); + private static final Logger logger = LoggerFactory.getLogger(LinkAction.class); /** * Get the current site page our current tool is placed on. diff --git a/site-manage/site-manage-participant-helper/src/java/org/sakaiproject/site/tool/helper/participant/impl/SiteAddParticipantHandler.java b/site-manage/site-manage-participant-helper/src/java/org/sakaiproject/site/tool/helper/participant/impl/SiteAddParticipantHandler.java index 02a159cc1471..deaeedda159f 100644 --- a/site-manage/site-manage-participant-helper/src/java/org/sakaiproject/site/tool/helper/participant/impl/SiteAddParticipantHandler.java +++ b/site-manage/site-manage-participant-helper/src/java/org/sakaiproject/site/tool/helper/participant/impl/SiteAddParticipantHandler.java @@ -12,8 +12,8 @@ import org.apache.commons.collections.Predicate; import org.apache.commons.lang.ArrayUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.validator.EmailValidator; import org.apache.commons.lang.StringUtils; @@ -61,7 +61,7 @@ public class SiteAddParticipantHandler { /** Our log (commons). */ - private static final Log M_log = LogFactory.getLog(SiteAddParticipantHandler.class); + private static final Logger M_log = LoggerFactory.getLogger(SiteAddParticipantHandler.class); private static final String EMAIL_CHAR = "@"; public SiteService siteService = null; @@ -591,7 +591,7 @@ private List<String> addUsersRealm( boolean notify) { addedUserEIds.add(eId); addedUserInfos.add("uid=" + user.getId() + ";role=" + role + ";active=" + statusChoice.equals("active") + ";provided=false;siteId=" + site.getId()); - // Add the user to the list for the User Auditing Event Log + // Add the user to the list for the User Auditing Event Logger String currentUserId = userDirectoryService.getUserEid(sessionManager.getCurrentSessionUserId()); String[] userAuditString = {site.getId(),eId,role,UserAuditService.USER_AUDIT_ACTION_ADD,userAuditRegistration.getDatabaseSourceKey(),currentUserId}; userAuditList.add(userAuditString); diff --git a/site-manage/site-manage-participant-helper/src/java/org/sakaiproject/site/tool/helper/participant/rsf/AddProducer.java b/site-manage/site-manage-participant-helper/src/java/org/sakaiproject/site/tool/helper/participant/rsf/AddProducer.java index 05d444bc7af0..ee2ef7868e20 100644 --- a/site-manage/site-manage-participant-helper/src/java/org/sakaiproject/site/tool/helper/participant/rsf/AddProducer.java +++ b/site-manage/site-manage-participant-helper/src/java/org/sakaiproject/site/tool/helper/participant/rsf/AddProducer.java @@ -3,8 +3,8 @@ import java.util.ArrayList; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.site.tool.helper.participant.impl.SiteAddParticipantHandler; import org.sakaiproject.tool.api.SessionManager; @@ -48,7 +48,7 @@ public class AddProducer implements ViewComponentProducer, NavigationCaseReporter, DefaultView, ViewParamsReporter, ActionResultInterceptor { /** Our log (commons). */ - private static final Log M_log = LogFactory.getLog(AddProducer.class); + private static final Logger M_log = LoggerFactory.getLogger(AddProducer.class); public SiteAddParticipantHandler handler; public static final String VIEW_ID = "Add"; diff --git a/site-manage/site-manage-participant-helper/src/java/org/sakaiproject/site/tool/helper/participant/rsf/ConfirmProducer.java b/site-manage/site-manage-participant-helper/src/java/org/sakaiproject/site/tool/helper/participant/rsf/ConfirmProducer.java index 6d1edd3ea77a..1a432e28fdf6 100644 --- a/site-manage/site-manage-participant-helper/src/java/org/sakaiproject/site/tool/helper/participant/rsf/ConfirmProducer.java +++ b/site-manage/site-manage-participant-helper/src/java/org/sakaiproject/site/tool/helper/participant/rsf/ConfirmProducer.java @@ -3,8 +3,8 @@ import java.util.ArrayList; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.api.SessionManager; import org.sakaiproject.tool.api.Tool; import org.sakaiproject.entitybroker.DeveloperHelperService; @@ -47,7 +47,7 @@ public class ConfirmProducer implements ViewComponentProducer, NavigationCaseReporter, ActionResultInterceptor { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(ConfirmProducer.class); + private static Logger M_log = LoggerFactory.getLogger(ConfirmProducer.class); public SiteAddParticipantHandler handler; public static final String VIEW_ID = "Confirm"; diff --git a/site-manage/site-manage-participant-helper/src/java/org/sakaiproject/site/tool/helper/participant/rsf/DifferentRoleProducer.java b/site-manage/site-manage-participant-helper/src/java/org/sakaiproject/site/tool/helper/participant/rsf/DifferentRoleProducer.java index 459416a99568..3fa74392b652 100644 --- a/site-manage/site-manage-participant-helper/src/java/org/sakaiproject/site/tool/helper/participant/rsf/DifferentRoleProducer.java +++ b/site-manage/site-manage-participant-helper/src/java/org/sakaiproject/site/tool/helper/participant/rsf/DifferentRoleProducer.java @@ -5,8 +5,8 @@ import java.util.List; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.Role; import org.sakaiproject.site.api.SiteService; import org.sakaiproject.site.tool.helper.participant.impl.SiteAddParticipantHandler; @@ -48,7 +48,7 @@ public class DifferentRoleProducer implements ViewComponentProducer, NavigationCaseReporter, ActionResultInterceptor{ /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(DifferentRoleProducer.class); + private static Logger M_log = LoggerFactory.getLogger(DifferentRoleProducer.class); public SiteAddParticipantHandler handler; public static final String VIEW_ID = "DifferentRole"; diff --git a/site-manage/site-manage-participant-helper/src/java/org/sakaiproject/site/tool/helper/participant/rsf/EmailNotiProducer.java b/site-manage/site-manage-participant-helper/src/java/org/sakaiproject/site/tool/helper/participant/rsf/EmailNotiProducer.java index 8a04e6dfdb16..5b29c9cd14ff 100644 --- a/site-manage/site-manage-participant-helper/src/java/org/sakaiproject/site/tool/helper/participant/rsf/EmailNotiProducer.java +++ b/site-manage/site-manage-participant-helper/src/java/org/sakaiproject/site/tool/helper/participant/rsf/EmailNotiProducer.java @@ -3,8 +3,8 @@ import java.util.ArrayList; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.entitybroker.DeveloperHelperService; import org.sakaiproject.exception.IdUnusedException; import org.sakaiproject.site.api.Site; @@ -49,7 +49,7 @@ public class EmailNotiProducer implements ViewComponentProducer, NavigationCaseReporter, ActionResultInterceptor { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(EmailNotiProducer.class); + private static Logger M_log = LoggerFactory.getLogger(EmailNotiProducer.class); public SiteAddParticipantHandler handler; public static final String VIEW_ID = "EmailNoti"; diff --git a/site-manage/site-manage-participant-helper/src/java/org/sakaiproject/site/tool/helper/participant/rsf/SameRoleProducer.java b/site-manage/site-manage-participant-helper/src/java/org/sakaiproject/site/tool/helper/participant/rsf/SameRoleProducer.java index 73edd84a157b..2a592062c58c 100644 --- a/site-manage/site-manage-participant-helper/src/java/org/sakaiproject/site/tool/helper/participant/rsf/SameRoleProducer.java +++ b/site-manage/site-manage-participant-helper/src/java/org/sakaiproject/site/tool/helper/participant/rsf/SameRoleProducer.java @@ -6,8 +6,8 @@ import java.util.Vector; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.Role; import org.sakaiproject.site.api.SiteService; import org.sakaiproject.site.tool.helper.participant.impl.SiteAddParticipantHandler; @@ -53,7 +53,7 @@ public class SameRoleProducer implements ViewComponentProducer, NavigationCaseReporter, ActionResultInterceptor { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(SameRoleProducer.class); + private static Logger M_log = LoggerFactory.getLogger(SameRoleProducer.class); public SiteAddParticipantHandler handler; public static final String VIEW_ID = "SameRole"; diff --git a/site-manage/site-manage-tool/tool/src/java/org/sakaiproject/site/tool/JoinableSiteSettings.java b/site-manage/site-manage-tool/tool/src/java/org/sakaiproject/site/tool/JoinableSiteSettings.java index 095e1b5d3bf0..e29006888f10 100644 --- a/site-manage/site-manage-tool/tool/src/java/org/sakaiproject/site/tool/JoinableSiteSettings.java +++ b/site-manage/site-manage-tool/tool/src/java/org/sakaiproject/site/tool/JoinableSiteSettings.java @@ -12,8 +12,8 @@ import java.util.Map; import java.util.Set; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.cheftool.Context; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.component.cover.ComponentManager; @@ -43,7 +43,7 @@ public class JoinableSiteSettings { // Logger - private static final Log log = LogFactory.getLog( JoinableSiteSettings.class ); + private static final Logger log = LoggerFactory.getLogger( JoinableSiteSettings.class ); // API's private static final UserDirectoryService userDirectoryService = (UserDirectoryService) ComponentManager.get( UserDirectoryService.class ); diff --git a/site-manage/site-manage-tool/tool/src/java/org/sakaiproject/site/tool/MembershipAction.java b/site-manage/site-manage-tool/tool/src/java/org/sakaiproject/site/tool/MembershipAction.java index 02bfa22a5763..917f007d18cc 100644 --- a/site-manage/site-manage-tool/tool/src/java/org/sakaiproject/site/tool/MembershipAction.java +++ b/site-manage/site-manage-tool/tool/src/java/org/sakaiproject/site/tool/MembershipAction.java @@ -28,6 +28,7 @@ import java.util.Map; import java.util.Vector; +import lombok.extern.slf4j.Slf4j; import org.sakaiproject.cheftool.Context; import org.sakaiproject.cheftool.JetspeedRunData; import org.sakaiproject.cheftool.PagedResourceActionII; @@ -58,6 +59,7 @@ * MembershipAction is a tool which displays Sites and lets the user join and un-join joinable Sites. * </p> */ +@Slf4j public class MembershipAction extends PagedResourceActionII { private static String STATE_VIEW_MODE = "state_view"; @@ -265,7 +267,7 @@ public String buildMainPanelContext(VelocityPortlet portlet, Context context, Ru } catch( IdNotFoundException ex ) { - Log.warn( "MembershipAction.buildMainPanelContext: cannot find section " + providerID, ex.getMessage() ); + log.warn( "cannot find section {}, {}", providerID, ex.getMessage()); } } @@ -355,7 +357,7 @@ public String buildUnjoinconfirmContext(VelocityPortlet portlet, Context context } catch (IdUnusedException e) { - Log.warn("chef", this + ".buildUnjoinconfirmContext(): " + e); + log.warn(e.getMessage()); } } context.put("unjoinSite", unjoinSite); @@ -477,13 +479,9 @@ public void doJoin(RunData data) userAuditRegistration.addToUserAuditing(userAuditList); } } - catch (IdUnusedException e) + catch (IdUnusedException | PermissionException e) { - Log.warn("chef", this + ".doJoin(): " + e); - } - catch (PermissionException e) - { - Log.warn("chef", this + ".doJoin(): " + e); + log.warn(e.getMessage()); } catch (InUseException e) { @@ -543,11 +541,11 @@ public void doUnjoin(RunData data) { // This could occur if the user's role is the maintain role for the site, and we don't let the user // unjoin sites they are maintainers of - Log.warn("chef", this + ".doUnjoin(): " + e); + log.warn(e.getMessage()); } catch (InUseException e) { - Log.warn("chef", this + ".doJoin(): " + e); + log.warn(e.getMessage()); addAlert(state, rb.getString("mb.sitebeing")); } } diff --git a/site-manage/site-manage-tool/tool/src/java/org/sakaiproject/site/tool/SiteAction.java b/site-manage/site-manage-tool/tool/src/java/org/sakaiproject/site/tool/SiteAction.java index a9cccca28ad0..52f3e7e36037 100644 --- a/site-manage/site-manage-tool/tool/src/java/org/sakaiproject/site/tool/SiteAction.java +++ b/site-manage/site-manage-tool/tool/src/java/org/sakaiproject/site/tool/SiteAction.java @@ -61,8 +61,8 @@ import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.validator.routines.EmailValidator; import org.apache.velocity.tools.generic.SortTool; import org.sakaiproject.alias.api.Alias; @@ -181,7 +181,7 @@ public class SiteAction extends PagedResourceActionII { private static final String TEMPLATE_USED = "template_used"; /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(SiteAction.class); + private static Logger M_log = LoggerFactory.getLogger(SiteAction.class); private LTIService m_ltiService = (LTIService) ComponentManager.get("org.sakaiproject.lti.api.LTIService"); private ContentHostingService m_contentHostingService = (ContentHostingService) ComponentManager.get("org.sakaiproject.content.api.ContentHostingService"); @@ -4488,14 +4488,14 @@ else if (fileSize > 0) { if (fileInput != null && importService.isValidArchive(fileInput)) { ImportDataSource importDataSource = importService .parseFromFile(fileInput); - Log.info("chef", "Getting import items from manifest."); + M_log.info("Getting import items from manifest."); List lst = importDataSource.getItemCategories(); if (lst != null && lst.size() > 0) { Iterator iter = lst.iterator(); while (iter.hasNext()) { ImportMetadata importdata = (ImportMetadata) iter .next(); - // Log.info("chef","Preparing import + // Logger.info("chef","Preparing import // item '" + importdata.getId() + "'"); if ((!importdata.isMandatory()) && (importdata.getFileName() @@ -4628,16 +4628,12 @@ public void doSaveMtrlSite(RunData data) { // combine the selected import items with the mandatory import items fnlList.addAll(directList); - Log.info("chef", "doSaveMtrlSite() about to import " + fnlList.size() - + " top level items"); - Log.info("chef", "doSaveMtrlSite() the importDataSource is " - + importDataSource.getClass().getName()); + M_log.info("about to import {} top level items", fnlList.size()); + M_log.info("the importDataSource is {}", importDataSource.getClass().getName()); if (importDataSource instanceof SakaiArchive) { - Log.info("chef", - "doSaveMtrlSite() our data source is a Sakai format"); + M_log.info("our data source is a Sakai format"); ((SakaiArchive) importDataSource).buildSourceFolder(fnlList); - Log.info("chef", "doSaveMtrlSite() source folder is " - + ((SakaiArchive) importDataSource).getSourceFolder()); + M_log.info("source folder is {}", ((SakaiArchive) importDataSource).getSourceFolder()); ArchiveService.merge(((SakaiArchive) importDataSource) .getSourceFolder(), siteId, null); } else { @@ -8517,7 +8513,7 @@ public SecurityAdvice isAllowed(String userId, String function, String reference SecurityService.pushAdvisor(yesMan); commitSite(currentSite); }catch (Exception e) { - M_log.debug(e); + M_log.debug(e.getMessage()); }finally{ SecurityService.popAdvisor(); } @@ -8575,19 +8571,19 @@ public SecurityAdvice isAllowed(String userId, String function, String reference SecurityService.pushAdvisor(yesMan); commitSite(currentSite); }catch (Exception e) { - M_log.debug(e); + M_log.debug(e.getMessage()); }finally{ SecurityService.popAdvisor(); } } } }catch (Exception e) { - M_log.debug("Error removing user to group: " + groupRef + ", " + e.getMessage(), e); + M_log.debug("Error removing user to group: {}, {}", groupRef, e.getMessage(), e); } } } } catch (IdUnusedException e) { - M_log.debug("Error removing user to group: " + groupRef + ", " + e.getMessage(), e); + M_log.debug("Error removing user to group: {}, {}", groupRef, e.getMessage(), e); } } @@ -15505,7 +15501,7 @@ public void doUnjoin(RunData data) { } catch (PermissionException e) { // This could occur if the user's role is the maintain role for the site, and we don't let the user // unjoin sites they are maintainers of - Log.warn("chef", this + ".doUnjoin(): " + e); + M_log.warn(e.getMessage()); //TODO can't access site so redirect to portal } catch (InUseException e) { diff --git a/site-manage/site-manage-tool/tool/src/java/org/sakaiproject/site/tool/SiteBrowserAction.java b/site-manage/site-manage-tool/tool/src/java/org/sakaiproject/site/tool/SiteBrowserAction.java index 59248aaa4b29..8ef62bd6a25e 100644 --- a/site-manage/site-manage-tool/tool/src/java/org/sakaiproject/site/tool/SiteBrowserAction.java +++ b/site-manage/site-manage-tool/tool/src/java/org/sakaiproject/site/tool/SiteBrowserAction.java @@ -65,8 +65,8 @@ import org.sakaiproject.util.ResourceLoader; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.velocity.tools.generic.SortTool; /** @@ -83,7 +83,7 @@ public class SiteBrowserAction extends PagedResourceActionII implements SiteHelp private ContentHostingService contentHostingService; - private static Log log = LogFactory.getLog(SiteBrowserAction.class); + private static Logger log = LoggerFactory.getLogger(SiteBrowserAction.class); private static ResourceLoader rb = new ResourceLoader("sitebrowser"); @@ -257,14 +257,14 @@ else if( JoinableSiteSettings.SITE_BROWSER_JOIN_MODE.equalsIgnoreCase( mode ) ) } else { - Log.warn( "chef", "SiteBrowserAction: mode = " + mode + ", but site browser join is disabled globally" ); + log.warn("SiteBrowserAction: mode = {}, but site browser join is disabled globally", mode); template = buildListContext( state, context ); } } else { - Log.warn("chef", "SiteBrowserAction: mode: " + mode); + log.warn("SiteBrowserAction: mode: {}", mode); template = buildListContext(state, context); } @@ -592,7 +592,7 @@ private String buildVisitContext(SessionState state, Context context) } catch (Exception reflectionEx) { - Log.error("Reflection exceptions in SiteBrowserAction for getting public syllabus" + reflectionEx, ""); + log.error("Reflection exceptions in SiteBrowserAction for getting public syllabus {}", reflectionEx); reflectionEx.printStackTrace(); } @@ -621,6 +621,7 @@ private String buildVisitContext(SessionState state, Context context) } catch (IdUnusedException err) { + log.warn(err.getMessage()); } return "_visit"; @@ -662,7 +663,7 @@ public void doVisit(RunData data, Context context) } catch (IdUnusedException e) { - Log.warn("chef", "SiteBrowserAction.doEdit: site not found: " + id); + log.warn("SiteBrowserAction.doEdit: site not found: {}", id); addAlert(state, rb.getFormattedMessage("notfound", new Object[]{id})); state.removeAttribute(MODE); diff --git a/site-manage/site-manage-tool/tool/src/java/org/sakaiproject/site/tool/SiteInfoToolServlet.java b/site-manage/site-manage-tool/tool/src/java/org/sakaiproject/site/tool/SiteInfoToolServlet.java index 0ed4db55d979..0380b37648a3 100644 --- a/site-manage/site-manage-tool/tool/src/java/org/sakaiproject/site/tool/SiteInfoToolServlet.java +++ b/site-manage/site-manage-tool/tool/src/java/org/sakaiproject/site/tool/SiteInfoToolServlet.java @@ -48,8 +48,8 @@ import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.Fop; import org.apache.fop.apps.FopFactory; @@ -82,7 +82,7 @@ public class SiteInfoToolServlet extends HttpServlet private static final long serialVersionUID = 1L; private transient BasicAuth basicAuth; - protected static final Log log = LogFactory.getLog(SiteInfoToolServlet.class); + protected static final Logger log = LoggerFactory.getLogger(SiteInfoToolServlet.class); // create transformerFactory object needed by generatePDF private TransformerFactory transformerFactory = null; diff --git a/site-manage/site-manage-util/util/src/java/org/sakaiproject/site/util/SiteComparator.java b/site-manage/site-manage-util/util/src/java/org/sakaiproject/site/util/SiteComparator.java index 778a0b60f2cd..1fe4437ba7a7 100644 --- a/site-manage/site-manage-util/util/src/java/org/sakaiproject/site/util/SiteComparator.java +++ b/site-manage/site-manage-util/util/src/java/org/sakaiproject/site/util/SiteComparator.java @@ -4,8 +4,8 @@ import java.text.Collator; import java.util.Comparator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.Member; import org.sakaiproject.site.api.Site; import org.sakaiproject.site.api.Group; @@ -22,7 +22,7 @@ * The comparator to be used in Worksite Setup/Site Info tool */ public class SiteComparator implements Comparator { - private static Log log = LogFactory.getLog(SiteComparator.class); + private static Logger log = LoggerFactory.getLogger(SiteComparator.class); Collator collator = Collator.getInstance(); Collator localeCollator = null; diff --git a/site-manage/site-manage-util/util/src/java/org/sakaiproject/site/util/SiteParticipantHelper.java b/site-manage/site-manage-util/util/src/java/org/sakaiproject/site/util/SiteParticipantHelper.java index c8f02726e511..1effd8086a65 100644 --- a/site-manage/site-manage-util/util/src/java/org/sakaiproject/site/util/SiteParticipantHelper.java +++ b/site-manage/site-manage-util/util/src/java/org/sakaiproject/site/util/SiteParticipantHelper.java @@ -13,8 +13,8 @@ import java.util.concurrent.ConcurrentHashMap; import org.apache.commons.lang.ArrayUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroup; import org.sakaiproject.authz.api.GroupNotDefinedException; import org.sakaiproject.authz.api.Member; @@ -36,7 +36,7 @@ public class SiteParticipantHelper { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(SiteParticipantHelper.class); + private static Logger M_log = LoggerFactory.getLogger(SiteParticipantHelper.class); private static String NULL_STRING = ""; diff --git a/site-manage/site-manage-util/util/src/java/org/sakaiproject/site/util/SiteSetupQuestionFileParser.java b/site-manage/site-manage-util/util/src/java/org/sakaiproject/site/util/SiteSetupQuestionFileParser.java index 1b49044e3804..fcc21941804d 100644 --- a/site-manage/site-manage-util/util/src/java/org/sakaiproject/site/util/SiteSetupQuestionFileParser.java +++ b/site-manage/site-manage-util/util/src/java/org/sakaiproject/site/util/SiteSetupQuestionFileParser.java @@ -48,8 +48,8 @@ import org.w3c.dom.NodeList; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.sitemanage.api.model.*; @@ -60,7 +60,7 @@ */ public class SiteSetupQuestionFileParser { - private static Log m_log = LogFactory.getLog(SiteSetupQuestionFileParser.class); + private static Logger m_log = LoggerFactory.getLogger(SiteSetupQuestionFileParser.class); private static org.sakaiproject.sitemanage.api.model.SiteSetupQuestionService questionService = (org.sakaiproject.sitemanage.api.model.SiteSetupQuestionService) ComponentManager .get(org.sakaiproject.sitemanage.api.model.SiteSetupQuestionService.class); @@ -662,4 +662,4 @@ protected String getText(Element root, String elementName) } -} \ No newline at end of file +} diff --git a/site/admin-perms-tool/src/main/java/org/sakaiproject/adminsiteperms/service/SitePermsService.java b/site/admin-perms-tool/src/main/java/org/sakaiproject/adminsiteperms/service/SitePermsService.java index 3bf2e8d57fb2..871cda61d604 100644 --- a/site/admin-perms-tool/src/main/java/org/sakaiproject/adminsiteperms/service/SitePermsService.java +++ b/site/admin-perms-tool/src/main/java/org/sakaiproject/adminsiteperms/service/SitePermsService.java @@ -21,8 +21,8 @@ import java.util.List; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroup; import org.sakaiproject.authz.api.AuthzGroupService; @@ -49,7 +49,7 @@ */ public class SitePermsService { - final protected Log log = LogFactory.getLog(getClass()); + final protected Logger log = LoggerFactory.getLogger(getClass()); private static final String STATUS_COMPLETE = "COMPLETE"; diff --git a/site/admin-perms-tool/src/main/java/org/sakaiproject/adminsiteperms/tool/ResourceLoaderMessageSource.java b/site/admin-perms-tool/src/main/java/org/sakaiproject/adminsiteperms/tool/ResourceLoaderMessageSource.java index b5afe805993a..ca38e3587c39 100644 --- a/site/admin-perms-tool/src/main/java/org/sakaiproject/adminsiteperms/tool/ResourceLoaderMessageSource.java +++ b/site/admin-perms-tool/src/main/java/org/sakaiproject/adminsiteperms/tool/ResourceLoaderMessageSource.java @@ -17,8 +17,8 @@ import java.text.MessageFormat; import java.util.Locale; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.util.ResourceLoader; import org.springframework.context.support.AbstractMessageSource; @@ -30,7 +30,7 @@ * @author Aaron Zeckoski (azeckoski @ vt.edu) */ public class ResourceLoaderMessageSource extends AbstractMessageSource { - private static Log log = LogFactory.getLog(ResourceLoaderMessageSource.class); + private static Logger log = LoggerFactory.getLogger(ResourceLoaderMessageSource.class); ResourceLoader resourceLoader; @@ -75,4 +75,4 @@ protected String resolveCodeWithoutArguments(String code, Locale locale) { return msg; } -} \ No newline at end of file +} diff --git a/site/admin-perms-tool/src/main/java/org/sakaiproject/adminsiteperms/tool/SitePermsController.java b/site/admin-perms-tool/src/main/java/org/sakaiproject/adminsiteperms/tool/SitePermsController.java index a67bae706fd2..2688bfdf4727 100644 --- a/site/admin-perms-tool/src/main/java/org/sakaiproject/adminsiteperms/tool/SitePermsController.java +++ b/site/admin-perms-tool/src/main/java/org/sakaiproject/adminsiteperms/tool/SitePermsController.java @@ -23,8 +23,8 @@ import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.ArrayUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.adminsiteperms.service.SitePermsService; import org.sakaiproject.util.api.FormattedText; @@ -39,7 +39,7 @@ */ public class SitePermsController extends AbstractController { - final protected Log log = LogFactory.getLog(getClass()); + final protected Logger log = LoggerFactory.getLogger(getClass()); public static String[] templates = { "!site.template", diff --git a/site/sakai-message-bundle-manager-tool/src/main/java/org/sakaiproject/mbm/tool/ResourceLoaderMessageSource.java b/site/sakai-message-bundle-manager-tool/src/main/java/org/sakaiproject/mbm/tool/ResourceLoaderMessageSource.java index cc67fef92e64..aa2b43368fe1 100644 --- a/site/sakai-message-bundle-manager-tool/src/main/java/org/sakaiproject/mbm/tool/ResourceLoaderMessageSource.java +++ b/site/sakai-message-bundle-manager-tool/src/main/java/org/sakaiproject/mbm/tool/ResourceLoaderMessageSource.java @@ -17,8 +17,8 @@ import java.text.MessageFormat; import java.util.Locale; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.util.ResourceLoader; import org.springframework.context.support.AbstractMessageSource; @@ -30,7 +30,7 @@ * @author Aaron Zeckoski (azeckoski @ vt.edu) */ public class ResourceLoaderMessageSource extends AbstractMessageSource { - private static Log log = LogFactory.getLog(ResourceLoaderMessageSource.class); + private static Logger log = LoggerFactory.getLogger(ResourceLoaderMessageSource.class); ResourceLoader resourceLoader; @@ -75,4 +75,4 @@ protected String resolveCodeWithoutArguments(String code, Locale locale) { return msg; } -} \ No newline at end of file +} diff --git a/site/site-tool/tool/src/java/org/sakaiproject/site/tool/AdminSitesAction.java b/site/site-tool/tool/src/java/org/sakaiproject/site/tool/AdminSitesAction.java index c11812f84650..e8e6c35f72c3 100644 --- a/site/site-tool/tool/src/java/org/sakaiproject/site/tool/AdminSitesAction.java +++ b/site/site-tool/tool/src/java/org/sakaiproject/site/tool/AdminSitesAction.java @@ -32,8 +32,8 @@ import java.util.Set; import java.util.Vector; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.alias.api.Alias; import org.sakaiproject.alias.api.AliasService; import org.sakaiproject.authz.api.AuthzGroup; @@ -88,7 +88,7 @@ */ public class AdminSitesAction extends PagedResourceActionII { - private static Log M_log = LogFactory.getLog(AdminSitesAction.class); + private static Logger M_log = LoggerFactory.getLogger(AdminSitesAction.class); /** State holding the site id for site id search. */ protected static final String STATE_SEARCH_SITE_ID = "search_site"; @@ -265,10 +265,7 @@ protected User findUserByPk(String userPk) { User user = UserDirectoryService.getUser(userPk); return user; } catch ( UserNotDefinedException e ) { - if ( Log.isDebugEnabled() ) { - Log.debug("chef", "Failed to find a user record by PK [pk = " + userPk + "]", - e); - } + M_log.debug("Failed to find a user record by PK [pk = {}]", userPk, e); return null; } @@ -289,10 +286,7 @@ protected User findUserByEid(String eid) { User user = UserDirectoryService.getUserByEid(eid); return user; } catch ( UserNotDefinedException e ) { - if ( Log.isDebugEnabled() ) { - Log.debug("chef", "Failed to find a user record by EID [eid = " + eid + "]", - e); - } + M_log.debug("Failed to find a user record by EID [eid = {}]", eid, e); return null; } @@ -313,10 +307,7 @@ protected Site findUserSite(User knownUser) { Site userSite = SiteService.getSite(userMyWorkspaceSiteDbId); // exceptional if no results return userSite; } catch ( IdUnusedException e ) { - if ( Log.isDebugEnabled() ) { - Log.debug("chef", "Failed to locate a workspace for user [user id = " + userDbId + - "][user eid = " + userEid + "][site id = " + userMyWorkspaceSiteDbId + "]", e); - } + M_log.debug("Failed to locate a workspace for user [user id = {}][user eid = {}][site id = {}]", userDbId, userEid, userMyWorkspaceSiteDbId, e); return null; } } @@ -449,7 +440,7 @@ else if (mode.equals("editTool")) // } else { - Log.warn("chef", "SitesAction: mode: " + mode); + M_log.warn("SitesAction: mode: {}", mode); template = buildListContext(state, context); } @@ -975,7 +966,7 @@ public void doEdit(RunData data, Context context) } catch (IdUnusedException e) { - Log.warn("chef", "SitesAction.doEdit: site not found: " + id); + M_log.warn("site not found: {}", id); addAlert(state, rb.getFormattedMessage("siteact.site", new Object[]{id})); state.removeAttribute("mode"); @@ -1135,13 +1126,9 @@ public void doSave_edit(RunData data, Context context) SiteService.save(site); } - catch (PermissionException e) - { - Log.warn("chef", "SitesAction.doSave_edit: " + e); - } - catch (IdUnusedException e) + catch (PermissionException | IdUnusedException e) { - Log.warn("chef", "SitesAction.doSave_edit: " + e); + M_log.warn(e.getMessage()); } // save the realm, too @@ -1974,7 +1961,7 @@ private boolean readPageForm(RunData data, SessionState state) } catch (Exception e) { - Log.warn("chef", this + ".readPageForm(): reading layout: " + e); + M_log.warn("reading layout: {}" + e.getMessage()); } boolean popup = data.getParameters().getBoolean("popup"); diff --git a/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/ConvOldPrefsJobImpl.java b/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/ConvOldPrefsJobImpl.java index f63b3ffe45fd..ea92fd0cfbaf 100644 --- a/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/ConvOldPrefsJobImpl.java +++ b/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/ConvOldPrefsJobImpl.java @@ -26,8 +26,8 @@ import java.util.ArrayList; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.quartz.StatefulJob; @@ -40,8 +40,8 @@ public class ConvOldPrefsJobImpl implements StatefulJob { - // Log - private Log LOG = LogFactory.getLog(ConvOldPrefsJobImpl.class); + // Logger + private Logger LOG = LoggerFactory.getLogger(ConvOldPrefsJobImpl.class); // Sakai Services private StatsManager statsManager = null; diff --git a/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/DBHelper.java b/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/DBHelper.java index ea736cafe4c2..f5e29f9d9786 100644 --- a/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/DBHelper.java +++ b/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/DBHelper.java @@ -28,8 +28,8 @@ import java.util.ArrayList; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.HibernateException; import org.hibernate.Session; import org.sakaiproject.component.cover.ServerConfigurationService; @@ -39,7 +39,7 @@ public class DBHelper extends HibernateDaoSupport { - private static Log LOG = LogFactory.getLog(DBHelper.class); + private static Logger LOG = LoggerFactory.getLogger(DBHelper.class); private boolean autoDdl = false; private String dbVendor = null; private boolean notifiedIndexesUpdate = false; diff --git a/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/ServerWideReportManagerImpl.java b/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/ServerWideReportManagerImpl.java index c28340f0a5c0..464b76083ee3 100644 --- a/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/ServerWideReportManagerImpl.java +++ b/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/ServerWideReportManagerImpl.java @@ -1,1631 +1,1631 @@ -/** - * $URL:$ - * $Id:$ - * - * Copyright (c) 2006-2009 The Sakai 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 - * - * http://www.opensource.org/licenses/ECL-2.0 - * - * 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.sakaiproject.sitestats.impl; - -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Font; -import java.awt.FontMetrics; -import java.awt.GradientPaint; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.text.DateFormat; -import java.text.NumberFormat; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import javax.imageio.ImageIO; - -import lombok.Setter; -import lombok.extern.apachecommons.CommonsLog; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jfree.chart.ChartFactory; -import org.jfree.chart.JFreeChart; -import org.jfree.chart.axis.CategoryAxis; -import org.jfree.chart.axis.CategoryLabelPositions; -import org.jfree.chart.axis.DateAxis; -import org.jfree.chart.axis.DateTickMarkPosition; -import org.jfree.chart.axis.DateTickUnit; -import org.jfree.chart.axis.NumberAxis; -import org.jfree.chart.labels.CategoryItemLabelGenerator; -import org.jfree.chart.labels.StandardCategoryItemLabelGenerator; -import org.jfree.chart.plot.CategoryPlot; -import org.jfree.chart.plot.CombinedDomainXYPlot; -import org.jfree.chart.plot.PlotOrientation; -import org.jfree.chart.plot.XYPlot; -import org.jfree.chart.renderer.category.BarRenderer; -import org.jfree.chart.renderer.category.CategoryItemRenderer; -import org.jfree.chart.renderer.category.LayeredBarRenderer; -import org.jfree.chart.renderer.xy.XYItemRenderer; -import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; -import org.jfree.chart.title.LegendTitle; -import org.jfree.data.category.CategoryDataset; -import org.jfree.data.category.DefaultCategoryDataset; -import org.jfree.data.statistics.BoxAndWhiskerCategoryDataset; -import org.jfree.data.statistics.DefaultBoxAndWhiskerCategoryDataset; -import org.jfree.data.time.Day; -import org.jfree.data.time.Month; -import org.jfree.data.time.MovingAverage; -import org.jfree.data.time.TimeSeries; -import org.jfree.data.time.TimeSeriesCollection; -import org.jfree.data.time.Week; -import org.jfree.data.xy.IntervalXYDataset; -import org.jfree.ui.RectangleInsets; -import org.jfree.util.SortOrder; -import org.sakaiproject.component.api.ServerConfigurationService; -import org.sakaiproject.db.api.SqlReader; -import org.sakaiproject.db.api.SqlService; -import org.sakaiproject.event.api.UsageSessionService; -import org.sakaiproject.sitestats.api.ServerWideReportManager; -import org.sakaiproject.sitestats.api.ServerWideStatsRecord; -import org.sakaiproject.sitestats.api.StatsManager; -import org.sakaiproject.util.ResourceLoader; - -/** - * Server Wide Report Manager handles running the database queries for each of the server wide reports. - * - * This currently provides limited support for the SST_ tables to be in a different database to the main Sakai database - * so long as the credentials and URL are the same (except for the db name). It will do a cross database join onto that db. - * - * Configure via sakai.properties: - * sitestats.externalDb.name=DB_NAME - * - * In addition to the normal settings for setting up external databases for the SST_ tables - * - */ -@CommonsLog -public class ServerWideReportManagerImpl implements ServerWideReportManager -{ - - /** Message bundle */ - private static ResourceLoader msgs = new ResourceLoader("Messages"); - - @Setter - private SqlService sqlService; - - @Setter - private StatsManager statsManager; - - @Setter - private UsageSessionService usageSessionService; - - @Setter - private ServerConfigurationService serverConfigurationService; - - private String dbVendor; - private String externalDbName; - - public void init (){ - //setup the vendor - dbVendor = StringUtils.lowerCase(serverConfigurationService.getString("vendor@org.sakaiproject.db.api.SqlService", null)); - log.info("ServerWideReportManagerImpl SQL queries configured to use: " + dbVendor); - - //setup the external db name for our cross db queries - externalDbName = serverConfigurationService.getString("sitestats.externalDb.name", null); - if(StringUtils.isNotBlank(externalDbName)){ - log.info("ServerWideReportManagerImpl will query for Sitestats data in the external database: " + externalDbName); - } else { - log.info("ServerWideReportManagerImpl will query for Sitestats data in the main Sakai database"); - } - - } - - public void destroy (){} - - - /* - * (non-Javadoc) - * @see org.sakaiproject.sitestats.api.ServerWideReportManager#getMonthlyTotalLogins() - */ - public List<ServerWideStatsRecord> getMonthlyTotalLogins() { - - String mysql = "select STR_TO_DATE(date_format(ACTIVITY_DATE, '%Y-%m-01'),'%Y-%m-%d') as period," + - " sum(ACTIVITY_COUNT) as user_logins" + - " from " + getExternalDbNameAsPrefix() + "SST_SERVERSTATS" + - " where EVENT_ID='user.login'" + - " group by 1"; - - String oracle = ("select TO_DATE(TO_CHAR(ACTIVITY_DATE, 'YYYY-MM-\"01\"'), 'YYYY-MM-DD') as period," + - " sum(ACTIVITY_COUNT) as user_logins" + - " from " + getExternalDbNameAsPrefix() + "SST_SERVERSTATS" + - " where EVENT_ID='user.login'" + - " group by TO_DATE(TO_CHAR(ACTIVITY_DATE, 'YYYY-MM-\"01\"'), 'YYYY-MM-DD')"); - - List result = sqlService.dbRead (getSqlForVendor(mysql, oracle), null, new SqlReader () { - public Object readSqlResultRecord (ResultSet result) - { - ServerWideStatsRecord info = new ServerWideStatsRecordImpl (); - try { - info.add (result.getDate (1)); - info.add (result.getLong (2)); - } - catch (SQLException e) { - log.error("getMonthlyTotalLogins() exception: " + e.getClass() + ": " + e.getMessage()); - return null; - } - return info; - } - }); - - // remove the last entry, as it might not be a complete period - result.remove (result.size () - 1); - - return result; - } - - /* - * (non-Javadoc) - * @see org.sakaiproject.sitestats.api.ServerWideReportManager#getMonthlyUniqueLogins() - */ - public List<ServerWideStatsRecord> getMonthlyUniqueLogins() { - - String mysql = "select STR_TO_DATE(date_format(LOGIN_DATE, '%Y-%m-01'),'%Y-%m-%d') as period," + - " count(distinct user_id) as unique_users" + - " from " + getExternalDbNameAsPrefix() + "SST_USERSTATS" + - " group by 1"; - - String oracle = "select TO_DATE(TO_CHAR(LOGIN_DATE, 'YYYY-MM-\"01\"'),'YYYY-MM-DD') as period," + - " count(distinct user_id) as unique_users" + - " from " + getExternalDbNameAsPrefix() + "SST_USERSTATS" + - " group by TO_DATE(TO_CHAR(LOGIN_DATE, 'YYYY-MM-\"01\"'),'YYYY-MM-DD')"; - - List result = sqlService.dbRead (getSqlForVendor(mysql, oracle), null, new SqlReader () { - public Object readSqlResultRecord (ResultSet result) - { - ServerWideStatsRecord info = new ServerWideStatsRecordImpl (); - try { - info.add (result.getDate (1)); - info.add (result.getLong (2)); - } - catch (SQLException e) { - log.error("getMonthlyUniqueLogins() exception: " + e.getClass() + ": " + e.getMessage()); - return null; - } - return info; - } - }); - - // remove the last entry, as it might not be a complete period - result.remove (result.size () - 1); - - return result; - } - - /* - * (non-Javadoc) - * @see org.sakaiproject.sitestats.api.ServerWideReportManager#getWeeklyTotalLogins() - */ - public List<ServerWideStatsRecord> getWeeklyTotalLogins() { - - - String mysql = "select STR_TO_DATE(concat(date_format(ACTIVITY_DATE, '%x-%v'), ' Monday'),'%x-%v %W') as week_start," + - " sum(ACTIVITY_COUNT) as user_logins" + - " from " + getExternalDbNameAsPrefix() + "SST_SERVERSTATS" + - " where EVENT_ID='user.login'" + - " group by 1"; - - String oracle = "select next_day(ACTIVITY_DATE - 7, 2) as week_start," + - " sum(ACTIVITY_COUNT) as user_logins" + - " from " + getExternalDbNameAsPrefix() + "SST_SERVERSTATS" + - " where EVENT_ID='user.login'" + - " group by next_day(ACTIVITY_DATE - 7, 2)"; - - List result = sqlService.dbRead (getSqlForVendor(mysql, oracle), null, new SqlReader () { - public Object readSqlResultRecord (ResultSet result) - { - ServerWideStatsRecord info = new ServerWideStatsRecordImpl (); - try { - info.add (result.getDate (1)); - info.add (result.getLong (2)); - } - catch (SQLException e) { - log.error("getWeeklyTotalLogins() exception: " + e.getClass() + ": " + e.getMessage()); - return null; - } - return info; - } - }); - - // remove the last entry, as it might not be a complete period - result.remove (result.size () - 1); - - return result; - } - - /* - * (non-Javadoc) - * @see org.sakaiproject.sitestats.api.ServerWideReportManager#getWeeklyUniqueLogins() - */ - public List<ServerWideStatsRecord> getWeeklyUniqueLogins() { - - String mysql = "select STR_TO_DATE(concat(date_format(LOGIN_DATE, '%x-%v'), ' Monday'),'%x-%v %W') as week_start," + - " count(distinct user_id) as unique_users" + - " from " + getExternalDbNameAsPrefix() + "SST_USERSTATS" + - " group by 1"; - - String oracle = "select next_day(LOGIN_DATE - 7, 2) as week_start," + - " count(distinct user_id) as unique_users" + - " from " + getExternalDbNameAsPrefix() + "SST_USERSTATS" + - " group by next_day(LOGIN_DATE - 7, 2)"; - - List result = sqlService.dbRead (getSqlForVendor(mysql, oracle), null, new SqlReader () { - public Object readSqlResultRecord (ResultSet result) - { - ServerWideStatsRecord info = new ServerWideStatsRecordImpl (); - try { - info.add (result.getDate (1)); - info.add (result.getLong (2)); - } - catch (SQLException e) { - log.error("getWeeklyUniqueLogins() exception: " + e.getClass() + ": " + e.getMessage()); - return null; - } - return info; - } - }); - - // remove the last entry, as it might not be a complete period - result.remove (result.size () - 1); - - return result; - } - - /* - * (non-Javadoc) - * @see org.sakaiproject.sitestats.api.ServerWideReportManager#getDailyTotalLogins() - */ - public List<ServerWideStatsRecord> getDailyTotalLogins() { - - String mysql = "select date(ACTIVITY_DATE) as session_date, " + - " ACTIVITY_COUNT as user_logins" + - " from " + getExternalDbNameAsPrefix() + "SST_SERVERSTATS" + - " where EVENT_ID='user.login' " + - " and ACTIVITY_DATE > DATE_SUB(CURDATE(), INTERVAL 90 DAY)" + - " group by 1"; - - String oracle = "select trunc(ACTIVITY_DATE, 'DDD') as session_date," + - " sum(ACTIVITY_COUNT) as user_logins" + - " from " + getExternalDbNameAsPrefix() + "SST_SERVERSTATS" + - " where EVENT_ID='user.login' " + - " and ACTIVITY_DATE > (SYSDATE - 90)" + - " group by trunc(ACTIVITY_DATE, 'DDD')"; - - List result = sqlService.dbRead (getSqlForVendor(mysql, oracle), null, new SqlReader () { - public Object readSqlResultRecord (ResultSet result) - { - ServerWideStatsRecord info = new ServerWideStatsRecordImpl (); - try { - info.add (result.getDate (1)); - info.add (result.getLong (2)); - } - catch (SQLException e) { - log.error("getDailyTotalLogins() exception: " + e.getClass() + ": " + e.getMessage()); - return null; - } - return info; - } - }); - - // remove the last entry, as it might not be a complete period - result.remove (result.size () - 1); - - return result; - } - - /* - * (non-Javadoc) - * @see org.sakaiproject.sitestats.api.ServerWideReportManager#getDailyUniqueLogins() - */ - public List<ServerWideStatsRecord> getDailyUniqueLogins() { - - String mysql = "select date(LOGIN_DATE) as session_date, " + - " count(distinct user_id) as unique_users" + - " from " + getExternalDbNameAsPrefix() + "SST_USERSTATS" + - " where LOGIN_DATE > DATE_SUB(CURDATE(), INTERVAL 90 DAY)" + - " group by 1"; - - String oracle = "select trunc(LOGIN_DATE, 'DDD') as session_date, " + - " count(distinct user_id) as unique_users" + - " from " + getExternalDbNameAsPrefix() + "SST_USERSTATS" + - " where LOGIN_DATE > (SYSDATE - 90)" + - " group by trunc(LOGIN_DATE, 'DDD')"; - - List result = sqlService.dbRead (getSqlForVendor(mysql, oracle), null, new SqlReader () { - public Object readSqlResultRecord (ResultSet result) - { - ServerWideStatsRecord info = new ServerWideStatsRecordImpl (); - try { - info.add (result.getDate (1)); - info.add (result.getLong (2)); - } - catch (SQLException e) { - log.error("getDailyUniqueLogins() exception: " + e.getClass() + ": " + e.getMessage()); - return null; - } - return info; - } - }); - - // remove the last entry, as it might not be a complete period - result.remove (result.size () - 1); - - return result; - } - - public List<ServerWideStatsRecord> getSiteCreatedDeletedStats(String period) { - String mysqlPeriod = ""; - if (period.equals ("daily")) { - mysqlPeriod = "date(ACTIVITY_DATE) as event_period"; - } else if (period.equals ("weekly")) { - mysqlPeriod = "STR_TO_DATE(date_format(ACTIVITY_DATE, '%x-%v Monday'),'%x-%v %W') as event_period"; - } else { - // monthly - mysqlPeriod = "STR_TO_DATE(date_format(ACTIVITY_DATE, '%Y-%m-01'),'%Y-%m-%d') as event_period"; - } - String mysql = "select " + mysqlPeriod + ", " - + "sum(if(EVENT_ID = 'site.add',activity_count,0)) as site_created, " - + "sum(if(EVENT_ID = 'site.del',activity_count,0)) as site_deleted " - + "FROM " + getExternalDbNameAsPrefix() + "SST_SERVERSTATS "; - - if (period.equals ("daily")) { - mysql = mysql + "where ACTIVITY_DATE > DATE_SUB(CURDATE(), INTERVAL 90 DAY) "; - } - - mysql = mysql + "group by 1"; - - - String oraclePeriod = ""; - if (period.equals ("daily")) { - oraclePeriod = "trunc(ACTIVITY_DATE, 'DDD')"; - } else if (period.equals ("weekly")) { - oraclePeriod = "next_day(ACTIVITY_DATE - 7, 2)"; - } else { - // monthly - oraclePeriod = "TO_DATE(TO_CHAR(ACTIVITY_DATE, 'YYYY-MM-\"01\"'),'YYYY-MM-DD')"; - } - - String oracle = "select " + oraclePeriod + " as event_period, " - + "sum(decode(EVENT_ID, 'site.add',activity_count,0)) as site_created, " - + "sum(decode(EVENT_ID, 'site.del',activity_count,0)) as site_deleted " - + "FROM " + getExternalDbNameAsPrefix() + "SST_SERVERSTATS "; - - if (period.equals ("daily")) { - oracle = oracle + "where ACTIVITY_DATE > (SYSDATE - 90) "; - } - oracle = oracle + "group by " + oraclePeriod; - - - List result = sqlService.dbRead (getSqlForVendor(mysql, oracle), null, new SqlReader () { - public Object readSqlResultRecord (ResultSet result) - { - ServerWideStatsRecord info = new ServerWideStatsRecordImpl (); - try { - info.add (result.getDate (1)); - info.add (result.getLong (2)); - info.add (result.getLong (3)); - } - catch (SQLException e) { - log.error("getSiteCreatedDeletedStats() exception: " + e.getClass() + ": " + e.getMessage()); - return null; - } - return info; - } - }); - - // remove the last entry, as it might not be a complete period - if(result.size() > 0) { - result.remove (result.size() - 1); - } - return result; - } - - public List<ServerWideStatsRecord> getNewUserStats(String period) - { - String mysqlPeriod = ""; - if (period.equals ("daily")) { - mysqlPeriod = "date(ACTIVITY_DATE) as event_period"; - } else if (period.equals ("weekly")) { - mysqlPeriod = "STR_TO_DATE(date_format(ACTIVITY_DATE, '%x-%v Monday'),'%x-%v %W') as event_period"; - } else { - // monthly - mysqlPeriod = "STR_TO_DATE(date_format(ACTIVITY_DATE, '%Y-%m-01'),'%Y-%m-%d') as event_period"; - } - String mysql = "select " + mysqlPeriod + ", " - + " ACTIVITY_COUNT as new_user" - + " FROM " + getExternalDbNameAsPrefix() + "SST_SERVERSTATS" - + " where EVENT_ID='user.add'"; - - - if (period.equals ("daily")) { - mysql = mysql + " and ACTIVITY_DATE > DATE_SUB(CURDATE(), INTERVAL 90 DAY) "; - } - mysql = mysql + " group by 1"; - - - String oraclePeriod = ""; - if (period.equals ("daily")) { - oraclePeriod = "trunc(ACTIVITY_DATE, 'DDD')"; - } else if (period.equals ("weekly")) { - oraclePeriod = "next_day(ACTIVITY_DATE - 7, 2)"; - } else { - // monthly - oraclePeriod = "TO_DATE(TO_CHAR(ACTIVITY_DATE, 'YYYY-MM-\"01\"'),'YYYY-MM-DD')"; - } - String oracle = "select " + oraclePeriod + " as event_period, " - + " sum(ACTIVITY_COUNT) as new_user" - + " FROM " + getExternalDbNameAsPrefix() + "SST_SERVERSTATS" - + " where EVENT_ID='user.add'"; - - if (period.equals ("daily")) { - oracle = oracle + " AND ACTIVITY_DATE > (SYSDATE - 90) "; - } - oracle = oracle + " group by " + oraclePeriod; - - List result = sqlService.dbRead (getSqlForVendor(mysql, oracle), null, new SqlReader () { - public Object readSqlResultRecord (ResultSet result) - { - ServerWideStatsRecord info = new ServerWideStatsRecordImpl (); - try { - info.add (result.getDate (1)); - info.add (result.getLong (2)); - } - catch (SQLException e) { - log.error("getNewUserStats() exception: " + e.getClass() + ": " + e.getMessage()); - return null; - } - return info; - } - }); - - // remove the last entry, as it might not be a complete period - if(result.size () > 0){ - result.remove (result.size () - 1); - } - - return result; - } - - public List<ServerWideStatsRecord> getTop20Activities() - { - String mysql = "SELECT event_id, " - + "sum(if(event_date > DATE_SUB(CURDATE(), INTERVAL 7 DAY),1,0))/7 as last7, " - + "sum(if(event_date > DATE_SUB(CURDATE(), INTERVAL 30 DAY),1,0))/30 as last30, " - + "sum(if(event_date > DATE_SUB(CURDATE(), INTERVAL 365 DAY),1,0))/365 as last365 " - + "FROM " + getExternalDbNameAsPrefix() + "SST_EVENTS " - + "where event_id not in ('content.read', 'user.login', 'user.logout', 'pres.begin', 'pres.end', " - + "'realm.upd', 'realm.add', 'realm.del', 'realm.upd.own', 'site.add', 'site.del', 'user.add', 'user.del') " - + "and event_date > DATE_SUB(CURDATE(), INTERVAL 365 DAY) " - + "group by 1 " + "order by 2 desc, 3 desc, 4 desc " - + "LIMIT 20"; - - String oracle = "select * from" + - " (SELECT event_id," + - " sum(decode(sign(event_date - (SYSDATE - 7)), 1, 1, 0)) / 7 as last7," + - " sum(decode(sign(event_date - (SYSDATE - 30)), 1, 1, 0)) / 30 as last30," + - " sum(decode(sign(event_date - (SYSDATE - 365)), 1, 1, 0)) / 365 as last365" + - " FROM " + getExternalDbNameAsPrefix() + "SST_EVENTS" + - " where event_id not in ('content.read', 'user.login', 'user.logout', 'pres.begin', 'pres.end', 'realm.upd', 'realm.add', 'realm.del', 'realm.upd.own', 'site.add', 'site.del', 'user.add', 'user.del')" + - " and event_date > (SYSDATE - 365)" + - " group by event_id" + - " order by last7 desc, last30 desc, last365 desc)" + - " where rownum <= 20"; - - List result = sqlService.dbRead (getSqlForVendor(mysql, oracle), null, new SqlReader () { - public Object readSqlResultRecord (ResultSet result) - { - ServerWideStatsRecord info = new ServerWideStatsRecordImpl (); - try { - info.add (result.getString (1)); - info.add (result.getDouble (2)); - info.add (result.getDouble (3)); - info.add (result.getDouble (4)); - } - catch (SQLException e) { - log.error("getTop20Activities() exception: " + e.getClass() + ": " + e.getMessage()); - return null; - } - return info; - } - }); - - return result; - } - - public List<ServerWideStatsRecord> getWeeklyRegularUsers () - { - String mysql = "select s.week_start, sum(if(s.user_logins >= 5,1,0)) as five_plus, " - + "sum(if(s.user_logins = 4,1,0)) as four, " - + "sum(if(s.user_logins = 3,1,0)) as three, " - + "sum(if(s.user_logins = 2,1,0)) as twice, " - + "sum(if(s.user_logins = 1,1,0)) as once " - + "from (select " - + "STR_TO_DATE(concat(date_format(login_date, '%x-%v'), ' Monday'),'%x-%v %W') as week_start, " - + "user_id, login_count as user_logins " - + "from " + getExternalDbNameAsPrefix() + "SST_USERSTATS group by 1, 2) as s " + "group by 1"; - - String oracle = "select s.week_start," + - " sum(decode(sign(s.user_logins - 4), 1, 1, 0)) as five_plus," + - " sum(decode(s.user_logins, 4, 1, 0)) as four, " + - " sum(decode(s.user_logins, 3, 1, 0)) as three, " + - " sum(decode(s.user_logins, 2, 1, 0)) as twice, " + - " sum(decode(s.user_logins, 1, 1, 0)) as once" + - " from (select next_day(LOGIN_DATE - 7, 2) as week_start," + - " user_id, login_count as user_logins" + - " from " + getExternalDbNameAsPrefix() + "SST_USERSTATS" + - " group by next_day(LOGIN_DATE - 7, 2), user_id, login_count) s" + - " group by s.week_start"; - - List result = sqlService.dbRead (getSqlForVendor(mysql, oracle), null, new SqlReader () { - public Object readSqlResultRecord (ResultSet result) - { - ServerWideStatsRecord info = new ServerWideStatsRecordImpl (); - try { - info.add (result.getDate (1)); - info.add (result.getLong (2)); - info.add (result.getLong (3)); - info.add (result.getLong (4)); - info.add (result.getLong (5)); - info.add (result.getLong (6)); - } - catch (SQLException e) { - log.error("getWeeklyRegularUsers() exception: " + e.getClass() + ": " + e.getMessage()); - return null; - } - return info; - } - }); - - // remove the last entry, as it might not be a complete period - result.remove (result.size () - 1); - - return result; - } - - // this has not been reimplemented in STAT-299 because the data is not tracked at an hourly level - // in any case, the data is only shown for a 30 day period so you could think about retaining the data for 30 days, perhaps. - public List<ServerWideStatsRecord> getHourlyUsagePattern () - { - String mysql = "select date(SESSION_START) as session_date, " - + "hour(session_start) as hour_start, " - + "count(distinct SESSION_USER) as unique_users " - + "from SAKAI_SESSION " - + "where SESSION_START > DATE_SUB(CURDATE(), INTERVAL 30 DAY) " - + "group by 1, 2"; - - String oracle = "select trunc(SESSION_START, 'DDD') as session_date," + - " to_number(to_char(session_start, 'HH24')) as hour_start," + - " count(distinct SESSION_USER) as unique_users" + - " from SAKAI_SESSION" + - " where SESSION_START > (SYSDATE - 30)" + - " group by trunc(SESSION_START, 'DDD'), to_number(to_char(session_start, 'HH24'))"; - - // This query uses only the main Sakai database, so do not specify the connection as it might be external - List result = sqlService.dbRead (getSqlForVendor(mysql, oracle), null, new SqlReader () { - public Object readSqlResultRecord (ResultSet result) - { - ServerWideStatsRecord info = new ServerWideStatsRecordImpl (); - try { - info.add (result.getDate (1)); - info.add (result.getInt (2)); - info.add (result.getLong (3)); - } - catch (SQLException e) { - log.error("getHourlyUsagePattern() exception: " + e.getClass() + ": " + e.getMessage()); - return null; - } - return info; - } - }); - - return result; - } - - public List<ServerWideStatsRecord> getToolCount () - { - String mysql = "SELECT registration, count(*) as site_count " + - "FROM SAKAI_SITE_TOOL " + - "where site_id not like '~%' and site_id not like '!%' " + - "group by 1 " + - "order by 2 desc"; - - String oracle = "SELECT registration, count(*) as site_count" + - " FROM SAKAI_SITE_TOOL" + - " where site_id not like '~%' and site_id not like '!%'" + - " group by registration" + - " order by site_count desc"; - - // This query uses only the main Sakai database, so do not specify the connection as it might be external - List result = sqlService.dbRead(getSqlForVendor(mysql, oracle), null, new SqlReader () { - public Object readSqlResultRecord (ResultSet result) - { - ServerWideStatsRecord info = new ServerWideStatsRecordImpl (); - try { - info.add (result.getString (1)); - info.add (result.getInt (2)); - } - catch (SQLException e) { - log.error("getToolCount() exception: " + e.getClass() + ": " + e.getMessage()); - return null; - } - return info; - } - }); - - return result; - } - - public byte[] generateReportChart(String reportType, int width, int height) - { - - if(reportType.equals(StatsManager.MONTHLY_LOGIN_REPORT)){ - return createMonthlyLoginChart(width, height); - - }else if(reportType.equals(StatsManager.WEEKLY_LOGIN_REPORT)){ - return createWeeklyLoginChart(width, height); - - }else if(reportType.equals(StatsManager.DAILY_LOGIN_REPORT)){ - return createDailyLoginChart(width, height); - - }else if(reportType.equals(StatsManager.REGULAR_USERS_REPORT)){ - CategoryDataset dataset = getRegularUsersDataSet(); - if(dataset != null){ - return generateStackedAreaChart(dataset, width, height); - }else{ - return generateNoDataChart(width, height); - } - - }else if(reportType.equals(StatsManager.HOURLY_USAGE_REPORT)){ - BoxAndWhiskerCategoryDataset dataset = getHourlyUsageDataSet(); - if(dataset != null){ - return generateBoxAndWhiskerChart(dataset, width, height); - }else{ - return generateNoDataChart(width, height); - } - - }else if(reportType.equals(StatsManager.TOP_ACTIVITIES_REPORT)){ - CategoryDataset dataset = getTopActivitiesDataSet(); - if(dataset != null){ - return generateLayeredBarChart(dataset, width, height); - }else{ - return generateNoDataChart(width, height); - } - - }else if(reportType.equals(StatsManager.TOOL_REPORT)){ - return createToolAnalysisChart(width, height); - - }else{ - return generateNoDataChart(width, height); - } - } - - - - - private IntervalXYDataset getMonthlyLoginsDataSet() { - - List<ServerWideStatsRecord> totalLogins = getMonthlyTotalLogins(); - List<ServerWideStatsRecord> uniqueLogins = getMonthlyUniqueLogins(); - if (totalLogins == null || uniqueLogins == null) { - return null; - } - - TimeSeries s1 = new TimeSeries (msgs.getString ("legend_logins"), Month.class); - TimeSeries s2 = new TimeSeries (msgs.getString ("legend_unique_logins"), Month.class); - for (ServerWideStatsRecord login : totalLogins) { - Month month = new Month ((Date) login.get (0)); - s1.add (month, (Long) login.get (1)); - } - for (ServerWideStatsRecord login : uniqueLogins) { - Month month = new Month ((Date) login.get (0)); - s2.add (month, (Long) login.get (1)); - } - - TimeSeriesCollection dataset = new TimeSeriesCollection (); - dataset.addSeries (s1); - dataset.addSeries (s2); - - return dataset; - } - - - /* - private IntervalXYDataset getMonthlyLoginsDataSet() { - - List<ServerWideStatsRecord> loginList = getMonthlyUniqueLogins(); - if (loginList == null) { - return null; - } - - TimeSeries s2 = new TimeSeries (msgs.getString ("legend_unique_logins"), Month.class); - for (ServerWideStatsRecord login : loginList) { - Month month = new Month ((Date) login.get (0)); - s2.add (month, (Long) login.get (1)); - } - - TimeSeriesCollection dataset = new TimeSeriesCollection (); - dataset.addSeries (s2); - - return dataset; - } - */ - - private IntervalXYDataset getWeeklyLoginsDataSet() { - - List<ServerWideStatsRecord> totalLogins = getWeeklyTotalLogins(); - List<ServerWideStatsRecord> uniqueLogins = getWeeklyUniqueLogins(); - if (totalLogins == null || uniqueLogins == null) { - return null; - } - - TimeSeries s1 = new TimeSeries (msgs.getString ("legend_logins"),Week.class); - TimeSeries s2 = new TimeSeries (msgs.getString ("legend_unique_logins"), Week.class); - - for (ServerWideStatsRecord login : totalLogins) { - Week week = new Week ((Date) login.get (0)); - s1.add (week, (Long) login.get (1)); - } - - for (ServerWideStatsRecord login : uniqueLogins) { - Week week = new Week ((Date) login.get (0)); - s2.add (week, (Long) login.get (1)); - } - - TimeSeriesCollection dataset = new TimeSeriesCollection(); - dataset.addSeries (s1); - dataset.addSeries (s2); - - return dataset; - } - - - private IntervalXYDataset getDailyLoginsDataSet() { - - List<ServerWideStatsRecord> totalLogins = getDailyTotalLogins(); - List<ServerWideStatsRecord> uniqueLogins = getDailyUniqueLogins(); - if (totalLogins == null || uniqueLogins == null) { - return null; - } - - TimeSeries s1 = new TimeSeries (msgs.getString ("legend_logins"),Day.class); - TimeSeries s2 = new TimeSeries (msgs.getString ("legend_unique_logins"), Day.class); - for (ServerWideStatsRecord login : totalLogins) { - Day day = new Day ((Date) login.get (0)); - s1.add (day, (Long) login.get (1)); - } - - for (ServerWideStatsRecord login : uniqueLogins) { - Day day = new Day ((Date) login.get (0)); - s2.add (day, (Long) login.get (1)); - } - - TimeSeriesCollection dataset = new TimeSeriesCollection(); - dataset.addSeries (s1); - dataset.addSeries (s2); - - TimeSeries mavS1 = MovingAverage.createMovingAverage (s1, "7 day login moving average", 7, 7); - dataset.addSeries (mavS1); - - TimeSeries mavS2 = MovingAverage.createMovingAverage (s2, "7 day unique login moving average", 7, 7); - dataset.addSeries (mavS2); - - return dataset; - } - - - private IntervalXYDataset getMonthlySiteUserDataSet () - { - List<ServerWideStatsRecord> siteCreatedDeletedList = getSiteCreatedDeletedStats ("monthly"); - TimeSeriesCollection dataset = new TimeSeriesCollection (); - if (siteCreatedDeletedList != null) { - TimeSeries s1 = new TimeSeries (msgs.getString ("legend_site_created"), Month.class); - TimeSeries s2 = new TimeSeries (msgs.getString ("legend_site_deleted"), Month.class); - - for (ServerWideStatsRecord login : siteCreatedDeletedList) { - Month month = new Month ((Date) login.get (0)); - s1.add (month, (Long) login.get (1)); - s2.add (month, (Long) login.get (2)); - } - - dataset.addSeries (s1); - dataset.addSeries (s2); - } - - List<ServerWideStatsRecord> newUserList = getNewUserStats ("monthly"); - if (newUserList != null) { - TimeSeries s3 = new TimeSeries (msgs.getString ("legend_new_user"), Month.class); - - for (ServerWideStatsRecord login : newUserList) { - Month month = new Month ((Date) login.get (0)); - s3.add (month, (Long) login.get (1)); - } - - dataset.addSeries (s3); - } - - return dataset; - } - - - private IntervalXYDataset getWeeklySiteUserDataSet () - { - List<ServerWideStatsRecord> siteCreatedDeletedList = getSiteCreatedDeletedStats ("weekly"); - TimeSeriesCollection dataset = new TimeSeriesCollection (); - if (siteCreatedDeletedList != null) { - TimeSeries s1 = new TimeSeries (msgs.getString ("legend_site_created"), Week.class); - TimeSeries s2 = new TimeSeries (msgs.getString ("legend_site_deleted"), Week.class); - - for (ServerWideStatsRecord login : siteCreatedDeletedList) { - Week week = new Week ((Date) login.get (0)); - s1.add (week, (Long) login.get (1)); - s2.add (week, (Long) login.get (2)); - } - - dataset.addSeries (s1); - dataset.addSeries (s2); - } - - List<ServerWideStatsRecord> newUserList = getNewUserStats ("weekly"); - if (newUserList != null) { - TimeSeries s3 = new TimeSeries (msgs.getString ("legend_new_user"), Week.class); - - for (ServerWideStatsRecord login : newUserList) { - Week week = new Week ((Date) login.get (0)); - s3.add (week, (Long) login.get (1)); - } - - dataset.addSeries (s3); - } - - return dataset; - } - - private IntervalXYDataset getDailySiteUserDataSet () - { - List<ServerWideStatsRecord> siteCreatedDeletedList = getSiteCreatedDeletedStats ("daily"); - TimeSeriesCollection dataset = new TimeSeriesCollection (); - if (siteCreatedDeletedList != null) { - TimeSeries s1 = new TimeSeries (msgs.getString ("legend_site_created"), Day.class); - TimeSeries s2 = new TimeSeries (msgs.getString ("legend_site_deleted"), Day.class); - - for (ServerWideStatsRecord login : siteCreatedDeletedList) { - Day day = new Day ((Date) login.get (0)); - s1.add (day, (Long) login.get (1)); - s2.add (day, (Long) login.get (2)); - } - - dataset.addSeries (s1); - dataset.addSeries (s2); - } - - List<ServerWideStatsRecord> newUserList = getNewUserStats ("daily"); - if (newUserList != null) { - TimeSeries s3 = new TimeSeries (msgs.getString ("legend_new_user"), Day.class); - - for (ServerWideStatsRecord login : newUserList) { - Day day = new Day ((Date) login.get (0)); - s3.add (day, (Long) login.get (1)); - } - - dataset.addSeries (s3); - } - - return dataset; - } - - private CategoryDataset getRegularUsersDataSet () - { - List<ServerWideStatsRecord> regularUsersList = getWeeklyRegularUsers (); - if (regularUsersList == null) { - return null; - } - - DefaultCategoryDataset dataset = new DefaultCategoryDataset (); - DateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd"); - - for (ServerWideStatsRecord regularUsers : regularUsersList) { - Date weekStart = ((Date) regularUsers.get (0)); - dataset.addValue ((Long) regularUsers.get (1), "5+", formatter.format (weekStart)); - dataset.addValue ((Long) regularUsers.get (2), "4", formatter.format (weekStart)); - dataset.addValue ((Long) regularUsers.get (3), "3", formatter.format (weekStart)); - dataset.addValue ((Long) regularUsers.get (4), "2", formatter.format (weekStart)); - dataset.addValue ((Long) regularUsers.get (5), "1", formatter.format (weekStart)); - } - - return dataset; - } - - private BoxAndWhiskerCategoryDataset getHourlyUsageDataSet () - { - // log.info("Generating activityWeekBarDataSet"); - List<ServerWideStatsRecord> hourlyUsagePattern = getHourlyUsagePattern (); - if (hourlyUsagePattern == null) { - return null; - } - - DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset (); - - List[] hourList = new ArrayList[24]; - for (int ii = 0; ii < 24; ii++) { - hourList[ii] = new ArrayList (); - } - - int totalDays = 0; - Date prevDate = null; - for (ServerWideStatsRecord regularUsers : hourlyUsagePattern) { - Date currDate = (Date) regularUsers.get (0); - if (!currDate.equals (prevDate)) { - prevDate = currDate; - totalDays++; - } - hourList[(Integer) regularUsers.get (1)].add ((Long) regularUsers.get (2)); - } - - for (int ii = 0; ii < 24; ii++) { - // add zero counts, when no data for the day - for (int jj = hourList[ii].size (); jj < totalDays; jj++) { - hourList[ii].add (Long.valueOf(0)); - } - - dataset.add (hourList[ii], "Last 30 days", "" + ii); - } - - return dataset; - } - - private CategoryDataset getTopActivitiesDataSet () - { - List<ServerWideStatsRecord> topActivitiesList = getTop20Activities (); - if (topActivitiesList == null) { - return null; - } - - DefaultCategoryDataset dataset = new DefaultCategoryDataset (); - - for (ServerWideStatsRecord regularUsers : topActivitiesList) { - String event = (String) regularUsers.get (0); - dataset.addValue ((Double) regularUsers.get (1), "last 7 days", event); - dataset.addValue ((Double) regularUsers.get (2), "last 30 days", event); - dataset.addValue ((Double) regularUsers.get (3), "last 365 days", event); - } - - return dataset; - } - - - private CategoryDataset getToolAnalysisDataSet () - { - List<ServerWideStatsRecord> toolCountList = getToolCount (); - if (toolCountList == null) { - return null; - } - - DefaultCategoryDataset dataset = new DefaultCategoryDataset (); - - for (ServerWideStatsRecord regularUsers : toolCountList) { - String toolId = (String) regularUsers.get (0); - dataset.addValue ((Integer) regularUsers.get (1), "", toolId); - } - - return dataset; - } - - - private byte[] createMonthlyLoginChart (int width, int height) - { - IntervalXYDataset dataset1 = getMonthlyLoginsDataSet(); - IntervalXYDataset dataset3 = getMonthlySiteUserDataSet(); - - if ((dataset1 == null) || (dataset3 == null)) { - return generateNoDataChart(width, height); - } - - // create plot ... - XYItemRenderer renderer1 = new XYLineAndShapeRenderer(true, false); - renderer1.setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); - renderer1.setSeriesPaint (0, Color.RED); - - DateAxis domainAxis = new DateAxis(""); - domainAxis.setTickUnit (new DateTickUnit (DateTickUnit.MONTH, 1, new SimpleDateFormat ("yyyy-MM"))); - domainAxis.setTickMarkPosition (DateTickMarkPosition.START); - domainAxis.setVerticalTickLabels (true); - domainAxis.setLowerMargin (0.01); - domainAxis.setUpperMargin (0.01); - - NumberAxis axis1 = new NumberAxis("Total Logins"); - axis1.setStandardTickUnits (NumberAxis.createIntegerTickUnits ()); - axis1.setLabelPaint(Color.RED); - axis1.setTickLabelPaint(Color.RED); - - XYPlot plot1 = new XYPlot(dataset1, null, axis1, renderer1); - plot1.setBackgroundPaint(Color.lightGray); - plot1.setDomainGridlinePaint(Color.white); - plot1.setRangeGridlinePaint(Color.white); - - // AXIS 2 - /* - NumberAxis axis2 = new NumberAxis("Total Unique Users"); - axis2.setStandardTickUnits (NumberAxis.createIntegerTickUnits ()); - axis2.setLabelPaint(Color.BLUE); - axis2.setTickLabelPaint(Color.BLUE); - plot1.setRangeAxis(1, axis2); - - plot1.setDataset(1, dataset2); - plot1.mapDatasetToRangeAxis(1, 1); - XYItemRenderer renderer2 = new XYLineAndShapeRenderer(true, false); - renderer2.setSeriesStroke(0, new BasicStroke(2.0f, - BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); - renderer2.setSeriesPaint (0, Color.BLUE); - plot1.setRenderer(1, renderer2); - */ - - // add a third dataset and renderer... - XYItemRenderer renderer3 = new XYLineAndShapeRenderer(true, false); - renderer3.setSeriesStroke(0, new BasicStroke(2.0f, - BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); - renderer3.setSeriesStroke(1, new BasicStroke(2.0f, - BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); - renderer3.setSeriesStroke(2, new BasicStroke(2.0f, - BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); - renderer3.setSeriesPaint(0, Color.GREEN); - renderer3.setSeriesPaint(1, Color.BLACK); - renderer3.setSeriesPaint(2, Color.CYAN); - - axis1 = new NumberAxis("count"); - axis1.setStandardTickUnits (NumberAxis.createIntegerTickUnits ()); - - XYPlot plot2 = new XYPlot(dataset3, null, axis1, renderer3); - plot2.setBackgroundPaint(Color.lightGray); - plot2.setDomainGridlinePaint(Color.white); - plot2.setRangeGridlinePaint(Color.white); - - CombinedDomainXYPlot cplot = new CombinedDomainXYPlot(domainAxis); - cplot.add(plot1, 3); - cplot.add(plot2, 2); - cplot.setGap(8.0); - cplot.setDomainGridlinePaint(Color.white); - cplot.setDomainGridlinesVisible(true); - - // return a new chart containing the overlaid plot... - JFreeChart chart = new JFreeChart(null, - JFreeChart.DEFAULT_TITLE_FONT, cplot, false); - LegendTitle legend = new LegendTitle(cplot); - chart.addSubtitle(legend); - - // set background - chart.setBackgroundPaint (parseColor (statsManager.getChartBackgroundColor ())); - - // set chart border - chart.setPadding (new RectangleInsets (10, 5, 5, 5)); - chart.setBorderVisible (true); - chart.setBorderPaint (parseColor ("#cccccc")); - - // set anti alias - chart.setAntiAlias (true); - - BufferedImage img = chart.createBufferedImage (width, height); - final ByteArrayOutputStream out = new ByteArrayOutputStream(); - try{ - ImageIO.write(img, "png", out); - }catch(IOException e){ - log.warn("Error occurred while generating SiteStats chart image data", e); - } - return out.toByteArray(); - } - - - private byte[] createWeeklyLoginChart (int width, int height) - { - IntervalXYDataset dataset1 = getWeeklyLoginsDataSet (); - IntervalXYDataset dataset2 = getWeeklySiteUserDataSet (); - - if ((dataset1 == null) || (dataset2 == null)) { - return generateNoDataChart(width, height); - } - - // create plot ... - XYItemRenderer renderer1 = new XYLineAndShapeRenderer(true, false); - renderer1.setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); - renderer1.setSeriesStroke(1, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); - renderer1.setSeriesPaint(0, Color.RED); - renderer1.setSeriesPaint(0, Color.BLUE); - - DateAxis domainAxis = new DateAxis(""); - domainAxis.setTickUnit (new DateTickUnit (DateTickUnit.DAY, 7, new SimpleDateFormat ("yyyy-MM-dd"))); - domainAxis.setTickMarkPosition (DateTickMarkPosition.START); - domainAxis.setVerticalTickLabels (true); - domainAxis.setLowerMargin (0.01); - domainAxis.setUpperMargin (0.01); - - NumberAxis rangeAxis = new NumberAxis("count"); - rangeAxis.setStandardTickUnits (NumberAxis.createIntegerTickUnits ()); - - XYPlot plot1 = new XYPlot(dataset1, null, rangeAxis, renderer1); - plot1.setBackgroundPaint(Color.lightGray); - plot1.setDomainGridlinePaint(Color.white); - plot1.setRangeGridlinePaint(Color.white); - - // add a second dataset and renderer... - XYItemRenderer renderer2 = new XYLineAndShapeRenderer(true, false); - renderer2.setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); - renderer2.setSeriesStroke(1, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); - renderer2.setSeriesStroke(2, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); - renderer2.setSeriesPaint(0, Color.GREEN); - renderer2.setSeriesPaint(1, Color.BLACK); - renderer2.setSeriesPaint(2, Color.CYAN); - - rangeAxis = new NumberAxis("count"); - rangeAxis.setStandardTickUnits (NumberAxis.createIntegerTickUnits ()); - - XYPlot plot2 = new XYPlot(dataset2, null, rangeAxis, renderer2); - plot2.setBackgroundPaint(Color.lightGray); - plot2.setDomainGridlinePaint(Color.white); - plot2.setRangeGridlinePaint(Color.white); - - CombinedDomainXYPlot cplot = new CombinedDomainXYPlot(domainAxis); - cplot.add(plot1, 3); - cplot.add(plot2, 2); - cplot.setGap(8.0); - cplot.setDomainGridlinePaint(Color.white); - cplot.setDomainGridlinesVisible(true); - - // return a new chart containing the overlaid plot... - JFreeChart chart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, cplot, false); - LegendTitle legend = new LegendTitle(cplot); - chart.addSubtitle(legend); - - // set background - chart.setBackgroundPaint (parseColor (statsManager.getChartBackgroundColor ())); - - // set chart border - chart.setPadding (new RectangleInsets (10, 5, 5, 5)); - chart.setBorderVisible (true); - chart.setBorderPaint (parseColor ("#cccccc")); - - // set anti alias - chart.setAntiAlias (true); - - BufferedImage img = chart.createBufferedImage (width, height); - final ByteArrayOutputStream out = new ByteArrayOutputStream(); - try{ - ImageIO.write(img, "png", out); - }catch(IOException e){ - log.warn("Error occurred while generating SiteStats chart image data", e); - } - return out.toByteArray(); - } - - private byte[] createDailyLoginChart (int width, int height) - { - IntervalXYDataset dataset1 = getDailyLoginsDataSet(); - IntervalXYDataset dataset2 = getDailySiteUserDataSet(); - - if ((dataset1 == null) || (dataset2 == null)) { - return generateNoDataChart(width, height); - } - - // create plot ... - XYItemRenderer renderer1 = new XYLineAndShapeRenderer(true, false); - renderer1.setSeriesPaint (0, Color.RED); - renderer1.setSeriesPaint (1, Color.BLUE); - renderer1.setSeriesPaint (2, Color.RED); - renderer1.setSeriesPaint (3, Color.BLUE); - renderer1.setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); - renderer1.setSeriesStroke(1, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); - BasicStroke dashLineStroke = new BasicStroke (2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 0, new float[] { 4 }, 0); - renderer1.setSeriesStroke (2, dashLineStroke); - renderer1.setSeriesStroke (3, dashLineStroke); - - - DateAxis domainAxis = new DateAxis(""); - domainAxis.setTickUnit (new DateTickUnit (DateTickUnit.DAY, 7, new SimpleDateFormat ("yyyy-MM-dd"))); - domainAxis.setTickMarkPosition (DateTickMarkPosition.START); - domainAxis.setVerticalTickLabels (true); - domainAxis.setLowerMargin (0.01); - domainAxis.setUpperMargin (0.01); - - NumberAxis rangeAxis = new NumberAxis("count"); - rangeAxis.setStandardTickUnits (NumberAxis.createIntegerTickUnits ()); - - XYPlot plot1 = new XYPlot(dataset1, null, rangeAxis, renderer1); - plot1.setBackgroundPaint(Color.lightGray); - plot1.setDomainGridlinePaint(Color.white); - plot1.setRangeGridlinePaint(Color.white); - - // add a second dataset and renderer... - XYItemRenderer renderer2 = new XYLineAndShapeRenderer(true, false); - renderer2.setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); - renderer2.setSeriesStroke(1, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); - renderer2.setSeriesStroke(2, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); - renderer2.setSeriesPaint(0, Color.GREEN); - renderer2.setSeriesPaint(1, Color.BLACK); - renderer2.setSeriesPaint(2, Color.CYAN); - - rangeAxis = new NumberAxis("count"); - rangeAxis.setStandardTickUnits (NumberAxis.createIntegerTickUnits ()); - - XYPlot plot2 = new XYPlot(dataset2, null, rangeAxis, renderer2); - plot2.setBackgroundPaint(Color.lightGray); - plot2.setDomainGridlinePaint(Color.white); - plot2.setRangeGridlinePaint(Color.white); - - CombinedDomainXYPlot cplot = new CombinedDomainXYPlot(domainAxis); - cplot.add(plot1, 3); - cplot.add(plot2, 2); - cplot.setGap(8.0); - cplot.setDomainGridlinePaint(Color.white); - cplot.setDomainGridlinesVisible(true); - - // return a new chart containing the overlaid plot... - JFreeChart chart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, cplot, false); - LegendTitle legend = new LegendTitle(cplot); - chart.addSubtitle(legend); - - // set background - chart.setBackgroundPaint (parseColor (statsManager.getChartBackgroundColor ())); - - // set chart border - chart.setPadding (new RectangleInsets (10, 5, 5, 5)); - chart.setBorderVisible (true); - chart.setBorderPaint (parseColor ("#cccccc")); - - // set anti alias - chart.setAntiAlias (true); - - BufferedImage img = chart.createBufferedImage (width, height); - final ByteArrayOutputStream out = new ByteArrayOutputStream(); - try{ - ImageIO.write(img, "png", out); - }catch(IOException e){ - log.warn("Error occurred while generating SiteStats chart image data", e); - } - return out.toByteArray(); - } - - private byte[] generateStackedAreaChart (CategoryDataset dataset, int width, int height) - { - JFreeChart chart = ChartFactory.createStackedAreaChart (null, // chart title - null, // domain axis label - null, // range axis label - dataset, // data - PlotOrientation.VERTICAL, // the plot orientation - true, // legend - true, // tooltips - false // urls - ); - - // set background - chart.setBackgroundPaint (parseColor (statsManager.getChartBackgroundColor ())); - - // set chart border - chart.setPadding (new RectangleInsets (10, 5, 5, 5)); - chart.setBorderVisible (true); - chart.setBorderPaint (parseColor ("#cccccc")); - - // set anti alias - chart.setAntiAlias (true); - - CategoryPlot plot = (CategoryPlot) chart.getPlot (); - - // set transparency - plot.setForegroundAlpha (0.7f); - plot.setAxisOffset (new RectangleInsets (5.0, 5.0, 5.0, 5.0)); - plot.setBackgroundPaint (Color.lightGray); - plot.setDomainGridlinesVisible (true); - plot.setDomainGridlinePaint (Color.white); - plot.setRangeGridlinesVisible (true); - plot.setRangeGridlinePaint (Color.white); - - // set colour of regular users using Karate belt colour: white, green, blue, brown, black/gold - CategoryItemRenderer renderer = plot.getRenderer (); - renderer.setSeriesPaint (0, new Color (205, 173, 0)); // gold users - renderer.setSeriesPaint (1, new Color (139, 69, 19)); - renderer.setSeriesPaint (2, Color.BLUE); - renderer.setSeriesPaint (3, Color.GREEN); - renderer.setSeriesPaint (4, Color.WHITE); - - // set the range axis to display integers only... - NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis (); - rangeAxis.setStandardTickUnits (NumberAxis.createIntegerTickUnits ()); - - CategoryAxis domainAxis = (CategoryAxis) plot.getDomainAxis (); - domainAxis.setCategoryLabelPositions (CategoryLabelPositions.DOWN_45); - domainAxis.setLowerMargin(0.0); - domainAxis.setUpperMargin(0.0); - - BufferedImage img = chart.createBufferedImage (width, height); - final ByteArrayOutputStream out = new ByteArrayOutputStream(); - try{ - ImageIO.write(img, "png", out); - }catch(IOException e){ - log.warn("Error occurred while generating SiteStats chart image data", e); - } - return out.toByteArray(); - } - - private byte[] generateBoxAndWhiskerChart (BoxAndWhiskerCategoryDataset dataset, int width, int height) - { - JFreeChart chart = ChartFactory.createBoxAndWhiskerChart (null, null, - null, dataset, false); - - // set background - chart.setBackgroundPaint (parseColor (statsManager.getChartBackgroundColor ())); - - // set chart border - chart.setPadding (new RectangleInsets (10, 5, 5, 5)); - chart.setBorderVisible (true); - chart.setBorderPaint (parseColor ("#cccccc")); - - // set anti alias - chart.setAntiAlias (true); - - CategoryPlot plot = (CategoryPlot) chart.getPlot (); - - plot.setDomainGridlinePaint (Color.white); - plot.setDomainGridlinesVisible (true); - plot.setRangeGridlinePaint (Color.white); - - NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis (); - rangeAxis.setStandardTickUnits (NumberAxis.createIntegerTickUnits ()); - - CategoryAxis domainAxis = (CategoryAxis) plot.getDomainAxis (); - domainAxis.setLowerMargin (0.0); - domainAxis.setUpperMargin (0.0); - - BufferedImage img = chart.createBufferedImage (width, height); - final ByteArrayOutputStream out = new ByteArrayOutputStream(); - try{ - ImageIO.write(img, "png", out); - }catch(IOException e){ - log.warn("Error occurred while generating SiteStats chart image data", e); - } - return out.toByteArray(); - } - - private byte[] generateLayeredBarChart (CategoryDataset dataset, int width, int height) - { - JFreeChart chart = ChartFactory.createBarChart (null, // chart title - null, // domain axis label - null, // range axis label - dataset, // data - PlotOrientation.VERTICAL, // the plot orientation - true, // legend - true, // tooltips - false // urls - ); - - // set background - chart.setBackgroundPaint (parseColor (statsManager.getChartBackgroundColor ())); - - // set chart border - chart.setPadding (new RectangleInsets (10, 5, 5, 5)); - chart.setBorderVisible (true); - chart.setBorderPaint (parseColor ("#cccccc")); - - // set anti alias - chart.setAntiAlias (true); - - CategoryPlot plot = (CategoryPlot) chart.getPlot (); - - // disable bar outlines... - LayeredBarRenderer renderer = new LayeredBarRenderer (); - renderer.setDrawBarOutline (false); - renderer.setSeriesBarWidth (0, .6); - renderer.setSeriesBarWidth (1, .8); - renderer.setSeriesBarWidth (2, 1.0); - plot.setRenderer (renderer); - - // for this renderer, we need to draw the first series last... - plot.setRowRenderingOrder (SortOrder.DESCENDING); - - // set up gradient paints for series... - GradientPaint gp0 = new GradientPaint (0.0f, 0.0f, Color.blue, 0.0f, - 0.0f, new Color (0, 0, 64)); - GradientPaint gp1 = new GradientPaint (0.0f, 0.0f, Color.green, 0.0f, - 0.0f, new Color (0, 64, 0)); - GradientPaint gp2 = new GradientPaint (0.0f, 0.0f, Color.red, 0.0f, - 0.0f, new Color (64, 0, 0)); - renderer.setSeriesPaint (0, gp0); - renderer.setSeriesPaint (1, gp1); - renderer.setSeriesPaint (2, gp2); - - CategoryAxis domainAxis = (CategoryAxis) plot.getDomainAxis (); - domainAxis.setCategoryLabelPositions (CategoryLabelPositions.DOWN_45); - domainAxis.setLowerMargin (0.0); - domainAxis.setUpperMargin (0.0); - - BufferedImage img = chart.createBufferedImage (width, height); - final ByteArrayOutputStream out = new ByteArrayOutputStream(); - try{ - ImageIO.write(img, "png", out); - }catch(IOException e){ - log.warn("Error occurred while generating SiteStats chart image data", e); - } - return out.toByteArray(); - } - - private byte[] createToolAnalysisChart (int width, int height) - { - CategoryDataset dataset = getToolAnalysisDataSet (); - - if (dataset == null) { - return generateNoDataChart(width, height); - } - - JFreeChart chart = ChartFactory.createBarChart ( - null, // chart title - null, // domain axis label - null, // range axis label - dataset, // data - PlotOrientation.HORIZONTAL, // the plot orientation - false, // legend - false, // tooltips - false // urls - ); - - // set background - chart.setBackgroundPaint (parseColor (statsManager.getChartBackgroundColor ())); - - // set chart border - chart.setPadding (new RectangleInsets (10, 5, 5, 5)); - chart.setBorderVisible (true); - chart.setBorderPaint (parseColor ("#cccccc")); - - // set anti alias - chart.setAntiAlias (true); - - CategoryPlot plot = (CategoryPlot) chart.getPlot (); - - // set transparency - plot.setForegroundAlpha (0.7f); - plot.setAxisOffset (new RectangleInsets (5.0, 5.0, 5.0, 5.0)); - plot.setBackgroundPaint (Color.lightGray); - plot.setDomainGridlinesVisible (false); - plot.setRangeGridlinesVisible (true); - plot.setRangeGridlinePaint (Color.white); - - CategoryAxis domainAxis = plot.getDomainAxis(); - domainAxis.setVisible(false); - domainAxis.setUpperMargin (0); - domainAxis.setLowerMargin (0); - - NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); - rangeAxis.setUpperMargin(0.20); - rangeAxis.setStandardTickUnits (NumberAxis.createIntegerTickUnits ()); - - BarRenderer renderer = (BarRenderer) plot.getRenderer(); - CategoryItemLabelGenerator generator - = new StandardCategoryItemLabelGenerator("{1}", - NumberFormat.getInstance(new ResourceLoader().getLocale())); - renderer.setBaseItemLabelGenerator(generator); - renderer.setBaseItemLabelFont(new Font("SansSerif", Font.PLAIN, 9)); - renderer.setBaseItemLabelsVisible(true); - renderer.setItemMargin (0); - renderer.setSeriesPaint (0, Color.BLUE); - - BufferedImage img = chart.createBufferedImage (width, height); - final ByteArrayOutputStream out = new ByteArrayOutputStream(); - try{ - ImageIO.write(img, "png", out); - }catch(IOException e){ - log.warn("Error occurred while generating SiteStats chart image data", e); - } - return out.toByteArray(); - } - - private byte[] generateNoDataChart(int width, int height) { - BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); - Graphics2D g2d = img.createGraphics(); - - g2d.setBackground(parseColor(statsManager.getChartBackgroundColor())); - g2d.clearRect(0, 0, width-1, height-1); - g2d.setColor(parseColor("#cccccc")); - g2d.drawRect(0, 0, width-1, height-1); - Font f = new Font("SansSerif", Font.PLAIN, 12); - g2d.setFont(f); - FontMetrics fm = g2d.getFontMetrics(f); - String noData = msgs.getString("no_data"); - int noDataWidth = fm.stringWidth(noData); - int noDataHeight = fm.getHeight(); - g2d.setColor(parseColor("#555555")); - g2d.drawString(noData, width/2 - noDataWidth/2, height/2 - noDataHeight/2 + 2); - final ByteArrayOutputStream out = new ByteArrayOutputStream(); - try{ - ImageIO.write(img, "png", out); - }catch(IOException e){ - log.warn("Error occurred while generating SiteStats chart image data", e); - } - return out.toByteArray(); - } - - - - public static Color parseColor(String color) { - if(color != null) { - if(color.trim().startsWith("#")){ - // HTML colors (#FFFFFF format) - return new Color(Integer.parseInt(color.substring(1), 16)); - }else if(color.trim().startsWith("rgb")){ - // HTML colors (rgb(255, 255, 255) format) - String values = color.substring(color.indexOf("(") + 1, color.indexOf(")")); - String rgb[] = values.split(","); - return new Color(Integer.parseInt(rgb[0].trim()), Integer.parseInt(rgb[1].trim()), Integer.parseInt(rgb[2].trim())); - }else{ - // Colors by name - if(color.equalsIgnoreCase("black")) return Color.black; - if(color.equalsIgnoreCase("grey")) return Color.gray; - if(color.equalsIgnoreCase("yellow")) return Color.yellow; - if(color.equalsIgnoreCase("green")) return Color.green; - if(color.equalsIgnoreCase("blue")) return Color.blue; - if(color.equalsIgnoreCase("red")) return Color.red; - if(color.equalsIgnoreCase("orange")) return Color.orange; - if(color.equalsIgnoreCase("cyan")) return Color.cyan; - if(color.equalsIgnoreCase("magenta")) return Color.magenta; - if(color.equalsIgnoreCase("darkgray")) return Color.darkGray; - if(color.equalsIgnoreCase("lightgray")) return Color.lightGray; - if(color.equalsIgnoreCase("pink")) return Color.pink; - if(color.equalsIgnoreCase("white")) return Color.white; - } - } - log.info("Unable to parse body background-color (color:" + color+"). Assuming white."); - return Color.white; - } - - /** - * Helper method to return the appropriate SQL for the DB vendor - * Everything should be lowercase. - * @return - */ - private String getSqlForVendor(String mysql, String oracle) { - if(StringUtils.equals(dbVendor, "mysql")){ - return mysql; - } - if(StringUtils.equals(dbVendor, "oracle")){ - return oracle; - } - return null; - } - - /** - * Helper to get the externalDbName as a prefix to be used directly in queries, . is appended - * If its not configured, then an empty string is returned so that whatever this returns can be used as-is - * @return - */ - private String getExternalDbNameAsPrefix() { - if(StringUtils.isNotBlank(externalDbName)) { - return externalDbName+"."; - } else { - return ""; - } - } - -} +/** + * $URL:$ + * $Id:$ + * + * Copyright (c) 2006-2009 The Sakai 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 + * + * http://www.opensource.org/licenses/ECL-2.0 + * + * 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.sakaiproject.sitestats.impl; + +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.GradientPaint; +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.text.DateFormat; +import java.text.NumberFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.imageio.ImageIO; + +import lombok.Setter; +import lombok.extern.apachecommons.CommonsLog; + +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.jfree.chart.ChartFactory; +import org.jfree.chart.JFreeChart; +import org.jfree.chart.axis.CategoryAxis; +import org.jfree.chart.axis.CategoryLabelPositions; +import org.jfree.chart.axis.DateAxis; +import org.jfree.chart.axis.DateTickMarkPosition; +import org.jfree.chart.axis.DateTickUnit; +import org.jfree.chart.axis.NumberAxis; +import org.jfree.chart.labels.CategoryItemLabelGenerator; +import org.jfree.chart.labels.StandardCategoryItemLabelGenerator; +import org.jfree.chart.plot.CategoryPlot; +import org.jfree.chart.plot.CombinedDomainXYPlot; +import org.jfree.chart.plot.PlotOrientation; +import org.jfree.chart.plot.XYPlot; +import org.jfree.chart.renderer.category.BarRenderer; +import org.jfree.chart.renderer.category.CategoryItemRenderer; +import org.jfree.chart.renderer.category.LayeredBarRenderer; +import org.jfree.chart.renderer.xy.XYItemRenderer; +import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; +import org.jfree.chart.title.LegendTitle; +import org.jfree.data.category.CategoryDataset; +import org.jfree.data.category.DefaultCategoryDataset; +import org.jfree.data.statistics.BoxAndWhiskerCategoryDataset; +import org.jfree.data.statistics.DefaultBoxAndWhiskerCategoryDataset; +import org.jfree.data.time.Day; +import org.jfree.data.time.Month; +import org.jfree.data.time.MovingAverage; +import org.jfree.data.time.TimeSeries; +import org.jfree.data.time.TimeSeriesCollection; +import org.jfree.data.time.Week; +import org.jfree.data.xy.IntervalXYDataset; +import org.jfree.ui.RectangleInsets; +import org.jfree.util.SortOrder; +import org.sakaiproject.component.api.ServerConfigurationService; +import org.sakaiproject.db.api.SqlReader; +import org.sakaiproject.db.api.SqlService; +import org.sakaiproject.event.api.UsageSessionService; +import org.sakaiproject.sitestats.api.ServerWideReportManager; +import org.sakaiproject.sitestats.api.ServerWideStatsRecord; +import org.sakaiproject.sitestats.api.StatsManager; +import org.sakaiproject.util.ResourceLoader; + +/** + * Server Wide Report Manager handles running the database queries for each of the server wide reports. + * + * This currently provides limited support for the SST_ tables to be in a different database to the main Sakai database + * so long as the credentials and URL are the same (except for the db name). It will do a cross database join onto that db. + * + * Configure via sakai.properties: + * sitestats.externalDb.name=DB_NAME + * + * In addition to the normal settings for setting up external databases for the SST_ tables + * + */ +@CommonsLog +public class ServerWideReportManagerImpl implements ServerWideReportManager +{ + + /** Message bundle */ + private static ResourceLoader msgs = new ResourceLoader("Messages"); + + @Setter + private SqlService sqlService; + + @Setter + private StatsManager statsManager; + + @Setter + private UsageSessionService usageSessionService; + + @Setter + private ServerConfigurationService serverConfigurationService; + + private String dbVendor; + private String externalDbName; + + public void init (){ + //setup the vendor + dbVendor = StringUtils.lowerCase(serverConfigurationService.getString("vendor@org.sakaiproject.db.api.SqlService", null)); + log.info("ServerWideReportManagerImpl SQL queries configured to use: " + dbVendor); + + //setup the external db name for our cross db queries + externalDbName = serverConfigurationService.getString("sitestats.externalDb.name", null); + if(StringUtils.isNotBlank(externalDbName)){ + log.info("ServerWideReportManagerImpl will query for Sitestats data in the external database: " + externalDbName); + } else { + log.info("ServerWideReportManagerImpl will query for Sitestats data in the main Sakai database"); + } + + } + + public void destroy (){} + + + /* + * (non-Javadoc) + * @see org.sakaiproject.sitestats.api.ServerWideReportManager#getMonthlyTotalLogins() + */ + public List<ServerWideStatsRecord> getMonthlyTotalLogins() { + + String mysql = "select STR_TO_DATE(date_format(ACTIVITY_DATE, '%Y-%m-01'),'%Y-%m-%d') as period," + + " sum(ACTIVITY_COUNT) as user_logins" + + " from " + getExternalDbNameAsPrefix() + "SST_SERVERSTATS" + + " where EVENT_ID='user.login'" + + " group by 1"; + + String oracle = ("select TO_DATE(TO_CHAR(ACTIVITY_DATE, 'YYYY-MM-\"01\"'), 'YYYY-MM-DD') as period," + + " sum(ACTIVITY_COUNT) as user_logins" + + " from " + getExternalDbNameAsPrefix() + "SST_SERVERSTATS" + + " where EVENT_ID='user.login'" + + " group by TO_DATE(TO_CHAR(ACTIVITY_DATE, 'YYYY-MM-\"01\"'), 'YYYY-MM-DD')"); + + List result = sqlService.dbRead (getSqlForVendor(mysql, oracle), null, new SqlReader () { + public Object readSqlResultRecord (ResultSet result) + { + ServerWideStatsRecord info = new ServerWideStatsRecordImpl (); + try { + info.add (result.getDate (1)); + info.add (result.getLong (2)); + } + catch (SQLException e) { + log.error("getMonthlyTotalLogins() exception: " + e.getClass() + ": " + e.getMessage()); + return null; + } + return info; + } + }); + + // remove the last entry, as it might not be a complete period + result.remove (result.size () - 1); + + return result; + } + + /* + * (non-Javadoc) + * @see org.sakaiproject.sitestats.api.ServerWideReportManager#getMonthlyUniqueLogins() + */ + public List<ServerWideStatsRecord> getMonthlyUniqueLogins() { + + String mysql = "select STR_TO_DATE(date_format(LOGIN_DATE, '%Y-%m-01'),'%Y-%m-%d') as period," + + " count(distinct user_id) as unique_users" + + " from " + getExternalDbNameAsPrefix() + "SST_USERSTATS" + + " group by 1"; + + String oracle = "select TO_DATE(TO_CHAR(LOGIN_DATE, 'YYYY-MM-\"01\"'),'YYYY-MM-DD') as period," + + " count(distinct user_id) as unique_users" + + " from " + getExternalDbNameAsPrefix() + "SST_USERSTATS" + + " group by TO_DATE(TO_CHAR(LOGIN_DATE, 'YYYY-MM-\"01\"'),'YYYY-MM-DD')"; + + List result = sqlService.dbRead (getSqlForVendor(mysql, oracle), null, new SqlReader () { + public Object readSqlResultRecord (ResultSet result) + { + ServerWideStatsRecord info = new ServerWideStatsRecordImpl (); + try { + info.add (result.getDate (1)); + info.add (result.getLong (2)); + } + catch (SQLException e) { + log.error("getMonthlyUniqueLogins() exception: " + e.getClass() + ": " + e.getMessage()); + return null; + } + return info; + } + }); + + // remove the last entry, as it might not be a complete period + result.remove (result.size () - 1); + + return result; + } + + /* + * (non-Javadoc) + * @see org.sakaiproject.sitestats.api.ServerWideReportManager#getWeeklyTotalLogins() + */ + public List<ServerWideStatsRecord> getWeeklyTotalLogins() { + + + String mysql = "select STR_TO_DATE(concat(date_format(ACTIVITY_DATE, '%x-%v'), ' Monday'),'%x-%v %W') as week_start," + + " sum(ACTIVITY_COUNT) as user_logins" + + " from " + getExternalDbNameAsPrefix() + "SST_SERVERSTATS" + + " where EVENT_ID='user.login'" + + " group by 1"; + + String oracle = "select next_day(ACTIVITY_DATE - 7, 2) as week_start," + + " sum(ACTIVITY_COUNT) as user_logins" + + " from " + getExternalDbNameAsPrefix() + "SST_SERVERSTATS" + + " where EVENT_ID='user.login'" + + " group by next_day(ACTIVITY_DATE - 7, 2)"; + + List result = sqlService.dbRead (getSqlForVendor(mysql, oracle), null, new SqlReader () { + public Object readSqlResultRecord (ResultSet result) + { + ServerWideStatsRecord info = new ServerWideStatsRecordImpl (); + try { + info.add (result.getDate (1)); + info.add (result.getLong (2)); + } + catch (SQLException e) { + log.error("getWeeklyTotalLogins() exception: " + e.getClass() + ": " + e.getMessage()); + return null; + } + return info; + } + }); + + // remove the last entry, as it might not be a complete period + result.remove (result.size () - 1); + + return result; + } + + /* + * (non-Javadoc) + * @see org.sakaiproject.sitestats.api.ServerWideReportManager#getWeeklyUniqueLogins() + */ + public List<ServerWideStatsRecord> getWeeklyUniqueLogins() { + + String mysql = "select STR_TO_DATE(concat(date_format(LOGIN_DATE, '%x-%v'), ' Monday'),'%x-%v %W') as week_start," + + " count(distinct user_id) as unique_users" + + " from " + getExternalDbNameAsPrefix() + "SST_USERSTATS" + + " group by 1"; + + String oracle = "select next_day(LOGIN_DATE - 7, 2) as week_start," + + " count(distinct user_id) as unique_users" + + " from " + getExternalDbNameAsPrefix() + "SST_USERSTATS" + + " group by next_day(LOGIN_DATE - 7, 2)"; + + List result = sqlService.dbRead (getSqlForVendor(mysql, oracle), null, new SqlReader () { + public Object readSqlResultRecord (ResultSet result) + { + ServerWideStatsRecord info = new ServerWideStatsRecordImpl (); + try { + info.add (result.getDate (1)); + info.add (result.getLong (2)); + } + catch (SQLException e) { + log.error("getWeeklyUniqueLogins() exception: " + e.getClass() + ": " + e.getMessage()); + return null; + } + return info; + } + }); + + // remove the last entry, as it might not be a complete period + result.remove (result.size () - 1); + + return result; + } + + /* + * (non-Javadoc) + * @see org.sakaiproject.sitestats.api.ServerWideReportManager#getDailyTotalLogins() + */ + public List<ServerWideStatsRecord> getDailyTotalLogins() { + + String mysql = "select date(ACTIVITY_DATE) as session_date, " + + " ACTIVITY_COUNT as user_logins" + + " from " + getExternalDbNameAsPrefix() + "SST_SERVERSTATS" + + " where EVENT_ID='user.login' " + + " and ACTIVITY_DATE > DATE_SUB(CURDATE(), INTERVAL 90 DAY)" + + " group by 1"; + + String oracle = "select trunc(ACTIVITY_DATE, 'DDD') as session_date," + + " sum(ACTIVITY_COUNT) as user_logins" + + " from " + getExternalDbNameAsPrefix() + "SST_SERVERSTATS" + + " where EVENT_ID='user.login' " + + " and ACTIVITY_DATE > (SYSDATE - 90)" + + " group by trunc(ACTIVITY_DATE, 'DDD')"; + + List result = sqlService.dbRead (getSqlForVendor(mysql, oracle), null, new SqlReader () { + public Object readSqlResultRecord (ResultSet result) + { + ServerWideStatsRecord info = new ServerWideStatsRecordImpl (); + try { + info.add (result.getDate (1)); + info.add (result.getLong (2)); + } + catch (SQLException e) { + log.error("getDailyTotalLogins() exception: " + e.getClass() + ": " + e.getMessage()); + return null; + } + return info; + } + }); + + // remove the last entry, as it might not be a complete period + result.remove (result.size () - 1); + + return result; + } + + /* + * (non-Javadoc) + * @see org.sakaiproject.sitestats.api.ServerWideReportManager#getDailyUniqueLogins() + */ + public List<ServerWideStatsRecord> getDailyUniqueLogins() { + + String mysql = "select date(LOGIN_DATE) as session_date, " + + " count(distinct user_id) as unique_users" + + " from " + getExternalDbNameAsPrefix() + "SST_USERSTATS" + + " where LOGIN_DATE > DATE_SUB(CURDATE(), INTERVAL 90 DAY)" + + " group by 1"; + + String oracle = "select trunc(LOGIN_DATE, 'DDD') as session_date, " + + " count(distinct user_id) as unique_users" + + " from " + getExternalDbNameAsPrefix() + "SST_USERSTATS" + + " where LOGIN_DATE > (SYSDATE - 90)" + + " group by trunc(LOGIN_DATE, 'DDD')"; + + List result = sqlService.dbRead (getSqlForVendor(mysql, oracle), null, new SqlReader () { + public Object readSqlResultRecord (ResultSet result) + { + ServerWideStatsRecord info = new ServerWideStatsRecordImpl (); + try { + info.add (result.getDate (1)); + info.add (result.getLong (2)); + } + catch (SQLException e) { + log.error("getDailyUniqueLogins() exception: " + e.getClass() + ": " + e.getMessage()); + return null; + } + return info; + } + }); + + // remove the last entry, as it might not be a complete period + result.remove (result.size () - 1); + + return result; + } + + public List<ServerWideStatsRecord> getSiteCreatedDeletedStats(String period) { + String mysqlPeriod = ""; + if (period.equals ("daily")) { + mysqlPeriod = "date(ACTIVITY_DATE) as event_period"; + } else if (period.equals ("weekly")) { + mysqlPeriod = "STR_TO_DATE(date_format(ACTIVITY_DATE, '%x-%v Monday'),'%x-%v %W') as event_period"; + } else { + // monthly + mysqlPeriod = "STR_TO_DATE(date_format(ACTIVITY_DATE, '%Y-%m-01'),'%Y-%m-%d') as event_period"; + } + String mysql = "select " + mysqlPeriod + ", " + + "sum(if(EVENT_ID = 'site.add',activity_count,0)) as site_created, " + + "sum(if(EVENT_ID = 'site.del',activity_count,0)) as site_deleted " + + "FROM " + getExternalDbNameAsPrefix() + "SST_SERVERSTATS "; + + if (period.equals ("daily")) { + mysql = mysql + "where ACTIVITY_DATE > DATE_SUB(CURDATE(), INTERVAL 90 DAY) "; + } + + mysql = mysql + "group by 1"; + + + String oraclePeriod = ""; + if (period.equals ("daily")) { + oraclePeriod = "trunc(ACTIVITY_DATE, 'DDD')"; + } else if (period.equals ("weekly")) { + oraclePeriod = "next_day(ACTIVITY_DATE - 7, 2)"; + } else { + // monthly + oraclePeriod = "TO_DATE(TO_CHAR(ACTIVITY_DATE, 'YYYY-MM-\"01\"'),'YYYY-MM-DD')"; + } + + String oracle = "select " + oraclePeriod + " as event_period, " + + "sum(decode(EVENT_ID, 'site.add',activity_count,0)) as site_created, " + + "sum(decode(EVENT_ID, 'site.del',activity_count,0)) as site_deleted " + + "FROM " + getExternalDbNameAsPrefix() + "SST_SERVERSTATS "; + + if (period.equals ("daily")) { + oracle = oracle + "where ACTIVITY_DATE > (SYSDATE - 90) "; + } + oracle = oracle + "group by " + oraclePeriod; + + + List result = sqlService.dbRead (getSqlForVendor(mysql, oracle), null, new SqlReader () { + public Object readSqlResultRecord (ResultSet result) + { + ServerWideStatsRecord info = new ServerWideStatsRecordImpl (); + try { + info.add (result.getDate (1)); + info.add (result.getLong (2)); + info.add (result.getLong (3)); + } + catch (SQLException e) { + log.error("getSiteCreatedDeletedStats() exception: " + e.getClass() + ": " + e.getMessage()); + return null; + } + return info; + } + }); + + // remove the last entry, as it might not be a complete period + if(result.size() > 0) { + result.remove (result.size() - 1); + } + return result; + } + + public List<ServerWideStatsRecord> getNewUserStats(String period) + { + String mysqlPeriod = ""; + if (period.equals ("daily")) { + mysqlPeriod = "date(ACTIVITY_DATE) as event_period"; + } else if (period.equals ("weekly")) { + mysqlPeriod = "STR_TO_DATE(date_format(ACTIVITY_DATE, '%x-%v Monday'),'%x-%v %W') as event_period"; + } else { + // monthly + mysqlPeriod = "STR_TO_DATE(date_format(ACTIVITY_DATE, '%Y-%m-01'),'%Y-%m-%d') as event_period"; + } + String mysql = "select " + mysqlPeriod + ", " + + " ACTIVITY_COUNT as new_user" + + " FROM " + getExternalDbNameAsPrefix() + "SST_SERVERSTATS" + + " where EVENT_ID='user.add'"; + + + if (period.equals ("daily")) { + mysql = mysql + " and ACTIVITY_DATE > DATE_SUB(CURDATE(), INTERVAL 90 DAY) "; + } + mysql = mysql + " group by 1"; + + + String oraclePeriod = ""; + if (period.equals ("daily")) { + oraclePeriod = "trunc(ACTIVITY_DATE, 'DDD')"; + } else if (period.equals ("weekly")) { + oraclePeriod = "next_day(ACTIVITY_DATE - 7, 2)"; + } else { + // monthly + oraclePeriod = "TO_DATE(TO_CHAR(ACTIVITY_DATE, 'YYYY-MM-\"01\"'),'YYYY-MM-DD')"; + } + String oracle = "select " + oraclePeriod + " as event_period, " + + " sum(ACTIVITY_COUNT) as new_user" + + " FROM " + getExternalDbNameAsPrefix() + "SST_SERVERSTATS" + + " where EVENT_ID='user.add'"; + + if (period.equals ("daily")) { + oracle = oracle + " AND ACTIVITY_DATE > (SYSDATE - 90) "; + } + oracle = oracle + " group by " + oraclePeriod; + + List result = sqlService.dbRead (getSqlForVendor(mysql, oracle), null, new SqlReader () { + public Object readSqlResultRecord (ResultSet result) + { + ServerWideStatsRecord info = new ServerWideStatsRecordImpl (); + try { + info.add (result.getDate (1)); + info.add (result.getLong (2)); + } + catch (SQLException e) { + log.error("getNewUserStats() exception: " + e.getClass() + ": " + e.getMessage()); + return null; + } + return info; + } + }); + + // remove the last entry, as it might not be a complete period + if(result.size () > 0){ + result.remove (result.size () - 1); + } + + return result; + } + + public List<ServerWideStatsRecord> getTop20Activities() + { + String mysql = "SELECT event_id, " + + "sum(if(event_date > DATE_SUB(CURDATE(), INTERVAL 7 DAY),1,0))/7 as last7, " + + "sum(if(event_date > DATE_SUB(CURDATE(), INTERVAL 30 DAY),1,0))/30 as last30, " + + "sum(if(event_date > DATE_SUB(CURDATE(), INTERVAL 365 DAY),1,0))/365 as last365 " + + "FROM " + getExternalDbNameAsPrefix() + "SST_EVENTS " + + "where event_id not in ('content.read', 'user.login', 'user.logout', 'pres.begin', 'pres.end', " + + "'realm.upd', 'realm.add', 'realm.del', 'realm.upd.own', 'site.add', 'site.del', 'user.add', 'user.del') " + + "and event_date > DATE_SUB(CURDATE(), INTERVAL 365 DAY) " + + "group by 1 " + "order by 2 desc, 3 desc, 4 desc " + + "LIMIT 20"; + + String oracle = "select * from" + + " (SELECT event_id," + + " sum(decode(sign(event_date - (SYSDATE - 7)), 1, 1, 0)) / 7 as last7," + + " sum(decode(sign(event_date - (SYSDATE - 30)), 1, 1, 0)) / 30 as last30," + + " sum(decode(sign(event_date - (SYSDATE - 365)), 1, 1, 0)) / 365 as last365" + + " FROM " + getExternalDbNameAsPrefix() + "SST_EVENTS" + + " where event_id not in ('content.read', 'user.login', 'user.logout', 'pres.begin', 'pres.end', 'realm.upd', 'realm.add', 'realm.del', 'realm.upd.own', 'site.add', 'site.del', 'user.add', 'user.del')" + + " and event_date > (SYSDATE - 365)" + + " group by event_id" + + " order by last7 desc, last30 desc, last365 desc)" + + " where rownum <= 20"; + + List result = sqlService.dbRead (getSqlForVendor(mysql, oracle), null, new SqlReader () { + public Object readSqlResultRecord (ResultSet result) + { + ServerWideStatsRecord info = new ServerWideStatsRecordImpl (); + try { + info.add (result.getString (1)); + info.add (result.getDouble (2)); + info.add (result.getDouble (3)); + info.add (result.getDouble (4)); + } + catch (SQLException e) { + log.error("getTop20Activities() exception: " + e.getClass() + ": " + e.getMessage()); + return null; + } + return info; + } + }); + + return result; + } + + public List<ServerWideStatsRecord> getWeeklyRegularUsers () + { + String mysql = "select s.week_start, sum(if(s.user_logins >= 5,1,0)) as five_plus, " + + "sum(if(s.user_logins = 4,1,0)) as four, " + + "sum(if(s.user_logins = 3,1,0)) as three, " + + "sum(if(s.user_logins = 2,1,0)) as twice, " + + "sum(if(s.user_logins = 1,1,0)) as once " + + "from (select " + + "STR_TO_DATE(concat(date_format(login_date, '%x-%v'), ' Monday'),'%x-%v %W') as week_start, " + + "user_id, login_count as user_logins " + + "from " + getExternalDbNameAsPrefix() + "SST_USERSTATS group by 1, 2) as s " + "group by 1"; + + String oracle = "select s.week_start," + + " sum(decode(sign(s.user_logins - 4), 1, 1, 0)) as five_plus," + + " sum(decode(s.user_logins, 4, 1, 0)) as four, " + + " sum(decode(s.user_logins, 3, 1, 0)) as three, " + + " sum(decode(s.user_logins, 2, 1, 0)) as twice, " + + " sum(decode(s.user_logins, 1, 1, 0)) as once" + + " from (select next_day(LOGIN_DATE - 7, 2) as week_start," + + " user_id, login_count as user_logins" + + " from " + getExternalDbNameAsPrefix() + "SST_USERSTATS" + + " group by next_day(LOGIN_DATE - 7, 2), user_id, login_count) s" + + " group by s.week_start"; + + List result = sqlService.dbRead (getSqlForVendor(mysql, oracle), null, new SqlReader () { + public Object readSqlResultRecord (ResultSet result) + { + ServerWideStatsRecord info = new ServerWideStatsRecordImpl (); + try { + info.add (result.getDate (1)); + info.add (result.getLong (2)); + info.add (result.getLong (3)); + info.add (result.getLong (4)); + info.add (result.getLong (5)); + info.add (result.getLong (6)); + } + catch (SQLException e) { + log.error("getWeeklyRegularUsers() exception: " + e.getClass() + ": " + e.getMessage()); + return null; + } + return info; + } + }); + + // remove the last entry, as it might not be a complete period + result.remove (result.size () - 1); + + return result; + } + + // this has not been reimplemented in STAT-299 because the data is not tracked at an hourly level + // in any case, the data is only shown for a 30 day period so you could think about retaining the data for 30 days, perhaps. + public List<ServerWideStatsRecord> getHourlyUsagePattern () + { + String mysql = "select date(SESSION_START) as session_date, " + + "hour(session_start) as hour_start, " + + "count(distinct SESSION_USER) as unique_users " + + "from SAKAI_SESSION " + + "where SESSION_START > DATE_SUB(CURDATE(), INTERVAL 30 DAY) " + + "group by 1, 2"; + + String oracle = "select trunc(SESSION_START, 'DDD') as session_date," + + " to_number(to_char(session_start, 'HH24')) as hour_start," + + " count(distinct SESSION_USER) as unique_users" + + " from SAKAI_SESSION" + + " where SESSION_START > (SYSDATE - 30)" + + " group by trunc(SESSION_START, 'DDD'), to_number(to_char(session_start, 'HH24'))"; + + // This query uses only the main Sakai database, so do not specify the connection as it might be external + List result = sqlService.dbRead (getSqlForVendor(mysql, oracle), null, new SqlReader () { + public Object readSqlResultRecord (ResultSet result) + { + ServerWideStatsRecord info = new ServerWideStatsRecordImpl (); + try { + info.add (result.getDate (1)); + info.add (result.getInt (2)); + info.add (result.getLong (3)); + } + catch (SQLException e) { + log.error("getHourlyUsagePattern() exception: " + e.getClass() + ": " + e.getMessage()); + return null; + } + return info; + } + }); + + return result; + } + + public List<ServerWideStatsRecord> getToolCount () + { + String mysql = "SELECT registration, count(*) as site_count " + + "FROM SAKAI_SITE_TOOL " + + "where site_id not like '~%' and site_id not like '!%' " + + "group by 1 " + + "order by 2 desc"; + + String oracle = "SELECT registration, count(*) as site_count" + + " FROM SAKAI_SITE_TOOL" + + " where site_id not like '~%' and site_id not like '!%'" + + " group by registration" + + " order by site_count desc"; + + // This query uses only the main Sakai database, so do not specify the connection as it might be external + List result = sqlService.dbRead(getSqlForVendor(mysql, oracle), null, new SqlReader () { + public Object readSqlResultRecord (ResultSet result) + { + ServerWideStatsRecord info = new ServerWideStatsRecordImpl (); + try { + info.add (result.getString (1)); + info.add (result.getInt (2)); + } + catch (SQLException e) { + log.error("getToolCount() exception: " + e.getClass() + ": " + e.getMessage()); + return null; + } + return info; + } + }); + + return result; + } + + public byte[] generateReportChart(String reportType, int width, int height) + { + + if(reportType.equals(StatsManager.MONTHLY_LOGIN_REPORT)){ + return createMonthlyLoginChart(width, height); + + }else if(reportType.equals(StatsManager.WEEKLY_LOGIN_REPORT)){ + return createWeeklyLoginChart(width, height); + + }else if(reportType.equals(StatsManager.DAILY_LOGIN_REPORT)){ + return createDailyLoginChart(width, height); + + }else if(reportType.equals(StatsManager.REGULAR_USERS_REPORT)){ + CategoryDataset dataset = getRegularUsersDataSet(); + if(dataset != null){ + return generateStackedAreaChart(dataset, width, height); + }else{ + return generateNoDataChart(width, height); + } + + }else if(reportType.equals(StatsManager.HOURLY_USAGE_REPORT)){ + BoxAndWhiskerCategoryDataset dataset = getHourlyUsageDataSet(); + if(dataset != null){ + return generateBoxAndWhiskerChart(dataset, width, height); + }else{ + return generateNoDataChart(width, height); + } + + }else if(reportType.equals(StatsManager.TOP_ACTIVITIES_REPORT)){ + CategoryDataset dataset = getTopActivitiesDataSet(); + if(dataset != null){ + return generateLayeredBarChart(dataset, width, height); + }else{ + return generateNoDataChart(width, height); + } + + }else if(reportType.equals(StatsManager.TOOL_REPORT)){ + return createToolAnalysisChart(width, height); + + }else{ + return generateNoDataChart(width, height); + } + } + + + + + private IntervalXYDataset getMonthlyLoginsDataSet() { + + List<ServerWideStatsRecord> totalLogins = getMonthlyTotalLogins(); + List<ServerWideStatsRecord> uniqueLogins = getMonthlyUniqueLogins(); + if (totalLogins == null || uniqueLogins == null) { + return null; + } + + TimeSeries s1 = new TimeSeries (msgs.getString ("legend_logins"), Month.class); + TimeSeries s2 = new TimeSeries (msgs.getString ("legend_unique_logins"), Month.class); + for (ServerWideStatsRecord login : totalLogins) { + Month month = new Month ((Date) login.get (0)); + s1.add (month, (Long) login.get (1)); + } + for (ServerWideStatsRecord login : uniqueLogins) { + Month month = new Month ((Date) login.get (0)); + s2.add (month, (Long) login.get (1)); + } + + TimeSeriesCollection dataset = new TimeSeriesCollection (); + dataset.addSeries (s1); + dataset.addSeries (s2); + + return dataset; + } + + + /* + private IntervalXYDataset getMonthlyLoginsDataSet() { + + List<ServerWideStatsRecord> loginList = getMonthlyUniqueLogins(); + if (loginList == null) { + return null; + } + + TimeSeries s2 = new TimeSeries (msgs.getString ("legend_unique_logins"), Month.class); + for (ServerWideStatsRecord login : loginList) { + Month month = new Month ((Date) login.get (0)); + s2.add (month, (Long) login.get (1)); + } + + TimeSeriesCollection dataset = new TimeSeriesCollection (); + dataset.addSeries (s2); + + return dataset; + } + */ + + private IntervalXYDataset getWeeklyLoginsDataSet() { + + List<ServerWideStatsRecord> totalLogins = getWeeklyTotalLogins(); + List<ServerWideStatsRecord> uniqueLogins = getWeeklyUniqueLogins(); + if (totalLogins == null || uniqueLogins == null) { + return null; + } + + TimeSeries s1 = new TimeSeries (msgs.getString ("legend_logins"),Week.class); + TimeSeries s2 = new TimeSeries (msgs.getString ("legend_unique_logins"), Week.class); + + for (ServerWideStatsRecord login : totalLogins) { + Week week = new Week ((Date) login.get (0)); + s1.add (week, (Long) login.get (1)); + } + + for (ServerWideStatsRecord login : uniqueLogins) { + Week week = new Week ((Date) login.get (0)); + s2.add (week, (Long) login.get (1)); + } + + TimeSeriesCollection dataset = new TimeSeriesCollection(); + dataset.addSeries (s1); + dataset.addSeries (s2); + + return dataset; + } + + + private IntervalXYDataset getDailyLoginsDataSet() { + + List<ServerWideStatsRecord> totalLogins = getDailyTotalLogins(); + List<ServerWideStatsRecord> uniqueLogins = getDailyUniqueLogins(); + if (totalLogins == null || uniqueLogins == null) { + return null; + } + + TimeSeries s1 = new TimeSeries (msgs.getString ("legend_logins"),Day.class); + TimeSeries s2 = new TimeSeries (msgs.getString ("legend_unique_logins"), Day.class); + for (ServerWideStatsRecord login : totalLogins) { + Day day = new Day ((Date) login.get (0)); + s1.add (day, (Long) login.get (1)); + } + + for (ServerWideStatsRecord login : uniqueLogins) { + Day day = new Day ((Date) login.get (0)); + s2.add (day, (Long) login.get (1)); + } + + TimeSeriesCollection dataset = new TimeSeriesCollection(); + dataset.addSeries (s1); + dataset.addSeries (s2); + + TimeSeries mavS1 = MovingAverage.createMovingAverage (s1, "7 day login moving average", 7, 7); + dataset.addSeries (mavS1); + + TimeSeries mavS2 = MovingAverage.createMovingAverage (s2, "7 day unique login moving average", 7, 7); + dataset.addSeries (mavS2); + + return dataset; + } + + + private IntervalXYDataset getMonthlySiteUserDataSet () + { + List<ServerWideStatsRecord> siteCreatedDeletedList = getSiteCreatedDeletedStats ("monthly"); + TimeSeriesCollection dataset = new TimeSeriesCollection (); + if (siteCreatedDeletedList != null) { + TimeSeries s1 = new TimeSeries (msgs.getString ("legend_site_created"), Month.class); + TimeSeries s2 = new TimeSeries (msgs.getString ("legend_site_deleted"), Month.class); + + for (ServerWideStatsRecord login : siteCreatedDeletedList) { + Month month = new Month ((Date) login.get (0)); + s1.add (month, (Long) login.get (1)); + s2.add (month, (Long) login.get (2)); + } + + dataset.addSeries (s1); + dataset.addSeries (s2); + } + + List<ServerWideStatsRecord> newUserList = getNewUserStats ("monthly"); + if (newUserList != null) { + TimeSeries s3 = new TimeSeries (msgs.getString ("legend_new_user"), Month.class); + + for (ServerWideStatsRecord login : newUserList) { + Month month = new Month ((Date) login.get (0)); + s3.add (month, (Long) login.get (1)); + } + + dataset.addSeries (s3); + } + + return dataset; + } + + + private IntervalXYDataset getWeeklySiteUserDataSet () + { + List<ServerWideStatsRecord> siteCreatedDeletedList = getSiteCreatedDeletedStats ("weekly"); + TimeSeriesCollection dataset = new TimeSeriesCollection (); + if (siteCreatedDeletedList != null) { + TimeSeries s1 = new TimeSeries (msgs.getString ("legend_site_created"), Week.class); + TimeSeries s2 = new TimeSeries (msgs.getString ("legend_site_deleted"), Week.class); + + for (ServerWideStatsRecord login : siteCreatedDeletedList) { + Week week = new Week ((Date) login.get (0)); + s1.add (week, (Long) login.get (1)); + s2.add (week, (Long) login.get (2)); + } + + dataset.addSeries (s1); + dataset.addSeries (s2); + } + + List<ServerWideStatsRecord> newUserList = getNewUserStats ("weekly"); + if (newUserList != null) { + TimeSeries s3 = new TimeSeries (msgs.getString ("legend_new_user"), Week.class); + + for (ServerWideStatsRecord login : newUserList) { + Week week = new Week ((Date) login.get (0)); + s3.add (week, (Long) login.get (1)); + } + + dataset.addSeries (s3); + } + + return dataset; + } + + private IntervalXYDataset getDailySiteUserDataSet () + { + List<ServerWideStatsRecord> siteCreatedDeletedList = getSiteCreatedDeletedStats ("daily"); + TimeSeriesCollection dataset = new TimeSeriesCollection (); + if (siteCreatedDeletedList != null) { + TimeSeries s1 = new TimeSeries (msgs.getString ("legend_site_created"), Day.class); + TimeSeries s2 = new TimeSeries (msgs.getString ("legend_site_deleted"), Day.class); + + for (ServerWideStatsRecord login : siteCreatedDeletedList) { + Day day = new Day ((Date) login.get (0)); + s1.add (day, (Long) login.get (1)); + s2.add (day, (Long) login.get (2)); + } + + dataset.addSeries (s1); + dataset.addSeries (s2); + } + + List<ServerWideStatsRecord> newUserList = getNewUserStats ("daily"); + if (newUserList != null) { + TimeSeries s3 = new TimeSeries (msgs.getString ("legend_new_user"), Day.class); + + for (ServerWideStatsRecord login : newUserList) { + Day day = new Day ((Date) login.get (0)); + s3.add (day, (Long) login.get (1)); + } + + dataset.addSeries (s3); + } + + return dataset; + } + + private CategoryDataset getRegularUsersDataSet () + { + List<ServerWideStatsRecord> regularUsersList = getWeeklyRegularUsers (); + if (regularUsersList == null) { + return null; + } + + DefaultCategoryDataset dataset = new DefaultCategoryDataset (); + DateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd"); + + for (ServerWideStatsRecord regularUsers : regularUsersList) { + Date weekStart = ((Date) regularUsers.get (0)); + dataset.addValue ((Long) regularUsers.get (1), "5+", formatter.format (weekStart)); + dataset.addValue ((Long) regularUsers.get (2), "4", formatter.format (weekStart)); + dataset.addValue ((Long) regularUsers.get (3), "3", formatter.format (weekStart)); + dataset.addValue ((Long) regularUsers.get (4), "2", formatter.format (weekStart)); + dataset.addValue ((Long) regularUsers.get (5), "1", formatter.format (weekStart)); + } + + return dataset; + } + + private BoxAndWhiskerCategoryDataset getHourlyUsageDataSet () + { + // log.info("Generating activityWeekBarDataSet"); + List<ServerWideStatsRecord> hourlyUsagePattern = getHourlyUsagePattern (); + if (hourlyUsagePattern == null) { + return null; + } + + DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset (); + + List[] hourList = new ArrayList[24]; + for (int ii = 0; ii < 24; ii++) { + hourList[ii] = new ArrayList (); + } + + int totalDays = 0; + Date prevDate = null; + for (ServerWideStatsRecord regularUsers : hourlyUsagePattern) { + Date currDate = (Date) regularUsers.get (0); + if (!currDate.equals (prevDate)) { + prevDate = currDate; + totalDays++; + } + hourList[(Integer) regularUsers.get (1)].add ((Long) regularUsers.get (2)); + } + + for (int ii = 0; ii < 24; ii++) { + // add zero counts, when no data for the day + for (int jj = hourList[ii].size (); jj < totalDays; jj++) { + hourList[ii].add (Long.valueOf(0)); + } + + dataset.add (hourList[ii], "Last 30 days", "" + ii); + } + + return dataset; + } + + private CategoryDataset getTopActivitiesDataSet () + { + List<ServerWideStatsRecord> topActivitiesList = getTop20Activities (); + if (topActivitiesList == null) { + return null; + } + + DefaultCategoryDataset dataset = new DefaultCategoryDataset (); + + for (ServerWideStatsRecord regularUsers : topActivitiesList) { + String event = (String) regularUsers.get (0); + dataset.addValue ((Double) regularUsers.get (1), "last 7 days", event); + dataset.addValue ((Double) regularUsers.get (2), "last 30 days", event); + dataset.addValue ((Double) regularUsers.get (3), "last 365 days", event); + } + + return dataset; + } + + + private CategoryDataset getToolAnalysisDataSet () + { + List<ServerWideStatsRecord> toolCountList = getToolCount (); + if (toolCountList == null) { + return null; + } + + DefaultCategoryDataset dataset = new DefaultCategoryDataset (); + + for (ServerWideStatsRecord regularUsers : toolCountList) { + String toolId = (String) regularUsers.get (0); + dataset.addValue ((Integer) regularUsers.get (1), "", toolId); + } + + return dataset; + } + + + private byte[] createMonthlyLoginChart (int width, int height) + { + IntervalXYDataset dataset1 = getMonthlyLoginsDataSet(); + IntervalXYDataset dataset3 = getMonthlySiteUserDataSet(); + + if ((dataset1 == null) || (dataset3 == null)) { + return generateNoDataChart(width, height); + } + + // create plot ... + XYItemRenderer renderer1 = new XYLineAndShapeRenderer(true, false); + renderer1.setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); + renderer1.setSeriesPaint (0, Color.RED); + + DateAxis domainAxis = new DateAxis(""); + domainAxis.setTickUnit (new DateTickUnit (DateTickUnit.MONTH, 1, new SimpleDateFormat ("yyyy-MM"))); + domainAxis.setTickMarkPosition (DateTickMarkPosition.START); + domainAxis.setVerticalTickLabels (true); + domainAxis.setLowerMargin (0.01); + domainAxis.setUpperMargin (0.01); + + NumberAxis axis1 = new NumberAxis("Total Logins"); + axis1.setStandardTickUnits (NumberAxis.createIntegerTickUnits ()); + axis1.setLabelPaint(Color.RED); + axis1.setTickLabelPaint(Color.RED); + + XYPlot plot1 = new XYPlot(dataset1, null, axis1, renderer1); + plot1.setBackgroundPaint(Color.lightGray); + plot1.setDomainGridlinePaint(Color.white); + plot1.setRangeGridlinePaint(Color.white); + + // AXIS 2 + /* + NumberAxis axis2 = new NumberAxis("Total Unique Users"); + axis2.setStandardTickUnits (NumberAxis.createIntegerTickUnits ()); + axis2.setLabelPaint(Color.BLUE); + axis2.setTickLabelPaint(Color.BLUE); + plot1.setRangeAxis(1, axis2); + + plot1.setDataset(1, dataset2); + plot1.mapDatasetToRangeAxis(1, 1); + XYItemRenderer renderer2 = new XYLineAndShapeRenderer(true, false); + renderer2.setSeriesStroke(0, new BasicStroke(2.0f, + BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); + renderer2.setSeriesPaint (0, Color.BLUE); + plot1.setRenderer(1, renderer2); + */ + + // add a third dataset and renderer... + XYItemRenderer renderer3 = new XYLineAndShapeRenderer(true, false); + renderer3.setSeriesStroke(0, new BasicStroke(2.0f, + BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); + renderer3.setSeriesStroke(1, new BasicStroke(2.0f, + BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); + renderer3.setSeriesStroke(2, new BasicStroke(2.0f, + BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); + renderer3.setSeriesPaint(0, Color.GREEN); + renderer3.setSeriesPaint(1, Color.BLACK); + renderer3.setSeriesPaint(2, Color.CYAN); + + axis1 = new NumberAxis("count"); + axis1.setStandardTickUnits (NumberAxis.createIntegerTickUnits ()); + + XYPlot plot2 = new XYPlot(dataset3, null, axis1, renderer3); + plot2.setBackgroundPaint(Color.lightGray); + plot2.setDomainGridlinePaint(Color.white); + plot2.setRangeGridlinePaint(Color.white); + + CombinedDomainXYPlot cplot = new CombinedDomainXYPlot(domainAxis); + cplot.add(plot1, 3); + cplot.add(plot2, 2); + cplot.setGap(8.0); + cplot.setDomainGridlinePaint(Color.white); + cplot.setDomainGridlinesVisible(true); + + // return a new chart containing the overlaid plot... + JFreeChart chart = new JFreeChart(null, + JFreeChart.DEFAULT_TITLE_FONT, cplot, false); + LegendTitle legend = new LegendTitle(cplot); + chart.addSubtitle(legend); + + // set background + chart.setBackgroundPaint (parseColor (statsManager.getChartBackgroundColor ())); + + // set chart border + chart.setPadding (new RectangleInsets (10, 5, 5, 5)); + chart.setBorderVisible (true); + chart.setBorderPaint (parseColor ("#cccccc")); + + // set anti alias + chart.setAntiAlias (true); + + BufferedImage img = chart.createBufferedImage (width, height); + final ByteArrayOutputStream out = new ByteArrayOutputStream(); + try{ + ImageIO.write(img, "png", out); + }catch(IOException e){ + log.warn("Error occurred while generating SiteStats chart image data", e); + } + return out.toByteArray(); + } + + + private byte[] createWeeklyLoginChart (int width, int height) + { + IntervalXYDataset dataset1 = getWeeklyLoginsDataSet (); + IntervalXYDataset dataset2 = getWeeklySiteUserDataSet (); + + if ((dataset1 == null) || (dataset2 == null)) { + return generateNoDataChart(width, height); + } + + // create plot ... + XYItemRenderer renderer1 = new XYLineAndShapeRenderer(true, false); + renderer1.setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); + renderer1.setSeriesStroke(1, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); + renderer1.setSeriesPaint(0, Color.RED); + renderer1.setSeriesPaint(0, Color.BLUE); + + DateAxis domainAxis = new DateAxis(""); + domainAxis.setTickUnit (new DateTickUnit (DateTickUnit.DAY, 7, new SimpleDateFormat ("yyyy-MM-dd"))); + domainAxis.setTickMarkPosition (DateTickMarkPosition.START); + domainAxis.setVerticalTickLabels (true); + domainAxis.setLowerMargin (0.01); + domainAxis.setUpperMargin (0.01); + + NumberAxis rangeAxis = new NumberAxis("count"); + rangeAxis.setStandardTickUnits (NumberAxis.createIntegerTickUnits ()); + + XYPlot plot1 = new XYPlot(dataset1, null, rangeAxis, renderer1); + plot1.setBackgroundPaint(Color.lightGray); + plot1.setDomainGridlinePaint(Color.white); + plot1.setRangeGridlinePaint(Color.white); + + // add a second dataset and renderer... + XYItemRenderer renderer2 = new XYLineAndShapeRenderer(true, false); + renderer2.setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); + renderer2.setSeriesStroke(1, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); + renderer2.setSeriesStroke(2, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); + renderer2.setSeriesPaint(0, Color.GREEN); + renderer2.setSeriesPaint(1, Color.BLACK); + renderer2.setSeriesPaint(2, Color.CYAN); + + rangeAxis = new NumberAxis("count"); + rangeAxis.setStandardTickUnits (NumberAxis.createIntegerTickUnits ()); + + XYPlot plot2 = new XYPlot(dataset2, null, rangeAxis, renderer2); + plot2.setBackgroundPaint(Color.lightGray); + plot2.setDomainGridlinePaint(Color.white); + plot2.setRangeGridlinePaint(Color.white); + + CombinedDomainXYPlot cplot = new CombinedDomainXYPlot(domainAxis); + cplot.add(plot1, 3); + cplot.add(plot2, 2); + cplot.setGap(8.0); + cplot.setDomainGridlinePaint(Color.white); + cplot.setDomainGridlinesVisible(true); + + // return a new chart containing the overlaid plot... + JFreeChart chart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, cplot, false); + LegendTitle legend = new LegendTitle(cplot); + chart.addSubtitle(legend); + + // set background + chart.setBackgroundPaint (parseColor (statsManager.getChartBackgroundColor ())); + + // set chart border + chart.setPadding (new RectangleInsets (10, 5, 5, 5)); + chart.setBorderVisible (true); + chart.setBorderPaint (parseColor ("#cccccc")); + + // set anti alias + chart.setAntiAlias (true); + + BufferedImage img = chart.createBufferedImage (width, height); + final ByteArrayOutputStream out = new ByteArrayOutputStream(); + try{ + ImageIO.write(img, "png", out); + }catch(IOException e){ + log.warn("Error occurred while generating SiteStats chart image data", e); + } + return out.toByteArray(); + } + + private byte[] createDailyLoginChart (int width, int height) + { + IntervalXYDataset dataset1 = getDailyLoginsDataSet(); + IntervalXYDataset dataset2 = getDailySiteUserDataSet(); + + if ((dataset1 == null) || (dataset2 == null)) { + return generateNoDataChart(width, height); + } + + // create plot ... + XYItemRenderer renderer1 = new XYLineAndShapeRenderer(true, false); + renderer1.setSeriesPaint (0, Color.RED); + renderer1.setSeriesPaint (1, Color.BLUE); + renderer1.setSeriesPaint (2, Color.RED); + renderer1.setSeriesPaint (3, Color.BLUE); + renderer1.setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); + renderer1.setSeriesStroke(1, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); + BasicStroke dashLineStroke = new BasicStroke (2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 0, new float[] { 4 }, 0); + renderer1.setSeriesStroke (2, dashLineStroke); + renderer1.setSeriesStroke (3, dashLineStroke); + + + DateAxis domainAxis = new DateAxis(""); + domainAxis.setTickUnit (new DateTickUnit (DateTickUnit.DAY, 7, new SimpleDateFormat ("yyyy-MM-dd"))); + domainAxis.setTickMarkPosition (DateTickMarkPosition.START); + domainAxis.setVerticalTickLabels (true); + domainAxis.setLowerMargin (0.01); + domainAxis.setUpperMargin (0.01); + + NumberAxis rangeAxis = new NumberAxis("count"); + rangeAxis.setStandardTickUnits (NumberAxis.createIntegerTickUnits ()); + + XYPlot plot1 = new XYPlot(dataset1, null, rangeAxis, renderer1); + plot1.setBackgroundPaint(Color.lightGray); + plot1.setDomainGridlinePaint(Color.white); + plot1.setRangeGridlinePaint(Color.white); + + // add a second dataset and renderer... + XYItemRenderer renderer2 = new XYLineAndShapeRenderer(true, false); + renderer2.setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); + renderer2.setSeriesStroke(1, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); + renderer2.setSeriesStroke(2, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); + renderer2.setSeriesPaint(0, Color.GREEN); + renderer2.setSeriesPaint(1, Color.BLACK); + renderer2.setSeriesPaint(2, Color.CYAN); + + rangeAxis = new NumberAxis("count"); + rangeAxis.setStandardTickUnits (NumberAxis.createIntegerTickUnits ()); + + XYPlot plot2 = new XYPlot(dataset2, null, rangeAxis, renderer2); + plot2.setBackgroundPaint(Color.lightGray); + plot2.setDomainGridlinePaint(Color.white); + plot2.setRangeGridlinePaint(Color.white); + + CombinedDomainXYPlot cplot = new CombinedDomainXYPlot(domainAxis); + cplot.add(plot1, 3); + cplot.add(plot2, 2); + cplot.setGap(8.0); + cplot.setDomainGridlinePaint(Color.white); + cplot.setDomainGridlinesVisible(true); + + // return a new chart containing the overlaid plot... + JFreeChart chart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, cplot, false); + LegendTitle legend = new LegendTitle(cplot); + chart.addSubtitle(legend); + + // set background + chart.setBackgroundPaint (parseColor (statsManager.getChartBackgroundColor ())); + + // set chart border + chart.setPadding (new RectangleInsets (10, 5, 5, 5)); + chart.setBorderVisible (true); + chart.setBorderPaint (parseColor ("#cccccc")); + + // set anti alias + chart.setAntiAlias (true); + + BufferedImage img = chart.createBufferedImage (width, height); + final ByteArrayOutputStream out = new ByteArrayOutputStream(); + try{ + ImageIO.write(img, "png", out); + }catch(IOException e){ + log.warn("Error occurred while generating SiteStats chart image data", e); + } + return out.toByteArray(); + } + + private byte[] generateStackedAreaChart (CategoryDataset dataset, int width, int height) + { + JFreeChart chart = ChartFactory.createStackedAreaChart (null, // chart title + null, // domain axis label + null, // range axis label + dataset, // data + PlotOrientation.VERTICAL, // the plot orientation + true, // legend + true, // tooltips + false // urls + ); + + // set background + chart.setBackgroundPaint (parseColor (statsManager.getChartBackgroundColor ())); + + // set chart border + chart.setPadding (new RectangleInsets (10, 5, 5, 5)); + chart.setBorderVisible (true); + chart.setBorderPaint (parseColor ("#cccccc")); + + // set anti alias + chart.setAntiAlias (true); + + CategoryPlot plot = (CategoryPlot) chart.getPlot (); + + // set transparency + plot.setForegroundAlpha (0.7f); + plot.setAxisOffset (new RectangleInsets (5.0, 5.0, 5.0, 5.0)); + plot.setBackgroundPaint (Color.lightGray); + plot.setDomainGridlinesVisible (true); + plot.setDomainGridlinePaint (Color.white); + plot.setRangeGridlinesVisible (true); + plot.setRangeGridlinePaint (Color.white); + + // set colour of regular users using Karate belt colour: white, green, blue, brown, black/gold + CategoryItemRenderer renderer = plot.getRenderer (); + renderer.setSeriesPaint (0, new Color (205, 173, 0)); // gold users + renderer.setSeriesPaint (1, new Color (139, 69, 19)); + renderer.setSeriesPaint (2, Color.BLUE); + renderer.setSeriesPaint (3, Color.GREEN); + renderer.setSeriesPaint (4, Color.WHITE); + + // set the range axis to display integers only... + NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis (); + rangeAxis.setStandardTickUnits (NumberAxis.createIntegerTickUnits ()); + + CategoryAxis domainAxis = (CategoryAxis) plot.getDomainAxis (); + domainAxis.setCategoryLabelPositions (CategoryLabelPositions.DOWN_45); + domainAxis.setLowerMargin(0.0); + domainAxis.setUpperMargin(0.0); + + BufferedImage img = chart.createBufferedImage (width, height); + final ByteArrayOutputStream out = new ByteArrayOutputStream(); + try{ + ImageIO.write(img, "png", out); + }catch(IOException e){ + log.warn("Error occurred while generating SiteStats chart image data", e); + } + return out.toByteArray(); + } + + private byte[] generateBoxAndWhiskerChart (BoxAndWhiskerCategoryDataset dataset, int width, int height) + { + JFreeChart chart = ChartFactory.createBoxAndWhiskerChart (null, null, + null, dataset, false); + + // set background + chart.setBackgroundPaint (parseColor (statsManager.getChartBackgroundColor ())); + + // set chart border + chart.setPadding (new RectangleInsets (10, 5, 5, 5)); + chart.setBorderVisible (true); + chart.setBorderPaint (parseColor ("#cccccc")); + + // set anti alias + chart.setAntiAlias (true); + + CategoryPlot plot = (CategoryPlot) chart.getPlot (); + + plot.setDomainGridlinePaint (Color.white); + plot.setDomainGridlinesVisible (true); + plot.setRangeGridlinePaint (Color.white); + + NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis (); + rangeAxis.setStandardTickUnits (NumberAxis.createIntegerTickUnits ()); + + CategoryAxis domainAxis = (CategoryAxis) plot.getDomainAxis (); + domainAxis.setLowerMargin (0.0); + domainAxis.setUpperMargin (0.0); + + BufferedImage img = chart.createBufferedImage (width, height); + final ByteArrayOutputStream out = new ByteArrayOutputStream(); + try{ + ImageIO.write(img, "png", out); + }catch(IOException e){ + log.warn("Error occurred while generating SiteStats chart image data", e); + } + return out.toByteArray(); + } + + private byte[] generateLayeredBarChart (CategoryDataset dataset, int width, int height) + { + JFreeChart chart = ChartFactory.createBarChart (null, // chart title + null, // domain axis label + null, // range axis label + dataset, // data + PlotOrientation.VERTICAL, // the plot orientation + true, // legend + true, // tooltips + false // urls + ); + + // set background + chart.setBackgroundPaint (parseColor (statsManager.getChartBackgroundColor ())); + + // set chart border + chart.setPadding (new RectangleInsets (10, 5, 5, 5)); + chart.setBorderVisible (true); + chart.setBorderPaint (parseColor ("#cccccc")); + + // set anti alias + chart.setAntiAlias (true); + + CategoryPlot plot = (CategoryPlot) chart.getPlot (); + + // disable bar outlines... + LayeredBarRenderer renderer = new LayeredBarRenderer (); + renderer.setDrawBarOutline (false); + renderer.setSeriesBarWidth (0, .6); + renderer.setSeriesBarWidth (1, .8); + renderer.setSeriesBarWidth (2, 1.0); + plot.setRenderer (renderer); + + // for this renderer, we need to draw the first series last... + plot.setRowRenderingOrder (SortOrder.DESCENDING); + + // set up gradient paints for series... + GradientPaint gp0 = new GradientPaint (0.0f, 0.0f, Color.blue, 0.0f, + 0.0f, new Color (0, 0, 64)); + GradientPaint gp1 = new GradientPaint (0.0f, 0.0f, Color.green, 0.0f, + 0.0f, new Color (0, 64, 0)); + GradientPaint gp2 = new GradientPaint (0.0f, 0.0f, Color.red, 0.0f, + 0.0f, new Color (64, 0, 0)); + renderer.setSeriesPaint (0, gp0); + renderer.setSeriesPaint (1, gp1); + renderer.setSeriesPaint (2, gp2); + + CategoryAxis domainAxis = (CategoryAxis) plot.getDomainAxis (); + domainAxis.setCategoryLabelPositions (CategoryLabelPositions.DOWN_45); + domainAxis.setLowerMargin (0.0); + domainAxis.setUpperMargin (0.0); + + BufferedImage img = chart.createBufferedImage (width, height); + final ByteArrayOutputStream out = new ByteArrayOutputStream(); + try{ + ImageIO.write(img, "png", out); + }catch(IOException e){ + log.warn("Error occurred while generating SiteStats chart image data", e); + } + return out.toByteArray(); + } + + private byte[] createToolAnalysisChart (int width, int height) + { + CategoryDataset dataset = getToolAnalysisDataSet (); + + if (dataset == null) { + return generateNoDataChart(width, height); + } + + JFreeChart chart = ChartFactory.createBarChart ( + null, // chart title + null, // domain axis label + null, // range axis label + dataset, // data + PlotOrientation.HORIZONTAL, // the plot orientation + false, // legend + false, // tooltips + false // urls + ); + + // set background + chart.setBackgroundPaint (parseColor (statsManager.getChartBackgroundColor ())); + + // set chart border + chart.setPadding (new RectangleInsets (10, 5, 5, 5)); + chart.setBorderVisible (true); + chart.setBorderPaint (parseColor ("#cccccc")); + + // set anti alias + chart.setAntiAlias (true); + + CategoryPlot plot = (CategoryPlot) chart.getPlot (); + + // set transparency + plot.setForegroundAlpha (0.7f); + plot.setAxisOffset (new RectangleInsets (5.0, 5.0, 5.0, 5.0)); + plot.setBackgroundPaint (Color.lightGray); + plot.setDomainGridlinesVisible (false); + plot.setRangeGridlinesVisible (true); + plot.setRangeGridlinePaint (Color.white); + + CategoryAxis domainAxis = plot.getDomainAxis(); + domainAxis.setVisible(false); + domainAxis.setUpperMargin (0); + domainAxis.setLowerMargin (0); + + NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); + rangeAxis.setUpperMargin(0.20); + rangeAxis.setStandardTickUnits (NumberAxis.createIntegerTickUnits ()); + + BarRenderer renderer = (BarRenderer) plot.getRenderer(); + CategoryItemLabelGenerator generator + = new StandardCategoryItemLabelGenerator("{1}", + NumberFormat.getInstance(new ResourceLoader().getLocale())); + renderer.setBaseItemLabelGenerator(generator); + renderer.setBaseItemLabelFont(new Font("SansSerif", Font.PLAIN, 9)); + renderer.setBaseItemLabelsVisible(true); + renderer.setItemMargin (0); + renderer.setSeriesPaint (0, Color.BLUE); + + BufferedImage img = chart.createBufferedImage (width, height); + final ByteArrayOutputStream out = new ByteArrayOutputStream(); + try{ + ImageIO.write(img, "png", out); + }catch(IOException e){ + log.warn("Error occurred while generating SiteStats chart image data", e); + } + return out.toByteArray(); + } + + private byte[] generateNoDataChart(int width, int height) { + BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); + Graphics2D g2d = img.createGraphics(); + + g2d.setBackground(parseColor(statsManager.getChartBackgroundColor())); + g2d.clearRect(0, 0, width-1, height-1); + g2d.setColor(parseColor("#cccccc")); + g2d.drawRect(0, 0, width-1, height-1); + Font f = new Font("SansSerif", Font.PLAIN, 12); + g2d.setFont(f); + FontMetrics fm = g2d.getFontMetrics(f); + String noData = msgs.getString("no_data"); + int noDataWidth = fm.stringWidth(noData); + int noDataHeight = fm.getHeight(); + g2d.setColor(parseColor("#555555")); + g2d.drawString(noData, width/2 - noDataWidth/2, height/2 - noDataHeight/2 + 2); + final ByteArrayOutputStream out = new ByteArrayOutputStream(); + try{ + ImageIO.write(img, "png", out); + }catch(IOException e){ + log.warn("Error occurred while generating SiteStats chart image data", e); + } + return out.toByteArray(); + } + + + + public static Color parseColor(String color) { + if(color != null) { + if(color.trim().startsWith("#")){ + // HTML colors (#FFFFFF format) + return new Color(Integer.parseInt(color.substring(1), 16)); + }else if(color.trim().startsWith("rgb")){ + // HTML colors (rgb(255, 255, 255) format) + String values = color.substring(color.indexOf("(") + 1, color.indexOf(")")); + String rgb[] = values.split(","); + return new Color(Integer.parseInt(rgb[0].trim()), Integer.parseInt(rgb[1].trim()), Integer.parseInt(rgb[2].trim())); + }else{ + // Colors by name + if(color.equalsIgnoreCase("black")) return Color.black; + if(color.equalsIgnoreCase("grey")) return Color.gray; + if(color.equalsIgnoreCase("yellow")) return Color.yellow; + if(color.equalsIgnoreCase("green")) return Color.green; + if(color.equalsIgnoreCase("blue")) return Color.blue; + if(color.equalsIgnoreCase("red")) return Color.red; + if(color.equalsIgnoreCase("orange")) return Color.orange; + if(color.equalsIgnoreCase("cyan")) return Color.cyan; + if(color.equalsIgnoreCase("magenta")) return Color.magenta; + if(color.equalsIgnoreCase("darkgray")) return Color.darkGray; + if(color.equalsIgnoreCase("lightgray")) return Color.lightGray; + if(color.equalsIgnoreCase("pink")) return Color.pink; + if(color.equalsIgnoreCase("white")) return Color.white; + } + } + log.info("Unable to parse body background-color (color:" + color+"). Assuming white."); + return Color.white; + } + + /** + * Helper method to return the appropriate SQL for the DB vendor + * Everything should be lowercase. + * @return + */ + private String getSqlForVendor(String mysql, String oracle) { + if(StringUtils.equals(dbVendor, "mysql")){ + return mysql; + } + if(StringUtils.equals(dbVendor, "oracle")){ + return oracle; + } + return null; + } + + /** + * Helper to get the externalDbName as a prefix to be used directly in queries, . is appended + * If its not configured, then an empty string is returned so that whatever this returns can be used as-is + * @return + */ + private String getExternalDbNameAsPrefix() { + if(StringUtils.isNotBlank(externalDbName)) { + return externalDbName+"."; + } else { + return ""; + } + } + +} diff --git a/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/StatsAggregateJobImpl.java b/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/StatsAggregateJobImpl.java index 5f8e0eed5359..734033d2fa97 100644 --- a/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/StatsAggregateJobImpl.java +++ b/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/StatsAggregateJobImpl.java @@ -28,8 +28,8 @@ import java.util.Date; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.quartz.SchedulerException; @@ -42,7 +42,7 @@ public class StatsAggregateJobImpl implements StatefulJob { - private Log LOG = LogFactory.getLog(StatsAggregateJobImpl.class); + private Logger LOG = LoggerFactory.getLogger(StatsAggregateJobImpl.class); // Spring fields private int maxEventsPerRun = 0; diff --git a/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/StatsAuthzImpl.java b/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/StatsAuthzImpl.java index e44a88fecb75..f83de33fd202 100644 --- a/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/StatsAuthzImpl.java +++ b/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/StatsAuthzImpl.java @@ -18,8 +18,8 @@ */ package org.sakaiproject.sitestats.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.SecurityService; import org.sakaiproject.authz.cover.FunctionManager; import org.sakaiproject.site.cover.SiteService; @@ -31,7 +31,7 @@ public class StatsAuthzImpl implements StatsAuthz { - private static Log LOG = LogFactory.getLog(StatsAuthzImpl.class); + private static Logger LOG = LoggerFactory.getLogger(StatsAuthzImpl.class); /** Sakai services */ private UserDirectoryService M_uds; diff --git a/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/StatsManagerImpl.java b/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/StatsManagerImpl.java index 9a5416902f81..09b3b6baf9db 100644 --- a/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/StatsManagerImpl.java +++ b/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/StatsManagerImpl.java @@ -37,8 +37,8 @@ import org.apache.commons.digester.Digester; import org.apache.commons.lang.StringEscapeUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.Criteria; import org.hibernate.HibernateException; import org.hibernate.FlushMode; @@ -102,7 +102,7 @@ * */ public class StatsManagerImpl extends HibernateDaoSupport implements StatsManager, Observer { - private Log LOG = LogFactory.getLog(StatsManagerImpl.class); + private Logger LOG = LoggerFactory.getLogger(StatsManagerImpl.class); /** Spring bean members */ private Boolean enableSiteVisits = null; diff --git a/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/StatsUpdateManagerImpl.java b/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/StatsUpdateManagerImpl.java index ea915ee61122..0456432de67d 100644 --- a/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/StatsUpdateManagerImpl.java +++ b/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/StatsUpdateManagerImpl.java @@ -34,8 +34,8 @@ import java.util.concurrent.locks.ReentrantLock; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.hibernate.Criteria; import org.hibernate.HibernateException; import org.hibernate.Query; @@ -65,7 +65,7 @@ * @author <a href="mailto:nuno@ufp.pt">Nuno Fernandes</a> */ public class StatsUpdateManagerImpl extends HibernateDaoSupport implements Runnable, StatsUpdateManager, Observer, StatsUpdateManagerMXBean { - private Log LOG = LogFactory.getLog(StatsUpdateManagerImpl.class); + private Logger LOG = LoggerFactory.getLogger(StatsUpdateManagerImpl.class); private final static String PRESENCE_SUFFIX = "-presence"; private final static int PRESENCE_SUFFIX_LENGTH = PRESENCE_SUFFIX.length(); diff --git a/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/chart/ChartServiceImpl.java b/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/chart/ChartServiceImpl.java index 6499cf1bdf3d..eeb8451f162a 100644 --- a/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/chart/ChartServiceImpl.java +++ b/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/chart/ChartServiceImpl.java @@ -38,8 +38,8 @@ import javax.imageio.ImageIO; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.jfree.chart.ChartFactory; import org.jfree.chart.JFreeChart; import org.jfree.chart.axis.PeriodAxis; @@ -96,7 +96,7 @@ public class ChartServiceImpl implements ChartService { /** Static fields */ - private static Log LOG = LogFactory.getLog(EventRegistryServiceImpl.class); + private static Logger LOG = LoggerFactory.getLogger(EventRegistryServiceImpl.class); private static ResourceLoader msgs = new ResourceLoader("Messages"); private static final int MIN_CHART_WIDTH_TO_DRAW_ALL_DAYS = 640; diff --git a/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/event/EntityBrokerEventRegistry.java b/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/event/EntityBrokerEventRegistry.java index 39ec4190dfba..8b7c936b5945 100644 --- a/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/event/EntityBrokerEventRegistry.java +++ b/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/event/EntityBrokerEventRegistry.java @@ -18,8 +18,8 @@ */ package org.sakaiproject.sitestats.impl.event; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.entity.api.ResourceProperties; import org.sakaiproject.entitybroker.entityprovider.EntityProviderManager; import org.sakaiproject.entitybroker.entityprovider.capabilities.Statisticable; @@ -39,7 +39,7 @@ public class EntityBrokerEventRegistry extends Observable implements EventRegistry, EntityProviderListener<Statisticable> { - private static Log LOG = LogFactory.getLog(EntityBrokerEventRegistry.class); + private static Logger LOG = LoggerFactory.getLogger(EntityBrokerEventRegistry.class); private static final String CACHENAME = EntityBrokerEventRegistry.class.getName(); /** Event Registry members */ diff --git a/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/event/EventRegistryServiceImpl.java b/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/event/EventRegistryServiceImpl.java index d7bd7ada7f1f..2707b7c128fc 100644 --- a/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/event/EventRegistryServiceImpl.java +++ b/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/event/EventRegistryServiceImpl.java @@ -18,8 +18,8 @@ */ package org.sakaiproject.sitestats.impl.event; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.memory.api.Cache; import org.sakaiproject.memory.api.MemoryService; @@ -42,7 +42,7 @@ public class EventRegistryServiceImpl implements EventRegistry, EventRegistryService, Observer { /** Static fields */ - private static Log LOG = LogFactory.getLog(EventRegistryServiceImpl.class); + private static Logger LOG = LoggerFactory.getLogger(EventRegistryServiceImpl.class); private static final String CACHENAME = EventRegistryServiceImpl.class.getName(); private static final String CACHENAME_EVENTREGISTRY = "eventRegistry"; private static ResourceLoader msgs = new ResourceLoader("Messages"); diff --git a/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/event/FileEventRegistry.java b/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/event/FileEventRegistry.java index eec1014d25f3..7f2ee91a6766 100644 --- a/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/event/FileEventRegistry.java +++ b/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/event/FileEventRegistry.java @@ -24,8 +24,8 @@ import java.util.List; import java.util.MissingResourceException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.sitestats.api.event.EventRegistry; import org.sakaiproject.sitestats.api.event.ToolInfo; import org.sakaiproject.sitestats.impl.parser.DigesterUtil; @@ -36,7 +36,7 @@ public class FileEventRegistry implements EventRegistry { /** Static fields */ public final static String TOOL_EVENTS_DEF_FILE = "toolEventsDef.xml"; - private Log LOG = LogFactory.getLog(FileEventRegistry.class); + private Logger LOG = LoggerFactory.getLogger(FileEventRegistry.class); private static ResourceLoader msgs = new ResourceLoader("Events"); /** File based event registry */ diff --git a/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/report/ReportDefEntityProvider.java b/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/report/ReportDefEntityProvider.java index f3d74b524594..07e75ca738d5 100644 --- a/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/report/ReportDefEntityProvider.java +++ b/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/report/ReportDefEntityProvider.java @@ -23,8 +23,8 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.entitybroker.DeveloperHelperService; import org.sakaiproject.entitybroker.EntityReference; import org.sakaiproject.entitybroker.entityprovider.CoreEntityProvider; @@ -37,7 +37,7 @@ public class ReportDefEntityProvider implements AutoRegisterEntityProvider, CoreEntityProvider, Resolvable /*, Importable, Exportable*/ { - private Log LOG = LogFactory.getLog(ReportDefEntityProvider.class); + private Logger LOG = LoggerFactory.getLogger(ReportDefEntityProvider.class); public static final String PREFIX = "sitestats-report"; public static final String LABEL = "SiteStatsReport"; public static final String REFERENCE_ROOT = "/" + PREFIX; diff --git a/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/report/ReportManagerImpl.java b/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/report/ReportManagerImpl.java index 0bfb33e11316..4af501a06960 100644 --- a/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/report/ReportManagerImpl.java +++ b/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/report/ReportManagerImpl.java @@ -18,8 +18,8 @@ */ package org.sakaiproject.sitestats.impl.report; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.fop.apps.*; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; @@ -84,7 +84,7 @@ * */ public class ReportManagerImpl extends HibernateDaoSupport implements ReportManager, Observer { - private Log LOG = LogFactory.getLog(ReportManagerImpl.class); + private Logger LOG = LoggerFactory.getLogger(ReportManagerImpl.class); private static ResourceLoader msgs = new ResourceLoader("Messages"); private ReportFormattedParams formattedParams = new ReportFormattedParamsImpl(); diff --git a/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/report/fop/LibraryURIResolver.java b/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/report/fop/LibraryURIResolver.java index 5225f7293ad4..575f2dae57cd 100644 --- a/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/report/fop/LibraryURIResolver.java +++ b/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/report/fop/LibraryURIResolver.java @@ -27,13 +27,13 @@ import javax.xml.transform.URIResolver; import javax.xml.transform.stream.StreamSource; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.sitestats.api.StatsManager; public class LibraryURIResolver implements URIResolver { - private Log LOG = LogFactory.getLog(LibraryURIResolver.class); + private Logger LOG = LoggerFactory.getLogger(LibraryURIResolver.class); private final static String LIBRARY_HANDLER = "library://"; private final static String SITESTATS_HANDLER = "sitestats://"; private String libraryRoot = null; diff --git a/sitestats/sitestats-impl/src/test/org/sakaiproject/sitestats/test/EventAggregatorTestPerf.java b/sitestats/sitestats-impl/src/test/org/sakaiproject/sitestats/test/EventAggregatorTestPerf.java index 289a1fc1bf64..3cb356e2f302 100755 --- a/sitestats/sitestats-impl/src/test/org/sakaiproject/sitestats/test/EventAggregatorTestPerf.java +++ b/sitestats/sitestats-impl/src/test/org/sakaiproject/sitestats/test/EventAggregatorTestPerf.java @@ -32,8 +32,8 @@ import java.util.List; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.easymock.IAnswer; import org.junit.Before; import org.junit.Test; @@ -67,7 +67,7 @@ public class EventAggregatorTestPerf extends AbstractJUnit4SpringContextTests { private static final int COUNT_RESOURCES_MEDIUM = 10; private static final int COUNT_RESOURCES_LARGE = MAX_RESOURCES; - private Log LOG = LogFactory.getLog(EventAggregatorTestPerf.class); + private Logger LOG = LoggerFactory.getLogger(EventAggregatorTestPerf.class); private StatsManager M_sm; private StatsUpdateManager M_sum; diff --git a/sitestats/sitestats-impl/src/test/org/sakaiproject/sitestats/test/data/FakeDataPreload.java b/sitestats/sitestats-impl/src/test/org/sakaiproject/sitestats/test/data/FakeDataPreload.java index 893c345c4083..4cc7d8e02fb7 100644 --- a/sitestats/sitestats-impl/src/test/org/sakaiproject/sitestats/test/data/FakeDataPreload.java +++ b/sitestats/sitestats-impl/src/test/org/sakaiproject/sitestats/test/data/FakeDataPreload.java @@ -18,13 +18,13 @@ */ package org.sakaiproject.sitestats.test.data; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; public class FakeDataPreload extends AbstractJUnit4SpringContextTests { - private static Log log = LogFactory.getLog(FakeDataPreload.class); + private static Logger log = LoggerFactory.getLogger(FakeDataPreload.class); public void init() { log.info("FakeDataPreload.init()"); diff --git a/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/entityproviders/SiteStatsEntityProvider.java b/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/entityproviders/SiteStatsEntityProvider.java index 79aa89ec1743..aef1a562fb78 100755 --- a/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/entityproviders/SiteStatsEntityProvider.java +++ b/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/entityproviders/SiteStatsEntityProvider.java @@ -24,8 +24,8 @@ import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.entitybroker.exception.EntityException; import org.sakaiproject.entitybroker.EntityView; @@ -53,7 +53,7 @@ @Setter public class SiteStatsEntityProvider extends AbstractEntityProvider implements AutoRegisterEntityProvider, ActionsExecutable, Outputable, Describeable { - private final Log logger = LogFactory.getLog(SiteStatsEntityProvider.class); + private final Logger logger = LoggerFactory.getLogger(SiteStatsEntityProvider.class); public static final String PREFIX = "sitestats"; diff --git a/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/components/AjaxLazyLoadImage.java b/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/components/AjaxLazyLoadImage.java index 89af8931e728..02363d210a25 100644 --- a/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/components/AjaxLazyLoadImage.java +++ b/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/components/AjaxLazyLoadImage.java @@ -18,8 +18,8 @@ */ package org.sakaiproject.sitestats.tool.wicket.components; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.wicket.AttributeModifier; import org.apache.wicket.Component; import org.apache.wicket.Page; @@ -63,7 +63,7 @@ public abstract class AjaxLazyLoadImage extends Panel { private int maxHeight = 600; - private static Log LOG = LogFactory.getLog(AjaxLazyLoadImage.class); + private static Logger LOG = LoggerFactory.getLogger(AjaxLazyLoadImage.class); // State: // 0:add loading component // 1:loading component added, waiting for ajax replace diff --git a/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/models/SiteModel.java b/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/models/SiteModel.java index 03607e11e2da..f5abc3442846 100644 --- a/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/models/SiteModel.java +++ b/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/models/SiteModel.java @@ -18,8 +18,8 @@ */ package org.sakaiproject.sitestats.tool.wicket.models; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.wicket.model.LoadableDetachableModel; import org.sakaiproject.exception.IdUnusedException; import org.sakaiproject.site.api.Site; @@ -28,7 +28,7 @@ public class SiteModel extends LoadableDetachableModel { private static final long serialVersionUID = 1L; - private static Log LOG = LogFactory.getLog(SiteModel.class); + private static Logger LOG = LoggerFactory.getLogger(SiteModel.class); private String id; diff --git a/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/pages/ReportDataPage.java b/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/pages/ReportDataPage.java index 6fb87e9980d9..2b906d367251 100644 --- a/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/pages/ReportDataPage.java +++ b/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/pages/ReportDataPage.java @@ -1,740 +1,740 @@ -/** - * $URL:$ - * $Id:$ - * - * Copyright (c) 2006-2009 The Sakai 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 - * - * http://www.opensource.org/licenses/ECL-2.0 - * - * 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.sakaiproject.sitestats.tool.wicket.pages; - -import java.io.IOException; -import java.io.OutputStream; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Map; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.wicket.AttributeModifier; -import org.apache.wicket.Component; -import org.apache.wicket.request.mapper.parameter.PageParameters; -import org.apache.wicket.request.cycle.RequestCycle; -import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn; -import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn; -import org.apache.wicket.markup.head.IHeaderResponse; -import org.apache.wicket.markup.head.JavaScriptHeaderItem; -import org.apache.wicket.markup.html.WebMarkupContainer; -import org.apache.wicket.markup.html.WebPage; -import org.apache.wicket.markup.html.basic.Label; -import org.apache.wicket.markup.html.form.Button; -import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.markup.html.link.Link; -import org.apache.wicket.markup.repeater.Item; -import org.apache.wicket.model.CompoundPropertyModel; -import org.apache.wicket.model.IModel; -import org.apache.wicket.model.Model; -import org.apache.wicket.model.ResourceModel; -import org.apache.wicket.model.StringResourceModel; -import org.apache.wicket.request.http.WebResponse; -import org.apache.wicket.request.handler.EmptyRequestHandler; -import org.sakaiproject.exception.IdUnusedException; -import org.sakaiproject.site.api.Site; -import org.sakaiproject.sitestats.api.EventStat; -import org.sakaiproject.sitestats.api.PrefsData; -import org.sakaiproject.sitestats.api.LessonBuilderStat; -import org.sakaiproject.sitestats.api.ResourceStat; -import org.sakaiproject.sitestats.api.SitePresence; -import org.sakaiproject.sitestats.api.Stat; -import org.sakaiproject.sitestats.api.StatsManager; -import org.sakaiproject.sitestats.api.Util; -import org.sakaiproject.sitestats.api.event.ToolInfo; -import org.sakaiproject.sitestats.api.report.Report; -import org.sakaiproject.sitestats.api.report.ReportDef; -import org.sakaiproject.sitestats.api.report.ReportManager; -import org.sakaiproject.sitestats.api.report.ReportParams; -import org.sakaiproject.sitestats.tool.facade.Locator; -import org.sakaiproject.sitestats.tool.wicket.components.AjaxLazyLoadImage; -import org.sakaiproject.sitestats.tool.wicket.components.ImageWithLink; -import org.sakaiproject.sitestats.tool.wicket.components.LastJobRun; -import org.sakaiproject.sitestats.tool.wicket.components.Menus; -import org.sakaiproject.sitestats.tool.wicket.components.SakaiDataTable; -import org.sakaiproject.sitestats.tool.wicket.models.ReportDefModel; -import org.sakaiproject.sitestats.tool.wicket.providers.ReportsDataProvider; -import org.sakaiproject.user.api.UserNotDefinedException; - -/** - * @author Nuno Fernandes - */ -public class ReportDataPage extends BasePage { - private static final long serialVersionUID = 1L; - private static Log LOG = LogFactory.getLog(ReportDataPage.class); - - private String realSiteId; - private String siteId; - private boolean inPrintVersion; - - private ReportDefModel reportDefModel; - private Report report; - private PrefsData prefsdata; - private WebPage returnPage; - - private AjaxLazyLoadImage reportChart = null; - private byte[] chartImage = null; - private int selectedWidth = 0; - private int selectedHeight = 0; - - public ReportDataPage(final ReportDefModel reportDef) { - this(reportDef, null, null); - } - - public ReportDataPage(final ReportDefModel reportDef, final PageParameters pageParameters) { - this(reportDef, pageParameters, null); - } - - public ReportDataPage(final ReportDefModel reportDef, final PageParameters pageParameters, final WebPage returnPage) { - this.reportDefModel = reportDef; - realSiteId = Locator.getFacade().getToolManager().getCurrentPlacement().getContext(); - if(pageParameters != null) { - siteId = pageParameters.get("siteId").toString(); - inPrintVersion = pageParameters.get("printVersion").toBoolean(false); - } - if(siteId == null){ - siteId = realSiteId; - } - if(returnPage == null) { - this.returnPage = new ReportsPage(pageParameters); - }else{ - this.returnPage = returnPage; - } - boolean allowed = Locator.getFacade().getStatsAuthz().isUserAbleToViewSiteStats(siteId); - if(allowed) { - if(reportDef != null && getReportDef() != null && getReportDef().getReportParams() != null) { - renderBody(); - }else{ - setResponsePage(ReportsPage.class); - } - }else{ - setResponsePage(NotAuthorizedPage.class); - } - } - - @Override - public void renderHead(IHeaderResponse response) { - super.renderHead(response); - response.render(JavaScriptHeaderItem.forUrl(JQUERYSCRIPT)); - } - - @SuppressWarnings("serial") - private void renderBody() { - // reportAction - if(getReportDef().getTitle() != null && getReportDef().getTitle().trim().length() != 0) { - String titleStr = null; - if(getReportDef().isTitleLocalized()) { - titleStr = (String) new ResourceModel("reportres_title_detailed").getObject(); - titleStr = titleStr.replaceAll("\\$\\{title\\}", (String) new ResourceModel(getReportDef().getTitleBundleKey()).getObject()); - }else{ - titleStr = new StringResourceModel("reportres_title_detailed", this, reportDefModel).getString(); - } - add(new Label("reportAction", titleStr)); - }else{ - add(new Label("reportAction", new ResourceModel("reportres_title"))); - } - - // model - setDefaultModel(new CompoundPropertyModel(this)); - - // form - Form form = new Form("form"); - add(form); - - // menu - add(new Menus("menu", siteId).setVisible(!inPrintVersion)); - - // last job run - add(new LastJobRun("lastJobRun", siteId)); - - // print link/info - WebMarkupContainer toPrintVersion = new WebMarkupContainer("toPrintVersion"); - toPrintVersion.setVisible(!inPrintVersion); - toPrintVersion.add(new Link("printLink") { - @Override - public void onClick() { - PageParameters params = new PageParameters(); - params.set("printVersion", "true"); - params.set("siteId", siteId); - setResponsePage(new ReportDataPage(reportDefModel, params)); - } - }); - add(toPrintVersion); - add(new WebMarkupContainer("inPrintVersion").setVisible(inPrintVersion)); - - // Report data - final ReportsDataProvider dataProvider = new ReportsDataProvider(getPrefsdata(), getReportDef()); - report = dataProvider.getReport(); - - // Report: chart - reportChart = new AjaxLazyLoadImage("reportChart", getPage()) { - @Override - public byte[] getImageData() { - return getChartImage(); - } - - @Override - public byte[] getImageData(int width, int height) { - return getChartImage(width, height); - } - }; - reportChart.setOutputMarkupId(true); - add(reportChart); - if(ReportManager.HOW_PRESENTATION_CHART.equals(report.getReportDefinition().getReportParams().getHowPresentationMode()) - || ReportManager.HOW_PRESENTATION_BOTH.equals(report.getReportDefinition().getReportParams().getHowPresentationMode()) ) { - reportChart.setVisible(true); - reportChart.setAutoDetermineChartSizeByAjax(".chartContainer"); - }else{ - reportChart.setVisible(false); - } - - // Report: table - SakaiDataTable reportTable = new SakaiDataTable( - "table", - getTableColumns(getReportParams(), true), - dataProvider, - !inPrintVersion); - if(inPrintVersion) { - reportTable.setItemsPerPage(Integer.MAX_VALUE); - } - reportTable.setVisible( - ReportManager.HOW_PRESENTATION_TABLE.equals(report.getReportDefinition().getReportParams().getHowPresentationMode()) - || ReportManager.HOW_PRESENTATION_BOTH.equals(report.getReportDefinition().getReportParams().getHowPresentationMode()) - ); - form.add(reportTable); - - - // Report: header (report info) - WebMarkupContainer trDescription = new WebMarkupContainer("trDescription"); - trDescription.setVisible(getReportDescription() != null); - trDescription.add(new Label("reportDescription")); - add(trDescription); - - add(new Label("reportSite")); - - add(new Label("reportActivityBasedOn")); - - WebMarkupContainer trResourceAction = new WebMarkupContainer("trResourceAction"); - trResourceAction.setVisible(getReportResourceAction() != null); - trResourceAction.add(new Label("reportResourceActionTitle")); - trResourceAction.add(new Label("reportResourceAction")); - add(trResourceAction); - - WebMarkupContainer trActivitySelection = new WebMarkupContainer("trActivitySelection"); - trActivitySelection.setVisible(getReportActivitySelection() != null); - trActivitySelection.add(new Label("reportActivitySelectionTitle")); - trActivitySelection.add(new Label("reportActivitySelection")); - add(trActivitySelection); - - add(new Label("reportTimePeriod")); - - add(new Label("reportUserSelectionType")); - - WebMarkupContainer trReportUserSelection = new WebMarkupContainer("trReportUserSelection"); - trReportUserSelection.setVisible(getReportUserSelectionTitle() != null); - trReportUserSelection.add(new Label("reportUserSelectionTitle")); - trReportUserSelection.add(new Label("reportUserSelection")); - add(trReportUserSelection); - - add(new Label("report.localizedReportGenerationDate")); - - - // buttons - form.add(new Button("back") { - @Override - public void onSubmit() { - setResponsePage(returnPage); - super.onSubmit(); - } - }.setVisible(!inPrintVersion)); - form.add(new Button("export") { - @Override - public void onSubmit() { - super.onSubmit(); - } - }.setDefaultFormProcessing(false).setVisible(Locator.getFacade().getStatsManager().isEnableReportExport() && !inPrintVersion)); - form.add(new Button("exportXls") { - @Override - public void onSubmit() { - exportXls(); - super.onSubmit(); - } - }); - form.add(new Button("exportCsv") { - @Override - public void onSubmit() { - exportCsv(); - super.onSubmit(); - } - }); - form.add(new Button("exportPdf") { - @Override - public void onSubmit() { - exportPdf(); - super.onSubmit(); - } - }); - } - - @SuppressWarnings("serial") - public static List<IColumn> getTableColumns( - final ReportParams reportParams, final boolean columnsSortable - ) { - List<IColumn> columns = new ArrayList<IColumn>(); - final Map<String,ToolInfo> eventIdToolMap = Locator.getFacade().getEventRegistryService().getEventIdToolMap(); - - // site - if(Locator.getFacade().getReportManager().isReportColumnAvailable(reportParams, StatsManager.T_SITE)) { - columns.add(new PropertyColumn(new ResourceModel("th_site"), columnsSortable ? ReportsDataProvider.COL_SITE : null, ReportsDataProvider.COL_SITE) { - @Override - public void populateItem(Item item, String componentId, IModel model) { - final String site = ((Stat) model.getObject()).getSiteId(); - String lbl = "", href = ""; - Site s = null; - try{ - s = Locator.getFacade().getSiteService().getSite(site); - lbl = s.getTitle(); - href = s.getUrl(); - }catch(IdUnusedException e){ - lbl = (String) new ResourceModel("site_unknown").getObject(); - href = null; - } - item.add(new ImageWithLink(componentId, null, href, lbl, "_parent")); - } - }); - } - // user - if(Locator.getFacade().getReportManager().isReportColumnAvailable(reportParams, StatsManager.T_USER)) { - columns.add(new PropertyColumn(new ResourceModel("th_id"), columnsSortable ? ReportsDataProvider.COL_USERID : null, ReportsDataProvider.COL_USERID) { - @Override - public void populateItem(Item item, String componentId, IModel model) { - final String userId = ((Stat) model.getObject()).getUserId(); - String name = null; - if (userId != null) { - if(("-").equals(userId) || ("?").equals(userId)) { - name = "-"; - }else{ - try{ - name = Locator.getFacade().getUserDirectoryService().getUser(userId).getDisplayId(); - }catch(UserNotDefinedException e1){ - name = userId; - } - } - }else{ - name = (String) new ResourceModel("user_unknown").getObject(); - } - item.add(new Label(componentId, name)); - } - }); - columns.add(new PropertyColumn(new ResourceModel("th_user"), columnsSortable ? ReportsDataProvider.COL_USERNAME : null, ReportsDataProvider.COL_USERNAME) { - @Override - public void populateItem(Item item, String componentId, IModel model) { - final String userId = ((Stat) model.getObject()).getUserId(); - String name = null; - if (userId != null) { - if(("-").equals(userId)) { - name = (String) new ResourceModel("user_anonymous").getObject(); - }else if(("?").equals(userId)) { - name = (String) new ResourceModel("user_anonymous_access").getObject(); - }else{ - name= Locator.getFacade().getStatsManager().getUserNameForDisplay(userId); - } - }else{ - name = (String) new ResourceModel("user_unknown").getObject(); - } - item.add(new Label(componentId, name)); - } - }); - } - // tool - if(Locator.getFacade().getReportManager().isReportColumnAvailable(reportParams, StatsManager.T_TOOL)) { - columns.add(new PropertyColumn(new ResourceModel("th_tool"), columnsSortable ? ReportsDataProvider.COL_TOOL : null, ReportsDataProvider.COL_TOOL) { - @Override - public void populateItem(Item item, String componentId, IModel model) { - final String toolId = ((EventStat) model.getObject()).getToolId(); - String toolName = ""; - if(!"".equals(toolId)){ - toolName = Locator.getFacade().getEventRegistryService().getToolName(toolId); - } - Label toolLabel = new Label(componentId, toolName); - String toolIconClass = "toolIcon"; - String toolIconPath = "url(" + Locator.getFacade().getEventRegistryService().getToolIcon(toolId) + ")"; - toolLabel.add(new AttributeModifier("class", new Model(toolIconClass))); - toolLabel.add(new AttributeModifier("style", new Model("background-image: "+toolIconPath))); - toolLabel.add(new AttributeModifier("title", new Model(toolName))); - item.add(toolLabel); - } - }); - } - // event - if(Locator.getFacade().getReportManager().isReportColumnAvailable(reportParams, StatsManager.T_EVENT)) { - columns.add(new PropertyColumn(new ResourceModel("th_event"), columnsSortable ? ReportsDataProvider.COL_EVENT : null, ReportsDataProvider.COL_EVENT) { - @Override - public void populateItem(Item item, String componentId, IModel model) { - final String eventId = ((EventStat) model.getObject()).getEventId(); - String eventName = ""; - if(!"".equals(eventId)){ - eventName = Locator.getFacade().getEventRegistryService().getEventName(eventId); - } - Label eventLabel = new Label(componentId, eventName); - ToolInfo toolInfo = eventIdToolMap.get(eventId); - if(toolInfo != null) { - String toolId = toolInfo.getToolId(); - String toolName = Locator.getFacade().getEventRegistryService().getToolName(toolId); - String toolIconClass = "toolIcon"; - String toolIconPath = "url(" + Locator.getFacade().getEventRegistryService().getToolIcon(toolId) + ")"; - eventLabel.add(new AttributeModifier("class", new Model(toolIconClass))); - eventLabel.add(new AttributeModifier("style", new Model("background-image: "+toolIconPath))); - eventLabel.add(new AttributeModifier("title", new Model(toolName))); - } - item.add(eventLabel); - } - }); - } - // resource - if(Locator.getFacade().getReportManager().isReportColumnAvailable(reportParams, StatsManager.T_RESOURCE)) { - columns.add(new PropertyColumn(new ResourceModel("th_resource"), columnsSortable ? ReportsDataProvider.COL_RESOURCE : null, ReportsDataProvider.COL_RESOURCE) { - @Override - public void populateItem(Item item, String componentId, IModel model) { - final String ref = ((ResourceStat) model.getObject()).getResourceRef(); - String imgUrl = null, lnkUrl = null, lnkLabel = null; - Component resourceComp = null; - if(ref != null && !"".equals(ref)){ - imgUrl = Locator.getFacade().getStatsManager().getResourceImage(ref); - lnkUrl = Locator.getFacade().getStatsManager().getResourceURL(ref); - lnkLabel = Locator.getFacade().getStatsManager().getResourceName(ref); - if(lnkLabel == null) { - lnkLabel = (String) new ResourceModel("resource_unknown").getObject(); - } - } - resourceComp = new ImageWithLink(componentId, imgUrl, lnkUrl, lnkLabel, "_new"); - item.add(resourceComp); - } - }); - } - // resource action - if(Locator.getFacade().getReportManager().isReportColumnAvailable(reportParams, StatsManager.T_RESOURCE_ACTION)) { - columns.add(new PropertyColumn(new ResourceModel("th_action"), columnsSortable ? ReportsDataProvider.COL_ACTION : null, ReportsDataProvider.COL_ACTION) { - @Override - public void populateItem(Item item, String componentId, IModel model) { - final String refAction = ((ResourceStat) model.getObject()).getResourceAction(); - String action = ""; - if(refAction == null){ - action = ""; - }else{ - if(!"".equals(refAction.trim())) - action = (String) new ResourceModel("action_"+refAction).getObject(); - } - item.add(new Label(componentId, action)); - } - }); - } - // lessonbuilder page - if(Locator.getFacade().getReportManager().isReportColumnAvailable(reportParams, StatsManager.T_PAGE)) { - columns.add(new PropertyColumn(new ResourceModel("th_page"), columnsSortable ? ReportsDataProvider.COL_PAGE : null, ReportsDataProvider.COL_PAGE) { - @Override - public void populateItem(Item item, String componentId, IModel model) { - LessonBuilderStat stat = (LessonBuilderStat) model.getObject(); - final String ref = stat.getPageRef(); - String lnkLabel = stat.getPageTitle(); - String imgUrl = "", lnkUrl = ""; - if (lnkLabel == null) { - lnkLabel = (String) new ResourceModel("resource_unknown").getObject(); - } - Component resourceComp = new ImageWithLink(componentId, imgUrl, lnkUrl, lnkLabel, "_new"); - item.add(resourceComp); - } - }); - } - // lessonbuilder page action - if(Locator.getFacade().getReportManager().isReportColumnAvailable(reportParams, StatsManager.T_PAGE_ACTION)) { - columns.add(new PropertyColumn(new ResourceModel("th_action"), columnsSortable ? ReportsDataProvider.COL_ACTION : null, ReportsDataProvider.COL_ACTION) { - @Override - public void populateItem(Item item, String componentId, IModel model) { - final String pageAction = ((LessonBuilderStat) model.getObject()).getPageAction(); - String action = ""; - if (pageAction == null){ - action = ""; - } else { - if (!"".equals(pageAction.trim())) - action = (String) new ResourceModel("action_" + pageAction).getObject(); - } - item.add(new Label(componentId, action)); - } - }); - } - if(Locator.getFacade().getReportManager().isReportColumnAvailable(reportParams, StatsManager.T_DATE)) { - columns.add(new PropertyColumn(new ResourceModel("th_date"), columnsSortable ? ReportsDataProvider.COL_DATE : null, ReportsDataProvider.COL_DATE)); - } - if(Locator.getFacade().getReportManager().isReportColumnAvailable(reportParams, StatsManager.T_DATEMONTH)) { - columns.add(new PropertyColumn(new ResourceModel("th_date"), columnsSortable ? ReportsDataProvider.COL_DATE : null, ReportsDataProvider.COL_DATE) { - @Override - public void populateItem(Item item, String componentId, IModel model) { - final Date date = ((Stat) model.getObject()).getDate(); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM"); - item.add(new Label(componentId, sdf.format(date))); - } - }); - } - if(Locator.getFacade().getReportManager().isReportColumnAvailable(reportParams, StatsManager.T_DATEYEAR)) { - columns.add(new PropertyColumn(new ResourceModel("th_date"), columnsSortable ? ReportsDataProvider.COL_DATE : null, ReportsDataProvider.COL_DATE) { - @Override - public void populateItem(Item item, String componentId, IModel model) { - final Date date = ((Stat) model.getObject()).getDate(); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); - item.add(new Label(componentId, sdf.format(date))); - } - }); - } - if(Locator.getFacade().getReportManager().isReportColumnAvailable(reportParams, StatsManager.T_LASTDATE)) { - columns.add(new PropertyColumn(new ResourceModel("th_lastdate"), columnsSortable ? ReportsDataProvider.COL_DATE : null, ReportsDataProvider.COL_DATE)); - } - if(Locator.getFacade().getReportManager().isReportColumnAvailable(reportParams, StatsManager.T_TOTAL)) { - columns.add(new PropertyColumn(new ResourceModel("th_total"), columnsSortable ? ReportsDataProvider.COL_TOTAL : null, "count")); - } - if(Locator.getFacade().getReportManager().isReportColumnAvailable(reportParams, StatsManager.T_VISITS)) { - columns.add(new PropertyColumn(new ResourceModel("th_visits"), columnsSortable ? ReportsDataProvider.COL_VISITS : null, "totalVisits")); - } - if(Locator.getFacade().getReportManager().isReportColumnAvailable(reportParams, StatsManager.T_UNIQUEVISITS)) { - columns.add(new PropertyColumn(new ResourceModel("th_uniquevisitors"), columnsSortable ? ReportsDataProvider.COL_UNIQUEVISITS : null, "totalUnique")); - } - if(Locator.getFacade().getReportManager().isReportColumnAvailable(reportParams, StatsManager.T_DURATION)) { - columns.add(new PropertyColumn(new ResourceModel("th_duration"), columnsSortable ? ReportsDataProvider.COL_DURATION : null, "duration") { - @Override - public void populateItem(Item item, String componentId, IModel model) { - double duration = (double) ((SitePresence) model.getObject()).getDuration(); - duration = Util.round(duration / 1000 / 60, 1); // in minutes - StringBuilder b = new StringBuilder(String.valueOf(duration)); - b.append(' '); - b.append(new ResourceModel("minutes_abbr").getObject()); - item.add(new Label(componentId, b.toString())); - } - }); - } - return columns; - } - - private byte[] getChartImage() { - if(chartImage == null) { - chartImage = getChartImage(selectedWidth, selectedHeight); - } - return chartImage; - } - - private byte[] getChartImage(int width, int height) { - PrefsData prefsData = Locator.getFacade().getStatsManager().getPreferences(siteId, false); - int _width = (width <= 0) ? 350 : width; - int _height = (height <= 0) ? 200: height; - return Locator.getFacade().getChartService().generateChart( - report, _width, _height, - prefsData.isChartIn3D(), prefsData.getChartTransparency(), - prefsData.isItemLabelsVisible() - ); - } - - protected String getExportFileName() { - StringBuilder exportFileName = new StringBuilder(); - if(getReportDef().getTitle() != null && getReportDef().getTitle().trim().length() != 0) { - String titleStr = null; - if(getReportDef().isTitleLocalized()) { - titleStr = (String) new ResourceModel(getReportDef().getTitleBundleKey()).getObject(); - }else{ - titleStr = getReportDef().getTitle(); - } - exportFileName.append((String) new ResourceModel("reportres_title").getObject()); - exportFileName.append(" ("); - exportFileName.append(titleStr); - exportFileName.append(')'); - }else if(report.getReportDefinition().getReportParams().getWhat().equals(ReportManager.WHAT_VISITS)) { - exportFileName.append((String) new ResourceModel("report_what_visits").getObject()); - }else if(report.getReportDefinition().getReportParams().getWhat().equals(ReportManager.WHAT_EVENTS)) { - exportFileName.append((String) new ResourceModel("report_what_events").getObject()); - }else if(report.getReportDefinition().getReportParams().getWhat().equals(ReportManager.WHAT_PRESENCES)) { - exportFileName.append((String) new ResourceModel("report_what_presences").getObject()); - }else{ - exportFileName.append((String) new ResourceModel("report_what_resources").getObject()); - } - // append site - exportFileName.append(" ("); - try{ - exportFileName.append((Locator.getFacade().getSiteService().getSite(siteId)).getTitle()); - }catch(IdUnusedException e){ - exportFileName.append(siteId); - } - exportFileName.append(')'); - return exportFileName.toString(); - } - - protected void exportXls() { - String fileName = getExportFileName(); - byte[] hssfWorkbookBytes = Locator.getFacade().getReportManager().getReportAsExcel(report, fileName); - - RequestCycle.get().scheduleRequestHandlerAfterCurrent(new EmptyRequestHandler()); - WebResponse response = (WebResponse) getResponse(); - response.setContentType("application/vnd.ms-excel"); - response.setAttachmentHeader(fileName + ".xls"); - response.setHeader("Cache-Control", "max-age=0"); - response.setContentLength(hssfWorkbookBytes.length); - OutputStream out = null; - try{ - out = response.getOutputStream(); - out.write(hssfWorkbookBytes); - out.flush(); - }catch(IOException e){ - LOG.error(e); - }finally{ - try{ - if(out != null) out.close(); - }catch(IOException e){ - LOG.error(e); - } - } - } - - protected void exportCsv() { - String fileName = getExportFileName(); - String csvString = Locator.getFacade().getReportManager().getReportAsCsv(report); - - RequestCycle.get().scheduleRequestHandlerAfterCurrent(new EmptyRequestHandler()); - WebResponse response = (WebResponse) getResponse(); - response.setContentType("text/comma-separated-values"); - response.setAttachmentHeader(fileName + ".csv"); - response.setHeader("Cache-Control", "max-age=0"); - response.setContentLength(csvString.length()); - OutputStream out = null; - try{ - out = response.getOutputStream(); - out.write(csvString.getBytes()); - out.flush(); - }catch(IOException e){ - LOG.error(e); - }finally{ - try{ - if(out != null) out.close(); - }catch(IOException e){ - LOG.error(e); - } - } - } - - protected void exportPdf() { - String fileName = getExportFileName(); - byte[] pdf = Locator.getFacade().getReportManager().getReportAsPDF(report); - - RequestCycle.get().scheduleRequestHandlerAfterCurrent(new EmptyRequestHandler()); - WebResponse response = (WebResponse) getResponse(); - response.setContentType("application/pdf"); - response.setAttachmentHeader(fileName + ".pdf"); - response.setHeader("Cache-Control", "max-age=0"); - response.setContentLength(pdf.length); - OutputStream out = null; - try{ - out = response.getOutputStream(); - out.write(pdf); - out.flush(); - }catch(IOException e){ - LOG.error(e); - }finally{ - try{ - if(out != null) out.close(); - }catch(IOException e){ - LOG.error(e); - } - } - } - - private PrefsData getPrefsdata() { - if(prefsdata == null) { - prefsdata = Locator.getFacade().getStatsManager().getPreferences(siteId, true); - } - return prefsdata; - } - - public void setReportDef(ReportDef reportDef) { - this.reportDefModel.setObject(reportDef); - } - - public ReportDef getReportDef() { - return (ReportDef) this.reportDefModel.getObject(); - } - - public void setReportParams(ReportParams reportParams) { - getReportDef().setReportParams(reportParams); - } - - public ReportParams getReportParams() { - return getReportDef().getReportParams(); - } - - // ###################################################################################### - // Report results: SUMMARY - // ###################################################################################### - public String getReportDescription() { - return Locator.getFacade().getReportManager().getReportFormattedParams().getReportDescription(report); - } - - public String getReportSite() { - return Locator.getFacade().getReportManager().getReportFormattedParams().getReportSite(report); - } - - public String getReportGenerationDate() { - return Locator.getFacade().getReportManager().getReportFormattedParams().getReportGenerationDate(report); - } - - public String getReportActivityBasedOn() { - return Locator.getFacade().getReportManager().getReportFormattedParams().getReportActivityBasedOn(report); - } - - public String getReportActivitySelectionTitle() { - return Locator.getFacade().getReportManager().getReportFormattedParams().getReportActivitySelectionTitle(report); - } - - public String getReportActivitySelection() { - return Locator.getFacade().getReportManager().getReportFormattedParams().getReportActivitySelection(report); - } - - public String getReportResourceActionTitle() { - return Locator.getFacade().getReportManager().getReportFormattedParams().getReportResourceActionTitle(report); - } - - public String getReportResourceAction() { - return Locator.getFacade().getReportManager().getReportFormattedParams().getReportResourceAction(report); - } - - public String getReportTimePeriod() { - return Locator.getFacade().getReportManager().getReportFormattedParams().getReportTimePeriod(report); - } - - public String getReportUserSelectionType() { - return Locator.getFacade().getReportManager().getReportFormattedParams().getReportUserSelectionType(report); - } - - public String getReportUserSelectionTitle() { - return Locator.getFacade().getReportManager().getReportFormattedParams().getReportUserSelectionTitle(report); - } - - public String getReportUserSelection() { - return Locator.getFacade().getReportManager().getReportFormattedParams().getReportUserSelection(report); - } - -} - +/** + * $URL:$ + * $Id:$ + * + * Copyright (c) 2006-2009 The Sakai 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 + * + * http://www.opensource.org/licenses/ECL-2.0 + * + * 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.sakaiproject.sitestats.tool.wicket.pages; + +import java.io.IOException; +import java.io.OutputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.apache.wicket.AttributeModifier; +import org.apache.wicket.Component; +import org.apache.wicket.request.mapper.parameter.PageParameters; +import org.apache.wicket.request.cycle.RequestCycle; +import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn; +import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn; +import org.apache.wicket.markup.head.IHeaderResponse; +import org.apache.wicket.markup.head.JavaScriptHeaderItem; +import org.apache.wicket.markup.html.WebMarkupContainer; +import org.apache.wicket.markup.html.WebPage; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.form.Button; +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.markup.html.link.Link; +import org.apache.wicket.markup.repeater.Item; +import org.apache.wicket.model.CompoundPropertyModel; +import org.apache.wicket.model.IModel; +import org.apache.wicket.model.Model; +import org.apache.wicket.model.ResourceModel; +import org.apache.wicket.model.StringResourceModel; +import org.apache.wicket.request.http.WebResponse; +import org.apache.wicket.request.handler.EmptyRequestHandler; +import org.sakaiproject.exception.IdUnusedException; +import org.sakaiproject.site.api.Site; +import org.sakaiproject.sitestats.api.EventStat; +import org.sakaiproject.sitestats.api.PrefsData; +import org.sakaiproject.sitestats.api.LessonBuilderStat; +import org.sakaiproject.sitestats.api.ResourceStat; +import org.sakaiproject.sitestats.api.SitePresence; +import org.sakaiproject.sitestats.api.Stat; +import org.sakaiproject.sitestats.api.StatsManager; +import org.sakaiproject.sitestats.api.Util; +import org.sakaiproject.sitestats.api.event.ToolInfo; +import org.sakaiproject.sitestats.api.report.Report; +import org.sakaiproject.sitestats.api.report.ReportDef; +import org.sakaiproject.sitestats.api.report.ReportManager; +import org.sakaiproject.sitestats.api.report.ReportParams; +import org.sakaiproject.sitestats.tool.facade.Locator; +import org.sakaiproject.sitestats.tool.wicket.components.AjaxLazyLoadImage; +import org.sakaiproject.sitestats.tool.wicket.components.ImageWithLink; +import org.sakaiproject.sitestats.tool.wicket.components.LastJobRun; +import org.sakaiproject.sitestats.tool.wicket.components.Menus; +import org.sakaiproject.sitestats.tool.wicket.components.SakaiDataTable; +import org.sakaiproject.sitestats.tool.wicket.models.ReportDefModel; +import org.sakaiproject.sitestats.tool.wicket.providers.ReportsDataProvider; +import org.sakaiproject.user.api.UserNotDefinedException; + +/** + * @author Nuno Fernandes + */ +public class ReportDataPage extends BasePage { + private static final long serialVersionUID = 1L; + private static Logger LOG = LoggerFactory.getLogger(ReportDataPage.class); + + private String realSiteId; + private String siteId; + private boolean inPrintVersion; + + private ReportDefModel reportDefModel; + private Report report; + private PrefsData prefsdata; + private WebPage returnPage; + + private AjaxLazyLoadImage reportChart = null; + private byte[] chartImage = null; + private int selectedWidth = 0; + private int selectedHeight = 0; + + public ReportDataPage(final ReportDefModel reportDef) { + this(reportDef, null, null); + } + + public ReportDataPage(final ReportDefModel reportDef, final PageParameters pageParameters) { + this(reportDef, pageParameters, null); + } + + public ReportDataPage(final ReportDefModel reportDef, final PageParameters pageParameters, final WebPage returnPage) { + this.reportDefModel = reportDef; + realSiteId = Locator.getFacade().getToolManager().getCurrentPlacement().getContext(); + if(pageParameters != null) { + siteId = pageParameters.get("siteId").toString(); + inPrintVersion = pageParameters.get("printVersion").toBoolean(false); + } + if(siteId == null){ + siteId = realSiteId; + } + if(returnPage == null) { + this.returnPage = new ReportsPage(pageParameters); + }else{ + this.returnPage = returnPage; + } + boolean allowed = Locator.getFacade().getStatsAuthz().isUserAbleToViewSiteStats(siteId); + if(allowed) { + if(reportDef != null && getReportDef() != null && getReportDef().getReportParams() != null) { + renderBody(); + }else{ + setResponsePage(ReportsPage.class); + } + }else{ + setResponsePage(NotAuthorizedPage.class); + } + } + + @Override + public void renderHead(IHeaderResponse response) { + super.renderHead(response); + response.render(JavaScriptHeaderItem.forUrl(JQUERYSCRIPT)); + } + + @SuppressWarnings("serial") + private void renderBody() { + // reportAction + if(getReportDef().getTitle() != null && getReportDef().getTitle().trim().length() != 0) { + String titleStr = null; + if(getReportDef().isTitleLocalized()) { + titleStr = (String) new ResourceModel("reportres_title_detailed").getObject(); + titleStr = titleStr.replaceAll("\\$\\{title\\}", (String) new ResourceModel(getReportDef().getTitleBundleKey()).getObject()); + }else{ + titleStr = new StringResourceModel("reportres_title_detailed", this, reportDefModel).getString(); + } + add(new Label("reportAction", titleStr)); + }else{ + add(new Label("reportAction", new ResourceModel("reportres_title"))); + } + + // model + setDefaultModel(new CompoundPropertyModel(this)); + + // form + Form form = new Form("form"); + add(form); + + // menu + add(new Menus("menu", siteId).setVisible(!inPrintVersion)); + + // last job run + add(new LastJobRun("lastJobRun", siteId)); + + // print link/info + WebMarkupContainer toPrintVersion = new WebMarkupContainer("toPrintVersion"); + toPrintVersion.setVisible(!inPrintVersion); + toPrintVersion.add(new Link("printLink") { + @Override + public void onClick() { + PageParameters params = new PageParameters(); + params.set("printVersion", "true"); + params.set("siteId", siteId); + setResponsePage(new ReportDataPage(reportDefModel, params)); + } + }); + add(toPrintVersion); + add(new WebMarkupContainer("inPrintVersion").setVisible(inPrintVersion)); + + // Report data + final ReportsDataProvider dataProvider = new ReportsDataProvider(getPrefsdata(), getReportDef()); + report = dataProvider.getReport(); + + // Report: chart + reportChart = new AjaxLazyLoadImage("reportChart", getPage()) { + @Override + public byte[] getImageData() { + return getChartImage(); + } + + @Override + public byte[] getImageData(int width, int height) { + return getChartImage(width, height); + } + }; + reportChart.setOutputMarkupId(true); + add(reportChart); + if(ReportManager.HOW_PRESENTATION_CHART.equals(report.getReportDefinition().getReportParams().getHowPresentationMode()) + || ReportManager.HOW_PRESENTATION_BOTH.equals(report.getReportDefinition().getReportParams().getHowPresentationMode()) ) { + reportChart.setVisible(true); + reportChart.setAutoDetermineChartSizeByAjax(".chartContainer"); + }else{ + reportChart.setVisible(false); + } + + // Report: table + SakaiDataTable reportTable = new SakaiDataTable( + "table", + getTableColumns(getReportParams(), true), + dataProvider, + !inPrintVersion); + if(inPrintVersion) { + reportTable.setItemsPerPage(Integer.MAX_VALUE); + } + reportTable.setVisible( + ReportManager.HOW_PRESENTATION_TABLE.equals(report.getReportDefinition().getReportParams().getHowPresentationMode()) + || ReportManager.HOW_PRESENTATION_BOTH.equals(report.getReportDefinition().getReportParams().getHowPresentationMode()) + ); + form.add(reportTable); + + + // Report: header (report info) + WebMarkupContainer trDescription = new WebMarkupContainer("trDescription"); + trDescription.setVisible(getReportDescription() != null); + trDescription.add(new Label("reportDescription")); + add(trDescription); + + add(new Label("reportSite")); + + add(new Label("reportActivityBasedOn")); + + WebMarkupContainer trResourceAction = new WebMarkupContainer("trResourceAction"); + trResourceAction.setVisible(getReportResourceAction() != null); + trResourceAction.add(new Label("reportResourceActionTitle")); + trResourceAction.add(new Label("reportResourceAction")); + add(trResourceAction); + + WebMarkupContainer trActivitySelection = new WebMarkupContainer("trActivitySelection"); + trActivitySelection.setVisible(getReportActivitySelection() != null); + trActivitySelection.add(new Label("reportActivitySelectionTitle")); + trActivitySelection.add(new Label("reportActivitySelection")); + add(trActivitySelection); + + add(new Label("reportTimePeriod")); + + add(new Label("reportUserSelectionType")); + + WebMarkupContainer trReportUserSelection = new WebMarkupContainer("trReportUserSelection"); + trReportUserSelection.setVisible(getReportUserSelectionTitle() != null); + trReportUserSelection.add(new Label("reportUserSelectionTitle")); + trReportUserSelection.add(new Label("reportUserSelection")); + add(trReportUserSelection); + + add(new Label("report.localizedReportGenerationDate")); + + + // buttons + form.add(new Button("back") { + @Override + public void onSubmit() { + setResponsePage(returnPage); + super.onSubmit(); + } + }.setVisible(!inPrintVersion)); + form.add(new Button("export") { + @Override + public void onSubmit() { + super.onSubmit(); + } + }.setDefaultFormProcessing(false).setVisible(Locator.getFacade().getStatsManager().isEnableReportExport() && !inPrintVersion)); + form.add(new Button("exportXls") { + @Override + public void onSubmit() { + exportXls(); + super.onSubmit(); + } + }); + form.add(new Button("exportCsv") { + @Override + public void onSubmit() { + exportCsv(); + super.onSubmit(); + } + }); + form.add(new Button("exportPdf") { + @Override + public void onSubmit() { + exportPdf(); + super.onSubmit(); + } + }); + } + + @SuppressWarnings("serial") + public static List<IColumn> getTableColumns( + final ReportParams reportParams, final boolean columnsSortable + ) { + List<IColumn> columns = new ArrayList<IColumn>(); + final Map<String,ToolInfo> eventIdToolMap = Locator.getFacade().getEventRegistryService().getEventIdToolMap(); + + // site + if(Locator.getFacade().getReportManager().isReportColumnAvailable(reportParams, StatsManager.T_SITE)) { + columns.add(new PropertyColumn(new ResourceModel("th_site"), columnsSortable ? ReportsDataProvider.COL_SITE : null, ReportsDataProvider.COL_SITE) { + @Override + public void populateItem(Item item, String componentId, IModel model) { + final String site = ((Stat) model.getObject()).getSiteId(); + String lbl = "", href = ""; + Site s = null; + try{ + s = Locator.getFacade().getSiteService().getSite(site); + lbl = s.getTitle(); + href = s.getUrl(); + }catch(IdUnusedException e){ + lbl = (String) new ResourceModel("site_unknown").getObject(); + href = null; + } + item.add(new ImageWithLink(componentId, null, href, lbl, "_parent")); + } + }); + } + // user + if(Locator.getFacade().getReportManager().isReportColumnAvailable(reportParams, StatsManager.T_USER)) { + columns.add(new PropertyColumn(new ResourceModel("th_id"), columnsSortable ? ReportsDataProvider.COL_USERID : null, ReportsDataProvider.COL_USERID) { + @Override + public void populateItem(Item item, String componentId, IModel model) { + final String userId = ((Stat) model.getObject()).getUserId(); + String name = null; + if (userId != null) { + if(("-").equals(userId) || ("?").equals(userId)) { + name = "-"; + }else{ + try{ + name = Locator.getFacade().getUserDirectoryService().getUser(userId).getDisplayId(); + }catch(UserNotDefinedException e1){ + name = userId; + } + } + }else{ + name = (String) new ResourceModel("user_unknown").getObject(); + } + item.add(new Label(componentId, name)); + } + }); + columns.add(new PropertyColumn(new ResourceModel("th_user"), columnsSortable ? ReportsDataProvider.COL_USERNAME : null, ReportsDataProvider.COL_USERNAME) { + @Override + public void populateItem(Item item, String componentId, IModel model) { + final String userId = ((Stat) model.getObject()).getUserId(); + String name = null; + if (userId != null) { + if(("-").equals(userId)) { + name = (String) new ResourceModel("user_anonymous").getObject(); + }else if(("?").equals(userId)) { + name = (String) new ResourceModel("user_anonymous_access").getObject(); + }else{ + name= Locator.getFacade().getStatsManager().getUserNameForDisplay(userId); + } + }else{ + name = (String) new ResourceModel("user_unknown").getObject(); + } + item.add(new Label(componentId, name)); + } + }); + } + // tool + if(Locator.getFacade().getReportManager().isReportColumnAvailable(reportParams, StatsManager.T_TOOL)) { + columns.add(new PropertyColumn(new ResourceModel("th_tool"), columnsSortable ? ReportsDataProvider.COL_TOOL : null, ReportsDataProvider.COL_TOOL) { + @Override + public void populateItem(Item item, String componentId, IModel model) { + final String toolId = ((EventStat) model.getObject()).getToolId(); + String toolName = ""; + if(!"".equals(toolId)){ + toolName = Locator.getFacade().getEventRegistryService().getToolName(toolId); + } + Label toolLabel = new Label(componentId, toolName); + String toolIconClass = "toolIcon"; + String toolIconPath = "url(" + Locator.getFacade().getEventRegistryService().getToolIcon(toolId) + ")"; + toolLabel.add(new AttributeModifier("class", new Model(toolIconClass))); + toolLabel.add(new AttributeModifier("style", new Model("background-image: "+toolIconPath))); + toolLabel.add(new AttributeModifier("title", new Model(toolName))); + item.add(toolLabel); + } + }); + } + // event + if(Locator.getFacade().getReportManager().isReportColumnAvailable(reportParams, StatsManager.T_EVENT)) { + columns.add(new PropertyColumn(new ResourceModel("th_event"), columnsSortable ? ReportsDataProvider.COL_EVENT : null, ReportsDataProvider.COL_EVENT) { + @Override + public void populateItem(Item item, String componentId, IModel model) { + final String eventId = ((EventStat) model.getObject()).getEventId(); + String eventName = ""; + if(!"".equals(eventId)){ + eventName = Locator.getFacade().getEventRegistryService().getEventName(eventId); + } + Label eventLabel = new Label(componentId, eventName); + ToolInfo toolInfo = eventIdToolMap.get(eventId); + if(toolInfo != null) { + String toolId = toolInfo.getToolId(); + String toolName = Locator.getFacade().getEventRegistryService().getToolName(toolId); + String toolIconClass = "toolIcon"; + String toolIconPath = "url(" + Locator.getFacade().getEventRegistryService().getToolIcon(toolId) + ")"; + eventLabel.add(new AttributeModifier("class", new Model(toolIconClass))); + eventLabel.add(new AttributeModifier("style", new Model("background-image: "+toolIconPath))); + eventLabel.add(new AttributeModifier("title", new Model(toolName))); + } + item.add(eventLabel); + } + }); + } + // resource + if(Locator.getFacade().getReportManager().isReportColumnAvailable(reportParams, StatsManager.T_RESOURCE)) { + columns.add(new PropertyColumn(new ResourceModel("th_resource"), columnsSortable ? ReportsDataProvider.COL_RESOURCE : null, ReportsDataProvider.COL_RESOURCE) { + @Override + public void populateItem(Item item, String componentId, IModel model) { + final String ref = ((ResourceStat) model.getObject()).getResourceRef(); + String imgUrl = null, lnkUrl = null, lnkLabel = null; + Component resourceComp = null; + if(ref != null && !"".equals(ref)){ + imgUrl = Locator.getFacade().getStatsManager().getResourceImage(ref); + lnkUrl = Locator.getFacade().getStatsManager().getResourceURL(ref); + lnkLabel = Locator.getFacade().getStatsManager().getResourceName(ref); + if(lnkLabel == null) { + lnkLabel = (String) new ResourceModel("resource_unknown").getObject(); + } + } + resourceComp = new ImageWithLink(componentId, imgUrl, lnkUrl, lnkLabel, "_new"); + item.add(resourceComp); + } + }); + } + // resource action + if(Locator.getFacade().getReportManager().isReportColumnAvailable(reportParams, StatsManager.T_RESOURCE_ACTION)) { + columns.add(new PropertyColumn(new ResourceModel("th_action"), columnsSortable ? ReportsDataProvider.COL_ACTION : null, ReportsDataProvider.COL_ACTION) { + @Override + public void populateItem(Item item, String componentId, IModel model) { + final String refAction = ((ResourceStat) model.getObject()).getResourceAction(); + String action = ""; + if(refAction == null){ + action = ""; + }else{ + if(!"".equals(refAction.trim())) + action = (String) new ResourceModel("action_"+refAction).getObject(); + } + item.add(new Label(componentId, action)); + } + }); + } + // lessonbuilder page + if(Locator.getFacade().getReportManager().isReportColumnAvailable(reportParams, StatsManager.T_PAGE)) { + columns.add(new PropertyColumn(new ResourceModel("th_page"), columnsSortable ? ReportsDataProvider.COL_PAGE : null, ReportsDataProvider.COL_PAGE) { + @Override + public void populateItem(Item item, String componentId, IModel model) { + LessonBuilderStat stat = (LessonBuilderStat) model.getObject(); + final String ref = stat.getPageRef(); + String lnkLabel = stat.getPageTitle(); + String imgUrl = "", lnkUrl = ""; + if (lnkLabel == null) { + lnkLabel = (String) new ResourceModel("resource_unknown").getObject(); + } + Component resourceComp = new ImageWithLink(componentId, imgUrl, lnkUrl, lnkLabel, "_new"); + item.add(resourceComp); + } + }); + } + // lessonbuilder page action + if(Locator.getFacade().getReportManager().isReportColumnAvailable(reportParams, StatsManager.T_PAGE_ACTION)) { + columns.add(new PropertyColumn(new ResourceModel("th_action"), columnsSortable ? ReportsDataProvider.COL_ACTION : null, ReportsDataProvider.COL_ACTION) { + @Override + public void populateItem(Item item, String componentId, IModel model) { + final String pageAction = ((LessonBuilderStat) model.getObject()).getPageAction(); + String action = ""; + if (pageAction == null){ + action = ""; + } else { + if (!"".equals(pageAction.trim())) + action = (String) new ResourceModel("action_" + pageAction).getObject(); + } + item.add(new Label(componentId, action)); + } + }); + } + if(Locator.getFacade().getReportManager().isReportColumnAvailable(reportParams, StatsManager.T_DATE)) { + columns.add(new PropertyColumn(new ResourceModel("th_date"), columnsSortable ? ReportsDataProvider.COL_DATE : null, ReportsDataProvider.COL_DATE)); + } + if(Locator.getFacade().getReportManager().isReportColumnAvailable(reportParams, StatsManager.T_DATEMONTH)) { + columns.add(new PropertyColumn(new ResourceModel("th_date"), columnsSortable ? ReportsDataProvider.COL_DATE : null, ReportsDataProvider.COL_DATE) { + @Override + public void populateItem(Item item, String componentId, IModel model) { + final Date date = ((Stat) model.getObject()).getDate(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM"); + item.add(new Label(componentId, sdf.format(date))); + } + }); + } + if(Locator.getFacade().getReportManager().isReportColumnAvailable(reportParams, StatsManager.T_DATEYEAR)) { + columns.add(new PropertyColumn(new ResourceModel("th_date"), columnsSortable ? ReportsDataProvider.COL_DATE : null, ReportsDataProvider.COL_DATE) { + @Override + public void populateItem(Item item, String componentId, IModel model) { + final Date date = ((Stat) model.getObject()).getDate(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); + item.add(new Label(componentId, sdf.format(date))); + } + }); + } + if(Locator.getFacade().getReportManager().isReportColumnAvailable(reportParams, StatsManager.T_LASTDATE)) { + columns.add(new PropertyColumn(new ResourceModel("th_lastdate"), columnsSortable ? ReportsDataProvider.COL_DATE : null, ReportsDataProvider.COL_DATE)); + } + if(Locator.getFacade().getReportManager().isReportColumnAvailable(reportParams, StatsManager.T_TOTAL)) { + columns.add(new PropertyColumn(new ResourceModel("th_total"), columnsSortable ? ReportsDataProvider.COL_TOTAL : null, "count")); + } + if(Locator.getFacade().getReportManager().isReportColumnAvailable(reportParams, StatsManager.T_VISITS)) { + columns.add(new PropertyColumn(new ResourceModel("th_visits"), columnsSortable ? ReportsDataProvider.COL_VISITS : null, "totalVisits")); + } + if(Locator.getFacade().getReportManager().isReportColumnAvailable(reportParams, StatsManager.T_UNIQUEVISITS)) { + columns.add(new PropertyColumn(new ResourceModel("th_uniquevisitors"), columnsSortable ? ReportsDataProvider.COL_UNIQUEVISITS : null, "totalUnique")); + } + if(Locator.getFacade().getReportManager().isReportColumnAvailable(reportParams, StatsManager.T_DURATION)) { + columns.add(new PropertyColumn(new ResourceModel("th_duration"), columnsSortable ? ReportsDataProvider.COL_DURATION : null, "duration") { + @Override + public void populateItem(Item item, String componentId, IModel model) { + double duration = (double) ((SitePresence) model.getObject()).getDuration(); + duration = Util.round(duration / 1000 / 60, 1); // in minutes + StringBuilder b = new StringBuilder(String.valueOf(duration)); + b.append(' '); + b.append(new ResourceModel("minutes_abbr").getObject()); + item.add(new Label(componentId, b.toString())); + } + }); + } + return columns; + } + + private byte[] getChartImage() { + if(chartImage == null) { + chartImage = getChartImage(selectedWidth, selectedHeight); + } + return chartImage; + } + + private byte[] getChartImage(int width, int height) { + PrefsData prefsData = Locator.getFacade().getStatsManager().getPreferences(siteId, false); + int _width = (width <= 0) ? 350 : width; + int _height = (height <= 0) ? 200: height; + return Locator.getFacade().getChartService().generateChart( + report, _width, _height, + prefsData.isChartIn3D(), prefsData.getChartTransparency(), + prefsData.isItemLabelsVisible() + ); + } + + protected String getExportFileName() { + StringBuilder exportFileName = new StringBuilder(); + if(getReportDef().getTitle() != null && getReportDef().getTitle().trim().length() != 0) { + String titleStr = null; + if(getReportDef().isTitleLocalized()) { + titleStr = (String) new ResourceModel(getReportDef().getTitleBundleKey()).getObject(); + }else{ + titleStr = getReportDef().getTitle(); + } + exportFileName.append((String) new ResourceModel("reportres_title").getObject()); + exportFileName.append(" ("); + exportFileName.append(titleStr); + exportFileName.append(')'); + }else if(report.getReportDefinition().getReportParams().getWhat().equals(ReportManager.WHAT_VISITS)) { + exportFileName.append((String) new ResourceModel("report_what_visits").getObject()); + }else if(report.getReportDefinition().getReportParams().getWhat().equals(ReportManager.WHAT_EVENTS)) { + exportFileName.append((String) new ResourceModel("report_what_events").getObject()); + }else if(report.getReportDefinition().getReportParams().getWhat().equals(ReportManager.WHAT_PRESENCES)) { + exportFileName.append((String) new ResourceModel("report_what_presences").getObject()); + }else{ + exportFileName.append((String) new ResourceModel("report_what_resources").getObject()); + } + // append site + exportFileName.append(" ("); + try{ + exportFileName.append((Locator.getFacade().getSiteService().getSite(siteId)).getTitle()); + }catch(IdUnusedException e){ + exportFileName.append(siteId); + } + exportFileName.append(')'); + return exportFileName.toString(); + } + + protected void exportXls() { + String fileName = getExportFileName(); + byte[] hssfWorkbookBytes = Locator.getFacade().getReportManager().getReportAsExcel(report, fileName); + + RequestCycle.get().scheduleRequestHandlerAfterCurrent(new EmptyRequestHandler()); + WebResponse response = (WebResponse) getResponse(); + response.setContentType("application/vnd.ms-excel"); + response.setAttachmentHeader(fileName + ".xls"); + response.setHeader("Cache-Control", "max-age=0"); + response.setContentLength(hssfWorkbookBytes.length); + OutputStream out = null; + try{ + out = response.getOutputStream(); + out.write(hssfWorkbookBytes); + out.flush(); + }catch(IOException e){ + LOG.error(e.getMessage()); + }finally{ + try{ + if(out != null) out.close(); + }catch(IOException e){ + LOG.error(e.getMessage()); + } + } + } + + protected void exportCsv() { + String fileName = getExportFileName(); + String csvString = Locator.getFacade().getReportManager().getReportAsCsv(report); + + RequestCycle.get().scheduleRequestHandlerAfterCurrent(new EmptyRequestHandler()); + WebResponse response = (WebResponse) getResponse(); + response.setContentType("text/comma-separated-values"); + response.setAttachmentHeader(fileName + ".csv"); + response.setHeader("Cache-Control", "max-age=0"); + response.setContentLength(csvString.length()); + OutputStream out = null; + try{ + out = response.getOutputStream(); + out.write(csvString.getBytes()); + out.flush(); + }catch(IOException e){ + LOG.error(e.getMessage()); + }finally{ + try{ + if(out != null) out.close(); + }catch(IOException e){ + LOG.error(e.getMessage()); + } + } + } + + protected void exportPdf() { + String fileName = getExportFileName(); + byte[] pdf = Locator.getFacade().getReportManager().getReportAsPDF(report); + + RequestCycle.get().scheduleRequestHandlerAfterCurrent(new EmptyRequestHandler()); + WebResponse response = (WebResponse) getResponse(); + response.setContentType("application/pdf"); + response.setAttachmentHeader(fileName + ".pdf"); + response.setHeader("Cache-Control", "max-age=0"); + response.setContentLength(pdf.length); + OutputStream out = null; + try{ + out = response.getOutputStream(); + out.write(pdf); + out.flush(); + }catch(IOException e){ + LOG.error(e.getMessage()); + }finally{ + try{ + if(out != null) out.close(); + }catch(IOException e){ + LOG.error(e.getMessage()); + } + } + } + + private PrefsData getPrefsdata() { + if(prefsdata == null) { + prefsdata = Locator.getFacade().getStatsManager().getPreferences(siteId, true); + } + return prefsdata; + } + + public void setReportDef(ReportDef reportDef) { + this.reportDefModel.setObject(reportDef); + } + + public ReportDef getReportDef() { + return (ReportDef) this.reportDefModel.getObject(); + } + + public void setReportParams(ReportParams reportParams) { + getReportDef().setReportParams(reportParams); + } + + public ReportParams getReportParams() { + return getReportDef().getReportParams(); + } + + // ###################################################################################### + // Report results: SUMMARY + // ###################################################################################### + public String getReportDescription() { + return Locator.getFacade().getReportManager().getReportFormattedParams().getReportDescription(report); + } + + public String getReportSite() { + return Locator.getFacade().getReportManager().getReportFormattedParams().getReportSite(report); + } + + public String getReportGenerationDate() { + return Locator.getFacade().getReportManager().getReportFormattedParams().getReportGenerationDate(report); + } + + public String getReportActivityBasedOn() { + return Locator.getFacade().getReportManager().getReportFormattedParams().getReportActivityBasedOn(report); + } + + public String getReportActivitySelectionTitle() { + return Locator.getFacade().getReportManager().getReportFormattedParams().getReportActivitySelectionTitle(report); + } + + public String getReportActivitySelection() { + return Locator.getFacade().getReportManager().getReportFormattedParams().getReportActivitySelection(report); + } + + public String getReportResourceActionTitle() { + return Locator.getFacade().getReportManager().getReportFormattedParams().getReportResourceActionTitle(report); + } + + public String getReportResourceAction() { + return Locator.getFacade().getReportManager().getReportFormattedParams().getReportResourceAction(report); + } + + public String getReportTimePeriod() { + return Locator.getFacade().getReportManager().getReportFormattedParams().getReportTimePeriod(report); + } + + public String getReportUserSelectionType() { + return Locator.getFacade().getReportManager().getReportFormattedParams().getReportUserSelectionType(report); + } + + public String getReportUserSelectionTitle() { + return Locator.getFacade().getReportManager().getReportFormattedParams().getReportUserSelectionTitle(report); + } + + public String getReportUserSelection() { + return Locator.getFacade().getReportManager().getReportFormattedParams().getReportUserSelection(report); + } + +} + diff --git a/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/pages/ReportsEditPage.java b/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/pages/ReportsEditPage.java index beb6e6490970..3ca863e03c6b 100644 --- a/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/pages/ReportsEditPage.java +++ b/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/pages/ReportsEditPage.java @@ -33,8 +33,8 @@ import java.util.concurrent.locks.ReentrantLock; import java.util.Locale; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.wicket.AttributeModifier; import org.apache.wicket.request.mapper.parameter.PageParameters; import org.apache.wicket.ajax.AjaxRequestTarget; @@ -102,7 +102,7 @@ */ public class ReportsEditPage extends BasePage { private static final long serialVersionUID = 1L; - private static Log LOG = LogFactory.getLog(ReportsEditPage.class); + private static Logger LOG = LoggerFactory.getLogger(ReportsEditPage.class); private static final String REPORT_THISSITE = "this"; private static final String REPORT_ALLSITES = "all"; @@ -127,7 +127,7 @@ public class ReportsEditPage extends BasePage { /** Ajax update lock */ private final ReentrantLock ajaxUpdateLock = new ReentrantLock(); private boolean usersLoaded = false; - private static Log log = LogFactory.getLog(ReportsEditPage.class); + private static Logger log = LoggerFactory.getLogger(ReportsEditPage.class); private transient Collator collator = Collator.getInstance(); { diff --git a/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/pages/ReportsPage.java b/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/pages/ReportsPage.java index 5a02b7f02bfe..ad35eb1ea29a 100644 --- a/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/pages/ReportsPage.java +++ b/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/pages/ReportsPage.java @@ -1,316 +1,316 @@ -/** - * $URL:$ - * $Id:$ - * - * Copyright (c) 2006-2009 The Sakai 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 - * - * http://www.opensource.org/licenses/ECL-2.0 - * - * 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.sakaiproject.sitestats.tool.wicket.pages; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.wicket.AttributeModifier; -import org.apache.wicket.request.mapper.parameter.PageParameters; -import org.apache.wicket.markup.head.IHeaderResponse; -import org.apache.wicket.markup.head.JavaScriptHeaderItem; -import org.apache.wicket.markup.html.WebMarkupContainer; -import org.apache.wicket.markup.html.basic.Label; -import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.markup.html.link.Link; -import org.apache.wicket.markup.html.panel.Fragment; -import org.apache.wicket.markup.repeater.Item; -import org.apache.wicket.markup.repeater.data.DataView; -import org.apache.wicket.model.CompoundPropertyModel; -import org.apache.wicket.model.Model; -import org.apache.wicket.model.ResourceModel; -import org.apache.wicket.model.StringResourceModel; -import org.sakaiproject.sitestats.api.StatsManager; -import org.sakaiproject.sitestats.api.report.ReportDef; -import org.sakaiproject.sitestats.tool.facade.Locator; -import org.sakaiproject.sitestats.tool.wicket.components.CSSFeedbackPanel; -import org.sakaiproject.sitestats.tool.wicket.components.LastJobRun; -import org.sakaiproject.sitestats.tool.wicket.components.Menus; -import org.sakaiproject.sitestats.tool.wicket.models.ReportDefModel; -import org.sakaiproject.sitestats.tool.wicket.providers.ReportDefsProvider; - -public class ReportsPage extends BasePage { - private static final long serialVersionUID = 1L; - private static Log LOG = LogFactory.getLog(ReportsPage.class); - - private String realSiteId; - private String siteId; - - - public ReportsPage() { - } - - public ReportsPage(PageParameters pageParameters) { - realSiteId = Locator.getFacade().getToolManager().getCurrentPlacement().getContext(); - if(pageParameters != null) { - siteId = pageParameters.get("siteId").toString(); - } - if(siteId == null){ - siteId = realSiteId; - } - boolean allowed = Locator.getFacade().getStatsAuthz().isUserAbleToViewSiteStats(siteId); - if(allowed) { - renderBody(); - }else{ - setResponsePage(NotAuthorizedPage.class); - } - } - - @Override - public void renderHead(IHeaderResponse response) { - super.renderHead(response); - response.render(JavaScriptHeaderItem.forUrl(JQUERYSCRIPT)); - } - - private void renderBody() { - boolean isSiteStatsAdminPage = Locator.getFacade().getStatsAuthz().isSiteStatsAdminPage(); - boolean isAdministering = isSiteStatsAdminPage && realSiteId.equals(siteId); - boolean isFilteringReportsWithToolsInSite = !isAdministering; - - // menu - add(new Menus("menu", siteId)); - - // model - setDefaultModel(new CompoundPropertyModel(this)); - - add(new Label("pageTitle")); - - // last job run - add(new LastJobRun("lastJobRun", siteId)); - - // form - Form form = new Form("reportsForm"); - add(form); - - // feedback panel (messages) - form.add(new CSSFeedbackPanel("messages")); - - - // my reports - WebMarkupContainer myReportsContainer = new WebMarkupContainer("myReportsContainer"); - // new report link - Link lnkNewReport = new Link("lnkNewReport") { - private static final long serialVersionUID = 1L; - @Override - public void onClick() { - PageParameters pageParameters = new PageParameters().set("siteId", siteId).set("predefined", "false"); - setResponsePage(new ReportsEditPage(null, pageParameters, ReportsPage.this)); - } - }; - myReportsContainer.add(lnkNewReport); - // table - final WebMarkupContainer noReports = new WebMarkupContainer("noReports"); - myReportsContainer.add(noReports); - final ReportDefsProvider myReportsProvider = new ReportDefsProvider(siteId, ReportDefsProvider.MODE_MYREPORTS, true, false); - DataView myReports = new DataView("myReports", myReportsProvider) { - private static final long serialVersionUID = 1L; - - @Override - protected void populateItem(Item item) { - final ReportDefModel model = (ReportDefModel) item.getModel(); - item.add(new ReportRowFragment("reportRow", model, ReportDefsProvider.MODE_MYREPORTS)); - if(((ReportDef) model.getObject()).isHidden()) { - item.add(new AttributeModifier("class", new Model("hiddenReport"))); - } - } - @Override - protected void onBeforeRender() { - noReports.setVisible(getRowCount() == 0); - super.onBeforeRender(); - } - }; - myReportsContainer.add(myReports); - form.add(myReportsContainer); - - - // predefined reports - WebMarkupContainer predefinedReportsContainer = new WebMarkupContainer("predefinedReportsContainer"); - final WebMarkupContainer noPredefReports = new WebMarkupContainer("noReports"); - predefinedReportsContainer.add(noPredefReports); - WebMarkupContainer adminAddContainer = new WebMarkupContainer("adminAddContainer"); - adminAddContainer.setVisible(isAdministering); - predefinedReportsContainer.add(adminAddContainer); - // new predefined report link - Link lnkPDNewReport = new Link("lnkNewReport") { - private static final long serialVersionUID = 1L; - @Override - public void onClick() { - PageParameters pageParameters = new PageParameters().set("siteId", siteId).set("predefined", "true"); - setResponsePage(new ReportsEditPage(null, pageParameters, ReportsPage.this)); - } - }; - adminAddContainer.add(lnkPDNewReport); - final ReportDefsProvider predefinedReportsProvider = new ReportDefsProvider(siteId, ReportDefsProvider.MODE_PREDEFINED_REPORTS, isFilteringReportsWithToolsInSite, isAdministering); - DataView predefinedReports = new DataView("predefinedReports", predefinedReportsProvider) { - private static final long serialVersionUID = 1L; - - @Override - protected void populateItem(Item item) { - final ReportDefModel model = (ReportDefModel) item.getModel(); - item.add(new ReportRowFragment("reportRow", model, ReportDefsProvider.MODE_PREDEFINED_REPORTS)); - if(((ReportDef) model.getObject()).isHidden()) { - item.add(new AttributeModifier("class", new Model("hiddenReport"))); - } - } - @Override - protected void onBeforeRender() { - noPredefReports.setVisible(getRowCount() == 0); - super.onBeforeRender(); - } - }; - predefinedReportsContainer.add(predefinedReports); - predefinedReportsContainer.setVisible(isSiteStatsAdminPage || predefinedReportsProvider.size() != 0); - form.add(predefinedReportsContainer); - - } - - public String getPageTitle() { - return (String) new ResourceModel("menu_reports").getObject(); - } - - /** Fragment representing a row from report list table. */ - public class ReportRowFragment extends Fragment { - private static final long serialVersionUID = 1L; - - public ReportRowFragment(String id, final ReportDefModel model, int mode) { - super(id, "reportRowFragment", ReportsPage.this); - - final ReportDef reportDef = (ReportDef) model.getObject(); - final boolean isSiteStatsAdminPage = Locator.getFacade().getStatsAuthz().isSiteStatsAdminPage(); - final boolean isPredefinedReport = reportDef.getSiteId() == null; - - // icon - WebMarkupContainer icon = new WebMarkupContainer("icon"); - if(mode == ReportDefsProvider.MODE_PREDEFINED_REPORTS) { - icon.add(new AttributeModifier("src", new Model(StatsManager.SILK_ICONS_DIR + "report.png"))); - } - add(icon); - - // link - Link link = new Link("link") { - private static final long serialVersionUID = 1L; - @Override - public void onClick() { - setResponsePage(new ReportDataPage(model, new PageParameters().set("siteId", siteId), ReportsPage.this)); - } - }; - - // title - String titleStr = null; - if(reportDef.isTitleLocalized()) { - titleStr = (String) new ResourceModel(reportDef.getTitleBundleKey()).getObject(); - }else{ - titleStr = reportDef.getTitle(); - } - link.add(new Label("title", titleStr)); - add(link); - - // description - String descriptionStr = null; - if(reportDef.isDescriptionLocalized()) { - descriptionStr = (String) new ResourceModel(reportDef.getDescriptionBundleKey()).getObject(); - }else{ - descriptionStr = reportDef.getDescription(); - } - add(new Label("description", descriptionStr)); - - // edit - Link edit = new Link("edit") { - private static final long serialVersionUID = 1L; - @Override - public void onClick() { - if(isPredefinedReport) { - setResponsePage(new ReportsEditPage(model, new PageParameters().set("siteId", siteId).set("predefined", "true"), ReportsPage.this)); - }else{ - setResponsePage(new ReportsEditPage(model, new PageParameters().set("siteId", siteId).set("predefined", "false"), ReportsPage.this)); - } - } - }; - add(edit); - - // hide - WebMarkupContainer hideContainer = new WebMarkupContainer("hideContainer"); - hideContainer.setVisible(isPredefinedReport && isSiteStatsAdminPage && realSiteId.equals(siteId)); - add(hideContainer); - Link hide = new Link("hide") { - private static final long serialVersionUID = 1L; - @Override - public void onClick() { - reportDef.setHidden(!reportDef.isHidden()); - Locator.getFacade().getReportManager().saveReportDefinition(reportDef); - } - }; - hideContainer.add(hide); - Label hideLabel = new Label("hideLabel"); - if(reportDef.isHidden()) { - hideLabel.setDefaultModel(new ResourceModel("report_unhide")); - }else{ - hideLabel.setDefaultModel(new ResourceModel("report_hide")); - } - hide.add(hideLabel); - - // duplicate - WebMarkupContainer duplicateContainer = new WebMarkupContainer("duplicateContainer"); - add(duplicateContainer); - Link duplicate = new Link("duplicate") { - private static final long serialVersionUID = 1L; - @Override - public void onClick() { - String originalTitle = ""; - if(reportDef.isTitleLocalized()) { - originalTitle = (String) new ResourceModel(reportDef.getTitleBundleKey()).getObject(); - }else{ - originalTitle = reportDef.getTitle(); - } - reportDef.setId(0); - String copyTitle = (String) new ResourceModel("report_duplicate_name").getObject(); - copyTitle = copyTitle.replaceAll("\\$\\{title\\}", originalTitle); - reportDef.setTitle(copyTitle); - if(isPredefinedReport && !isSiteStatsAdminPage) { - reportDef.setSiteId(siteId); - reportDef.getReportParams().setSiteId(siteId); - } - Locator.getFacade().getReportManager().saveReportDefinition(reportDef); - } - }; - duplicateContainer.add(duplicate); - - // delete - WebMarkupContainer deleteContainer = new WebMarkupContainer("deleteContainer"); - deleteContainer.setVisible(!isPredefinedReport || (isPredefinedReport && isSiteStatsAdminPage && realSiteId.equals(siteId))); - add(deleteContainer); - Link delete = new Link("delete") { - private static final long serialVersionUID = 1L; - @Override - public void onClick() { - Locator.getFacade().getReportManager().removeReportDefinition(reportDef); - } - @Override - protected CharSequence getOnClickScript(CharSequence url) { - String msg = new StringResourceModel("report_confirm_delete", getPage(), model, - new String[] {(String) new ResourceModel(reportDef.getTitleBundleKey()).getObject()}).getString(); - return "return confirm('"+msg+"');"; - } - }; - deleteContainer.add(delete); - } - - - } - -} +/** + * $URL:$ + * $Id:$ + * + * Copyright (c) 2006-2009 The Sakai 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 + * + * http://www.opensource.org/licenses/ECL-2.0 + * + * 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.sakaiproject.sitestats.tool.wicket.pages; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.apache.wicket.AttributeModifier; +import org.apache.wicket.request.mapper.parameter.PageParameters; +import org.apache.wicket.markup.head.IHeaderResponse; +import org.apache.wicket.markup.head.JavaScriptHeaderItem; +import org.apache.wicket.markup.html.WebMarkupContainer; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.markup.html.link.Link; +import org.apache.wicket.markup.html.panel.Fragment; +import org.apache.wicket.markup.repeater.Item; +import org.apache.wicket.markup.repeater.data.DataView; +import org.apache.wicket.model.CompoundPropertyModel; +import org.apache.wicket.model.Model; +import org.apache.wicket.model.ResourceModel; +import org.apache.wicket.model.StringResourceModel; +import org.sakaiproject.sitestats.api.StatsManager; +import org.sakaiproject.sitestats.api.report.ReportDef; +import org.sakaiproject.sitestats.tool.facade.Locator; +import org.sakaiproject.sitestats.tool.wicket.components.CSSFeedbackPanel; +import org.sakaiproject.sitestats.tool.wicket.components.LastJobRun; +import org.sakaiproject.sitestats.tool.wicket.components.Menus; +import org.sakaiproject.sitestats.tool.wicket.models.ReportDefModel; +import org.sakaiproject.sitestats.tool.wicket.providers.ReportDefsProvider; + +public class ReportsPage extends BasePage { + private static final long serialVersionUID = 1L; + private static Logger LOG = LoggerFactory.getLogger(ReportsPage.class); + + private String realSiteId; + private String siteId; + + + public ReportsPage() { + } + + public ReportsPage(PageParameters pageParameters) { + realSiteId = Locator.getFacade().getToolManager().getCurrentPlacement().getContext(); + if(pageParameters != null) { + siteId = pageParameters.get("siteId").toString(); + } + if(siteId == null){ + siteId = realSiteId; + } + boolean allowed = Locator.getFacade().getStatsAuthz().isUserAbleToViewSiteStats(siteId); + if(allowed) { + renderBody(); + }else{ + setResponsePage(NotAuthorizedPage.class); + } + } + + @Override + public void renderHead(IHeaderResponse response) { + super.renderHead(response); + response.render(JavaScriptHeaderItem.forUrl(JQUERYSCRIPT)); + } + + private void renderBody() { + boolean isSiteStatsAdminPage = Locator.getFacade().getStatsAuthz().isSiteStatsAdminPage(); + boolean isAdministering = isSiteStatsAdminPage && realSiteId.equals(siteId); + boolean isFilteringReportsWithToolsInSite = !isAdministering; + + // menu + add(new Menus("menu", siteId)); + + // model + setDefaultModel(new CompoundPropertyModel(this)); + + add(new Label("pageTitle")); + + // last job run + add(new LastJobRun("lastJobRun", siteId)); + + // form + Form form = new Form("reportsForm"); + add(form); + + // feedback panel (messages) + form.add(new CSSFeedbackPanel("messages")); + + + // my reports + WebMarkupContainer myReportsContainer = new WebMarkupContainer("myReportsContainer"); + // new report link + Link lnkNewReport = new Link("lnkNewReport") { + private static final long serialVersionUID = 1L; + @Override + public void onClick() { + PageParameters pageParameters = new PageParameters().set("siteId", siteId).set("predefined", "false"); + setResponsePage(new ReportsEditPage(null, pageParameters, ReportsPage.this)); + } + }; + myReportsContainer.add(lnkNewReport); + // table + final WebMarkupContainer noReports = new WebMarkupContainer("noReports"); + myReportsContainer.add(noReports); + final ReportDefsProvider myReportsProvider = new ReportDefsProvider(siteId, ReportDefsProvider.MODE_MYREPORTS, true, false); + DataView myReports = new DataView("myReports", myReportsProvider) { + private static final long serialVersionUID = 1L; + + @Override + protected void populateItem(Item item) { + final ReportDefModel model = (ReportDefModel) item.getModel(); + item.add(new ReportRowFragment("reportRow", model, ReportDefsProvider.MODE_MYREPORTS)); + if(((ReportDef) model.getObject()).isHidden()) { + item.add(new AttributeModifier("class", new Model("hiddenReport"))); + } + } + @Override + protected void onBeforeRender() { + noReports.setVisible(getRowCount() == 0); + super.onBeforeRender(); + } + }; + myReportsContainer.add(myReports); + form.add(myReportsContainer); + + + // predefined reports + WebMarkupContainer predefinedReportsContainer = new WebMarkupContainer("predefinedReportsContainer"); + final WebMarkupContainer noPredefReports = new WebMarkupContainer("noReports"); + predefinedReportsContainer.add(noPredefReports); + WebMarkupContainer adminAddContainer = new WebMarkupContainer("adminAddContainer"); + adminAddContainer.setVisible(isAdministering); + predefinedReportsContainer.add(adminAddContainer); + // new predefined report link + Link lnkPDNewReport = new Link("lnkNewReport") { + private static final long serialVersionUID = 1L; + @Override + public void onClick() { + PageParameters pageParameters = new PageParameters().set("siteId", siteId).set("predefined", "true"); + setResponsePage(new ReportsEditPage(null, pageParameters, ReportsPage.this)); + } + }; + adminAddContainer.add(lnkPDNewReport); + final ReportDefsProvider predefinedReportsProvider = new ReportDefsProvider(siteId, ReportDefsProvider.MODE_PREDEFINED_REPORTS, isFilteringReportsWithToolsInSite, isAdministering); + DataView predefinedReports = new DataView("predefinedReports", predefinedReportsProvider) { + private static final long serialVersionUID = 1L; + + @Override + protected void populateItem(Item item) { + final ReportDefModel model = (ReportDefModel) item.getModel(); + item.add(new ReportRowFragment("reportRow", model, ReportDefsProvider.MODE_PREDEFINED_REPORTS)); + if(((ReportDef) model.getObject()).isHidden()) { + item.add(new AttributeModifier("class", new Model("hiddenReport"))); + } + } + @Override + protected void onBeforeRender() { + noPredefReports.setVisible(getRowCount() == 0); + super.onBeforeRender(); + } + }; + predefinedReportsContainer.add(predefinedReports); + predefinedReportsContainer.setVisible(isSiteStatsAdminPage || predefinedReportsProvider.size() != 0); + form.add(predefinedReportsContainer); + + } + + public String getPageTitle() { + return (String) new ResourceModel("menu_reports").getObject(); + } + + /** Fragment representing a row from report list table. */ + public class ReportRowFragment extends Fragment { + private static final long serialVersionUID = 1L; + + public ReportRowFragment(String id, final ReportDefModel model, int mode) { + super(id, "reportRowFragment", ReportsPage.this); + + final ReportDef reportDef = (ReportDef) model.getObject(); + final boolean isSiteStatsAdminPage = Locator.getFacade().getStatsAuthz().isSiteStatsAdminPage(); + final boolean isPredefinedReport = reportDef.getSiteId() == null; + + // icon + WebMarkupContainer icon = new WebMarkupContainer("icon"); + if(mode == ReportDefsProvider.MODE_PREDEFINED_REPORTS) { + icon.add(new AttributeModifier("src", new Model(StatsManager.SILK_ICONS_DIR + "report.png"))); + } + add(icon); + + // link + Link link = new Link("link") { + private static final long serialVersionUID = 1L; + @Override + public void onClick() { + setResponsePage(new ReportDataPage(model, new PageParameters().set("siteId", siteId), ReportsPage.this)); + } + }; + + // title + String titleStr = null; + if(reportDef.isTitleLocalized()) { + titleStr = (String) new ResourceModel(reportDef.getTitleBundleKey()).getObject(); + }else{ + titleStr = reportDef.getTitle(); + } + link.add(new Label("title", titleStr)); + add(link); + + // description + String descriptionStr = null; + if(reportDef.isDescriptionLocalized()) { + descriptionStr = (String) new ResourceModel(reportDef.getDescriptionBundleKey()).getObject(); + }else{ + descriptionStr = reportDef.getDescription(); + } + add(new Label("description", descriptionStr)); + + // edit + Link edit = new Link("edit") { + private static final long serialVersionUID = 1L; + @Override + public void onClick() { + if(isPredefinedReport) { + setResponsePage(new ReportsEditPage(model, new PageParameters().set("siteId", siteId).set("predefined", "true"), ReportsPage.this)); + }else{ + setResponsePage(new ReportsEditPage(model, new PageParameters().set("siteId", siteId).set("predefined", "false"), ReportsPage.this)); + } + } + }; + add(edit); + + // hide + WebMarkupContainer hideContainer = new WebMarkupContainer("hideContainer"); + hideContainer.setVisible(isPredefinedReport && isSiteStatsAdminPage && realSiteId.equals(siteId)); + add(hideContainer); + Link hide = new Link("hide") { + private static final long serialVersionUID = 1L; + @Override + public void onClick() { + reportDef.setHidden(!reportDef.isHidden()); + Locator.getFacade().getReportManager().saveReportDefinition(reportDef); + } + }; + hideContainer.add(hide); + Label hideLabel = new Label("hideLabel"); + if(reportDef.isHidden()) { + hideLabel.setDefaultModel(new ResourceModel("report_unhide")); + }else{ + hideLabel.setDefaultModel(new ResourceModel("report_hide")); + } + hide.add(hideLabel); + + // duplicate + WebMarkupContainer duplicateContainer = new WebMarkupContainer("duplicateContainer"); + add(duplicateContainer); + Link duplicate = new Link("duplicate") { + private static final long serialVersionUID = 1L; + @Override + public void onClick() { + String originalTitle = ""; + if(reportDef.isTitleLocalized()) { + originalTitle = (String) new ResourceModel(reportDef.getTitleBundleKey()).getObject(); + }else{ + originalTitle = reportDef.getTitle(); + } + reportDef.setId(0); + String copyTitle = (String) new ResourceModel("report_duplicate_name").getObject(); + copyTitle = copyTitle.replaceAll("\\$\\{title\\}", originalTitle); + reportDef.setTitle(copyTitle); + if(isPredefinedReport && !isSiteStatsAdminPage) { + reportDef.setSiteId(siteId); + reportDef.getReportParams().setSiteId(siteId); + } + Locator.getFacade().getReportManager().saveReportDefinition(reportDef); + } + }; + duplicateContainer.add(duplicate); + + // delete + WebMarkupContainer deleteContainer = new WebMarkupContainer("deleteContainer"); + deleteContainer.setVisible(!isPredefinedReport || (isPredefinedReport && isSiteStatsAdminPage && realSiteId.equals(siteId))); + add(deleteContainer); + Link delete = new Link("delete") { + private static final long serialVersionUID = 1L; + @Override + public void onClick() { + Locator.getFacade().getReportManager().removeReportDefinition(reportDef); + } + @Override + protected CharSequence getOnClickScript(CharSequence url) { + String msg = new StringResourceModel("report_confirm_delete", getPage(), model, + new String[] {(String) new ResourceModel(reportDef.getTitleBundleKey()).getObject()}).getString(); + return "return confirm('"+msg+"');"; + } + }; + deleteContainer.add(delete); + } + + + } + +} diff --git a/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/providers/ReportDefsProvider.java b/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/providers/ReportDefsProvider.java index 155ee48eb3c7..b0c96d63409f 100644 --- a/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/providers/ReportDefsProvider.java +++ b/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/providers/ReportDefsProvider.java @@ -28,8 +28,8 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.wicket.injection.Injector; import org.apache.wicket.markup.repeater.data.IDataProvider; import org.apache.wicket.model.IModel; @@ -56,7 +56,7 @@ public class ReportDefsProvider implements IDataProvider { private boolean filterWithToolsInSite; private boolean includeHidden; private List<ReportDef> data; - private static Log log = LogFactory.getLog(ReportDefsProvider.class); + private static Logger log = LoggerFactory.getLogger(ReportDefsProvider.class); public ReportDefsProvider(String siteId, int mode, boolean filterWithToolsInSite, boolean includeHidden) { diff --git a/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/providers/ReportsDataProvider.java b/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/providers/ReportsDataProvider.java index c0419329e6fc..06a578e789c3 100644 --- a/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/providers/ReportsDataProvider.java +++ b/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/providers/ReportsDataProvider.java @@ -26,8 +26,8 @@ import java.util.Comparator; import java.util.Iterator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.wicket.extensions.markup.html.repeater.data.sort.SortOrder; import org.apache.wicket.injection.Injector; import org.apache.wicket.model.IModel; @@ -49,7 +49,7 @@ public class ReportsDataProvider extends SortableSearchableDataProvider { private static final long serialVersionUID = 1L; - private static Log LOG = LogFactory.getLog(ReportsDataProvider.class); + private static Logger LOG = LoggerFactory.getLogger(ReportsDataProvider.class); public final static String COL_SITE = StatsManager.T_SITE; public final static String COL_USERID = StatsManager.T_USER; public final static String COL_USERNAME = "userName"; @@ -69,7 +69,7 @@ public class ReportsDataProvider extends SortableSearchableDataProvider { private ReportDef reportDef; private Report report; private int reportRowCount = -1; - private static Log logger = LogFactory.getLog(ReportsDataProvider.class); + private static Logger logger = LoggerFactory.getLogger(ReportsDataProvider.class); public ReportsDataProvider(PrefsData prefsData, ReportDef reportDef) { this(prefsData, reportDef, true); diff --git a/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/widget/ActivityWidget.java b/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/widget/ActivityWidget.java index 27d224093957..491addd8721f 100644 --- a/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/widget/ActivityWidget.java +++ b/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/widget/ActivityWidget.java @@ -22,8 +22,8 @@ import java.util.Arrays; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.wicket.Page; import org.apache.wicket.request.mapper.parameter.PageParameters; import org.apache.wicket.extensions.markup.html.tabs.AbstractTab; @@ -44,7 +44,7 @@ public class ActivityWidget extends Panel { private static final long serialVersionUID = 1L; - private static Log LOG = LogFactory.getLog(ActivityWidget.class); + private static Logger LOG = LoggerFactory.getLogger(ActivityWidget.class); /** The site id. */ private String siteId = null; diff --git a/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/widget/LessonsWidget.java b/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/widget/LessonsWidget.java index 75268e6b8402..f801d5db0719 100644 --- a/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/widget/LessonsWidget.java +++ b/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/widget/LessonsWidget.java @@ -22,8 +22,8 @@ import java.util.Arrays; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.wicket.extensions.markup.html.tabs.AbstractTab; import org.apache.wicket.markup.html.panel.Panel; import org.apache.wicket.model.ResourceModel; @@ -45,7 +45,7 @@ public class LessonsWidget extends Panel { private static final long serialVersionUID = 1L; - private static Log LOG = LogFactory.getLog(LessonsWidget.class); + private static Logger LOG = LoggerFactory.getLogger(LessonsWidget.class); /** The site id. */ private String siteId = null; diff --git a/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/widget/ResourcesWidget.java b/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/widget/ResourcesWidget.java index b6abc1846dff..37dd8918a7b3 100644 --- a/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/widget/ResourcesWidget.java +++ b/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/widget/ResourcesWidget.java @@ -22,8 +22,8 @@ import java.util.Arrays; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.wicket.extensions.markup.html.tabs.AbstractTab; import org.apache.wicket.markup.html.panel.Panel; import org.apache.wicket.model.ResourceModel; @@ -44,7 +44,7 @@ public class ResourcesWidget extends Panel { private static final long serialVersionUID = 1L; - private static Log LOG = LogFactory.getLog(ResourcesWidget.class); + private static Logger LOG = LoggerFactory.getLogger(ResourcesWidget.class); /** The site id. */ private String siteId = null; diff --git a/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/widget/VisitsWidget.java b/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/widget/VisitsWidget.java index 4552ca18d07c..204e6242422c 100644 --- a/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/widget/VisitsWidget.java +++ b/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/widget/VisitsWidget.java @@ -25,8 +25,8 @@ import java.util.List; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.wicket.extensions.markup.html.tabs.AbstractTab; import org.apache.wicket.markup.html.panel.Panel; import org.apache.wicket.model.ResourceModel; @@ -42,7 +42,7 @@ public class VisitsWidget extends Panel { private static final long serialVersionUID = 1L; - private static Log LOG = LogFactory.getLog(VisitsWidget.class); + private static Logger LOG = LoggerFactory.getLogger(VisitsWidget.class); /** The site id. */ private String siteId = null; diff --git a/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/widget/WidgetTabTemplate.java b/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/widget/WidgetTabTemplate.java index 0c1c4adcfd73..3fd8fa1eda4e 100644 --- a/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/widget/WidgetTabTemplate.java +++ b/sitestats/sitestats-tool/src/java/org/sakaiproject/sitestats/tool/wicket/widget/WidgetTabTemplate.java @@ -25,8 +25,8 @@ import java.util.Set; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.wicket.request.mapper.parameter.PageParameters; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior; @@ -62,7 +62,7 @@ public abstract class WidgetTabTemplate extends Panel { private static final long serialVersionUID = 1L; - private static Log LOG = LogFactory.getLog(WidgetTabTemplate.class); + private static Logger LOG = LoggerFactory.getLogger(WidgetTabTemplate.class); public final static int MAX_TABLE_ROWS = 5; public final static Integer FILTER_DATE = Integer.valueOf(0); public final static Integer FILTER_ROLE = Integer.valueOf(1); diff --git a/syllabus/syllabus-app/src/java/org/sakaiproject/tool/syllabus/SyllabusTool.java b/syllabus/syllabus-app/src/java/org/sakaiproject/tool/syllabus/SyllabusTool.java index 1d3d89205426..d4e76344b242 100644 --- a/syllabus/syllabus-app/src/java/org/sakaiproject/tool/syllabus/SyllabusTool.java +++ b/syllabus/syllabus-app/src/java/org/sakaiproject/tool/syllabus/SyllabusTool.java @@ -40,8 +40,8 @@ import javax.faces.event.ValueChangeEvent; import org.apache.commons.fileupload.FileItem; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.syllabus.SyllabusAttachment; import org.sakaiproject.api.app.syllabus.SyllabusData; import org.sakaiproject.api.app.syllabus.SyllabusItem; @@ -337,7 +337,7 @@ public String getDraftStatus() { protected BulkSyllabusEntry bulkEntry = null; - protected Log logger = LogFactory.getLog(SyllabusTool.class); + protected Logger logger = LoggerFactory.getLogger(SyllabusTool.class); protected String filename = null; @@ -683,11 +683,6 @@ public void setSyllabusItem(SyllabusItem syllabusItem) this.syllabusItem = syllabusItem; } - public void setLogger(Log logger) - { - this.logger = logger; - } - public String getFilename() { //logger.info(this + ".getFilename() in SyllabusTool"); diff --git a/syllabus/syllabus-impl/src/java/org/sakaiproject/component/app/syllabus/FixPublicSyllabusAttachmentsJob.java b/syllabus/syllabus-impl/src/java/org/sakaiproject/component/app/syllabus/FixPublicSyllabusAttachmentsJob.java index 3080091ad439..fb026fa7c830 100644 --- a/syllabus/syllabus-impl/src/java/org/sakaiproject/component/app/syllabus/FixPublicSyllabusAttachmentsJob.java +++ b/syllabus/syllabus-impl/src/java/org/sakaiproject/component/app/syllabus/FixPublicSyllabusAttachmentsJob.java @@ -19,8 +19,8 @@ import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; @@ -35,7 +35,7 @@ public class FixPublicSyllabusAttachmentsJob implements Job { - private static final Log LOG = LogFactory.getLog(FixPublicSyllabusAttachmentsJob.class); + private static final Logger LOG = LoggerFactory.getLogger(FixPublicSyllabusAttachmentsJob.class); private SyllabusManager syllabusManager; private AuthzGroupService authzGroupService; private String userId = "admin"; diff --git a/syllabus/syllabus-impl/src/java/org/sakaiproject/component/app/syllabus/SyllabusServiceImpl.java b/syllabus/syllabus-impl/src/java/org/sakaiproject/component/app/syllabus/SyllabusServiceImpl.java index d7da130fa241..3c4dc40b7f88 100644 --- a/syllabus/syllabus-impl/src/java/org/sakaiproject/component/app/syllabus/SyllabusServiceImpl.java +++ b/syllabus/syllabus-impl/src/java/org/sakaiproject/component/app/syllabus/SyllabusServiceImpl.java @@ -33,8 +33,8 @@ import java.util.Vector; import org.apache.commons.codec.binary.Base64; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.syllabus.GatewaySyllabus; import org.sakaiproject.api.app.syllabus.SyllabusAttachment; import org.sakaiproject.api.app.syllabus.SyllabusData; @@ -122,7 +122,7 @@ public class SyllabusServiceImpl implements SyllabusService, EntityTransferrer, private EntityManager entityManager; /** Dependency: a logger component. */ - private Log logger = LogFactory.getLog(SyllabusServiceImpl.class); + private Logger logger = LoggerFactory.getLogger(SyllabusServiceImpl.class); protected NotificationService notificationService = null; protected String m_relativeAccessPoint = null; @@ -158,18 +158,6 @@ public void destroy() { } - - /** - * Establish logger component dependency. - * - * @param logger - * the logger component. - */ - public void setLogger(Log logger) - { - this.logger = logger; - } - /** Dependency: a SyllabusManager component. */ public void setSyllabusManager(SyllabusManager syllabusManager) { diff --git a/taggable/taggable-impl/impl/src/java/org/sakaiproject/taggable/impl/TaggingManagerImpl.java b/taggable/taggable-impl/impl/src/java/org/sakaiproject/taggable/impl/TaggingManagerImpl.java index fc578d2fd512..2a9d3d84aeef 100644 --- a/taggable/taggable-impl/impl/src/java/org/sakaiproject/taggable/impl/TaggingManagerImpl.java +++ b/taggable/taggable-impl/impl/src/java/org/sakaiproject/taggable/impl/TaggingManagerImpl.java @@ -26,8 +26,8 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.exception.PermissionException; import org.sakaiproject.taggable.api.Link; import org.sakaiproject.taggable.api.LinkManager; @@ -45,8 +45,7 @@ public class TaggingManagerImpl implements TaggingManager { - private static final Log logger = LogFactory - .getLog(TaggingManagerImpl.class); + private static final Logger logger = LoggerFactory.getLogger(TaggingManagerImpl.class); protected List<TaggableActivityProducer> taggableActivityProducers = new ArrayList<TaggableActivityProducer>(); diff --git a/textarea/FCKeditor/connector/src/java/org/sakaiproject/connector/fck/ConnectorHelper.java b/textarea/FCKeditor/connector/src/java/org/sakaiproject/connector/fck/ConnectorHelper.java index 193b726699cd..8951ca9b5be8 100644 --- a/textarea/FCKeditor/connector/src/java/org/sakaiproject/connector/fck/ConnectorHelper.java +++ b/textarea/FCKeditor/connector/src/java/org/sakaiproject/connector/fck/ConnectorHelper.java @@ -13,8 +13,8 @@ import java.util.Set; import java.util.Vector; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.assignment.api.AssignmentService; import org.sakaiproject.assignment.api.Assignment; import org.sakaiproject.authz.api.AuthzGroupService; @@ -53,7 +53,7 @@ public class ConnectorHelper { private static String JFORUMS_TOOL_ID = "sakai.jforum.tool"; private static String FORUMS_TOOL_ID = "sakai.forums"; - private static Log M_log = LogFactory.getLog(ConnectorHelper.class); + private static Logger M_log = LoggerFactory.getLogger(ConnectorHelper.class); private SiteService siteService = null; private AssignmentService assignmentService = null; private SecurityService securityService = null; diff --git a/textarea/FCKeditor/connector/src/java/org/sakaiproject/connector/fck/FCKConnectorServlet.java b/textarea/FCKeditor/connector/src/java/org/sakaiproject/connector/fck/FCKConnectorServlet.java index a9dc83dbdc9e..6e81b77cb774 100644 --- a/textarea/FCKeditor/connector/src/java/org/sakaiproject/connector/fck/FCKConnectorServlet.java +++ b/textarea/FCKeditor/connector/src/java/org/sakaiproject/connector/fck/FCKConnectorServlet.java @@ -53,8 +53,8 @@ import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.servlet.ServletFileUpload; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.codec.binary.Base64; import org.sakaiproject.authz.api.SecurityAdvisor; @@ -112,7 +112,7 @@ public class FCKConnectorServlet extends HttpServlet { - private static Log M_log = LogFactory.getLog(FCKConnectorServlet.class); + private static Logger M_log = LoggerFactory.getLogger(FCKConnectorServlet.class); private static final long serialVersionUID = 1L; diff --git a/textarea/elfinder-sakai/src/java/org/sakaiproject/elfinder/sakai/assignment/AssignmentSiteVolumeFactory.java b/textarea/elfinder-sakai/src/java/org/sakaiproject/elfinder/sakai/assignment/AssignmentSiteVolumeFactory.java index ef0d11c6cb8e..a6a12ea3c435 100644 --- a/textarea/elfinder-sakai/src/java/org/sakaiproject/elfinder/sakai/assignment/AssignmentSiteVolumeFactory.java +++ b/textarea/elfinder-sakai/src/java/org/sakaiproject/elfinder/sakai/assignment/AssignmentSiteVolumeFactory.java @@ -1,8 +1,8 @@ package org.sakaiproject.elfinder.sakai.assignment; import cn.bluejoe.elfinder.service.FsItem; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.assignment.api.Assignment; import org.sakaiproject.assignment.api.AssignmentService; import org.sakaiproject.elfinder.sakai.ReadOnlyFsVolume; @@ -26,7 +26,7 @@ */ public class AssignmentSiteVolumeFactory implements SiteVolumeFactory { - private static final Log LOG = LogFactory.getLog(AssignmentSiteVolumeFactory.class); + private static final Logger LOG = LoggerFactory.getLogger(AssignmentSiteVolumeFactory.class); private AssignmentService assignmentService; private UserDirectoryService userDirectoryService; diff --git a/textarea/elfinder-sakai/src/java/org/sakaiproject/elfinder/sakai/content/ContentSiteVolumeFactory.java b/textarea/elfinder-sakai/src/java/org/sakaiproject/elfinder/sakai/content/ContentSiteVolumeFactory.java index 69bb4f62852d..a40ec1f0746f 100644 --- a/textarea/elfinder-sakai/src/java/org/sakaiproject/elfinder/sakai/content/ContentSiteVolumeFactory.java +++ b/textarea/elfinder-sakai/src/java/org/sakaiproject/elfinder/sakai/content/ContentSiteVolumeFactory.java @@ -2,8 +2,8 @@ import cn.bluejoe.elfinder.controller.ErrorException; import cn.bluejoe.elfinder.service.FsItem; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.content.api.*; import org.sakaiproject.elfinder.sakai.SiteVolumeFactory; import org.sakaiproject.elfinder.sakai.SakaiFsService; @@ -30,7 +30,7 @@ */ public class ContentSiteVolumeFactory implements SiteVolumeFactory { - private static final Log LOG = LogFactory.getLog(ContentSiteVolumeFactory.class); + private static final Logger LOG = LoggerFactory.getLogger(ContentSiteVolumeFactory.class); protected ContentHostingService contentHostingService; protected SiteService siteService; diff --git a/tool/tool-tool/su/src/java/org/sakaiproject/tool/su/SuTool.java b/tool/tool-tool/su/src/java/org/sakaiproject/tool/su/SuTool.java index 32c1e96235a5..067f64fddce7 100644 --- a/tool/tool-tool/su/src/java/org/sakaiproject/tool/su/SuTool.java +++ b/tool/tool-tool/su/src/java/org/sakaiproject/tool/su/SuTool.java @@ -28,8 +28,8 @@ import javax.faces.application.FacesMessage; import javax.faces.context.FacesContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroupService; import org.sakaiproject.authz.api.SecurityService; import org.sakaiproject.component.api.ServerConfigurationService; @@ -55,7 +55,7 @@ public class SuTool private static final long serialVersionUID = 1L; /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(SuTool.class); + private static Logger M_log = LoggerFactory.getLogger(SuTool.class); protected static final String SU_BECOME_USER = "su.become"; protected static final String SU_VIEW_USER = "su.view"; diff --git a/user/user-tool-admin-prefs/admin-prefs/src/java/org/sakaiproject/user/tool/AdminPrefsTool.java b/user/user-tool-admin-prefs/admin-prefs/src/java/org/sakaiproject/user/tool/AdminPrefsTool.java index 8dfab49b83f2..410a1eae3ae8 100644 --- a/user/user-tool-admin-prefs/admin-prefs/src/java/org/sakaiproject/user/tool/AdminPrefsTool.java +++ b/user/user-tool-admin-prefs/admin-prefs/src/java/org/sakaiproject/user/tool/AdminPrefsTool.java @@ -29,8 +29,8 @@ import javax.faces.application.FacesMessage; import javax.faces.context.FacesContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.entity.api.ResourceProperties; import org.sakaiproject.entity.api.ResourcePropertiesEdit; import org.sakaiproject.exception.IdUnusedException; @@ -162,7 +162,7 @@ public void setValue(String value) } /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(AdminPrefsTool.class); + private static Logger M_log = LoggerFactory.getLogger(AdminPrefsTool.class); /** The PreferencesEdit being worked on. */ protected PreferencesEdit m_edit = null; diff --git a/user/user-tool-prefs/tool/src/java/org/sakaiproject/user/tool/PrivacyBean.java b/user/user-tool-prefs/tool/src/java/org/sakaiproject/user/tool/PrivacyBean.java index 6681d59b2a64..0496186cbcf1 100644 --- a/user/user-tool-prefs/tool/src/java/org/sakaiproject/user/tool/PrivacyBean.java +++ b/user/user-tool-prefs/tool/src/java/org/sakaiproject/user/tool/PrivacyBean.java @@ -34,8 +34,8 @@ import javax.faces.event.ValueChangeEvent; import javax.faces.model.SelectItem; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroup; import org.sakaiproject.api.privacy.PrivacyManager; @@ -79,7 +79,7 @@ public class PrivacyBean { /** Inject PrivacyManager */ private PrivacyManager privacyManager; - private Log LOG = LogFactory.getLog(PrivacyBean.class); + private Logger LOG = LoggerFactory.getLogger(PrivacyBean.class); public void setPrivacyManager(PrivacyManager privacyManager) { this.privacyManager = privacyManager; diff --git a/user/user-tool-prefs/tool/src/java/org/sakaiproject/user/tool/UserPrefsTool.java b/user/user-tool-prefs/tool/src/java/org/sakaiproject/user/tool/UserPrefsTool.java index 5838d9b62530..4349177ac0f2 100644 --- a/user/user-tool-prefs/tool/src/java/org/sakaiproject/user/tool/UserPrefsTool.java +++ b/user/user-tool-prefs/tool/src/java/org/sakaiproject/user/tool/UserPrefsTool.java @@ -41,8 +41,8 @@ import javax.faces.event.ValueChangeEvent; import javax.faces.model.SelectItem; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.entity.api.ResourceProperties; @@ -71,7 +71,7 @@ public class UserPrefsTool { /** Our log (commons). */ - private static final Log LOG = LogFactory.getLog(UserPrefsTool.class); + private static final Logger LOG = LoggerFactory.getLogger(UserPrefsTool.class); /** * Resource bundle messages */ ResourceLoader msgs = new ResourceLoader("user-tool-prefs"); diff --git a/user/user-tool-prefs/tool/src/java/org/sakaiproject/user/tool/entity/UserPrefsEntityProvider.java b/user/user-tool-prefs/tool/src/java/org/sakaiproject/user/tool/entity/UserPrefsEntityProvider.java index 9b8f00dd16f9..514e3b25a807 100644 --- a/user/user-tool-prefs/tool/src/java/org/sakaiproject/user/tool/entity/UserPrefsEntityProvider.java +++ b/user/user-tool-prefs/tool/src/java/org/sakaiproject/user/tool/entity/UserPrefsEntityProvider.java @@ -30,8 +30,8 @@ import javax.faces.application.FacesMessage; import javax.faces.context.FacesContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.entity.api.ResourceProperties; import org.sakaiproject.entity.api.ResourcePropertiesEdit; import org.sakaiproject.entity.api.Entity; @@ -60,7 +60,7 @@ public class UserPrefsEntityProvider extends AbstractEntityProvider implements CoreEntityProvider, RESTful, RequestStorable { - private static Log log = LogFactory.getLog(UserPrefsEntityProvider.class); + private static Logger log = LoggerFactory.getLogger(UserPrefsEntityProvider.class); public static String PREFIX = "userPrefs"; private PreferencesService preferencesService; private SessionManager sessionManager; diff --git a/user/user-tool/tool/src/java/org/sakaiproject/user/tool/UsersAction.java b/user/user-tool/tool/src/java/org/sakaiproject/user/tool/UsersAction.java index a34e94016775..8a064dce44fc 100644 --- a/user/user-tool/tool/src/java/org/sakaiproject/user/tool/UsersAction.java +++ b/user/user-tool/tool/src/java/org/sakaiproject/user/tool/UsersAction.java @@ -32,6 +32,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import lombok.extern.slf4j.Slf4j; import net.tanesha.recaptcha.ReCaptcha; import net.tanesha.recaptcha.ReCaptchaFactory; import net.tanesha.recaptcha.ReCaptchaResponse; @@ -102,6 +103,7 @@ * UsersAction is the Sakai users editor. * </p> */ +@Slf4j public class UsersAction extends PagedResourceActionII { private static ResourceLoader rb = new ResourceLoader("admin"); @@ -228,12 +230,12 @@ protected void initState(SessionState state, VelocityPortlet portlet, JetspeedRu { if (publicKey == null || publicKey.length() == 0) { - Log.warn("chef", "recaptcha is enabled but no public key is found."); + log.warn("recaptcha is enabled but no public key is found."); enabled = Boolean.FALSE; } if (privateKey == null || privateKey.length() == 0) { - Log.warn("chef", "recaptcha is enabled but no private key is found."); + log.warn("recaptcha is enabled but no private key is found."); enabled = Boolean.FALSE; } } @@ -347,7 +349,7 @@ else if (mode.equals("mode_helper") && StringUtils.equals(status, "processImport } else { - Log.warn("chef", "UsersAction: mode: " + mode); + log.warn("UsersAction: mode: {}", mode); template = buildListContext(state, context); } @@ -600,10 +602,7 @@ private String buildEditContext(SessionState state, Context context) */ private String buildViewContext(SessionState state, Context context) { - if (Log.getLogger("chef").isDebugEnabled()) - { - Log.debug("chef", this + ".buildViewContext"); - } + log.debug("buildViewContext start"); // get current user's id String id = (String) state.getAttribute("user-id"); @@ -641,7 +640,7 @@ private String buildViewContext(SessionState state, Context context) } catch (UserNotDefinedException e) { - Log.warn("chef", "UsersAction.doEdit: user not found: " + id); + log.warn("UsersAction.doEdit: user not found: {}", id); Object[] params = new Object[]{id}; addAlert(state, rb.getFormattedMessage("useact.use_notfou", params)); @@ -763,7 +762,7 @@ public void doImport(RunData data, Context context) state.setAttribute("mode", "import"); - Log.debug("chef", "doImport"); + log.debug("doImport"); List<ImportedUser> users = (List<ImportedUser>)state.getAttribute("importedUsers"); if(users !=null && users.size() > 0) { @@ -793,13 +792,13 @@ public void doImport(RunData data, Context context) } catch (UserIdInvalidException e) { addAlert(state, rb.getString("useact.theuseid2") + ": " + user.getEid()); - Log.error("chef", "Import user error: " + e.getClass() + ":" + e.getMessage()); + log.error("Import user error: {}", e.getMessage(), e); //try to import the rest continue; } catch (UserPermissionException e){ addAlert(state, rb.getString("useact.youdonot3")); - Log.error("chef", "Import user error: " + e.getClass() + ":" + e.getMessage()); + log.error("Import user error: {}", e.getMessage(), e); //this is bad so return return; } @@ -842,7 +841,7 @@ public void doEdit(RunData data, Context context) } catch (UserNotDefinedException e) { - Log.warn("chef", "UsersAction.doEdit: user not found: " + id); + log.warn("UsersAction.doEdit: user not found: {}", id); Object[] params = new Object[]{id}; addAlert(state, rb.getFormattedMessage("useact.use_notfou", params)); @@ -875,10 +874,7 @@ public void doEdit(RunData data, Context context) */ public void doModify(RunData data, Context context) { - if (Log.getLogger("chef").isDebugEnabled()) - { - Log.debug("chef", this + ".doModify"); - } + log.debug("doModify start"); SessionState state = ((JetspeedRunData) data).getPortletSessionState(((JetspeedRunData) data).getJs_peid()); String id = data.getParameters().getString("id"); @@ -897,7 +893,7 @@ public void doModify(RunData data, Context context) } catch (UserNotDefinedException e) { - Log.warn("chef", "UsersAction.doEdit: user not found: " + id); + log.warn("UsersAction.doEdit: user not found: {}", id); Object[] params = new Object[]{id}; addAlert(state, rb.getFormattedMessage("useact.use_notfou", params)); @@ -969,7 +965,7 @@ public void doSave(RunData data, Context context) catch (UserAlreadyDefinedException e) { // TODO: this means the EID value is not unique... when we implement EID fully, we need to check this and send it back to the user - Log.warn("chef", "UsersAction.doSave()" + e); + log.warn("UsersAction.doSave() {}", e.getMessage()); addAlert(state, rb.getString("useact.theuseid1")); return; } @@ -1019,7 +1015,7 @@ public void doSave(RunData data, Context context) } catch (AuthenticationException ex) { - Log.warn("chef", "UsersAction.doSave: authentication failure: " + ex); + log.warn("UsersAction.doSave: authentication failure: {}", ex.getMessage()); } // redirect to home (on next build) @@ -1153,11 +1149,11 @@ public void doRemove_confirmed(RunData data, Context context) AuthzGroup realmEdit = authzGroupService.getAuthzGroup(realm); realmEdit.removeMember(userId); authzGroupService.save(realmEdit); - Log.info("chef", "User " + userEid + " removed from realm " + realm); + log.info("User {} removed from realm {}", userEid, realm); } catch (Exception e) { - Log.error("chef", "Could not remove user " + user.getEid() + " from realm " + realm); + log.error("Could not remove user {} from realm {}", userEid, realm); addAlert(state, rb.getFormattedMessage("useact.couldnot", user.getEid(), realm)); } } @@ -1169,7 +1165,7 @@ public void doRemove_confirmed(RunData data, Context context) UserDirectoryService.removeUser(user); // tracking information - Log.info("chef", "User " + userEid + " has been deleted by " + UserDirectoryService.getCurrentUser().getEid() + ". The internal ID was " + userId); + log.info("User {} has been deleted by {}. The internal ID was {}", userEid, UserDirectoryService.getCurrentUser().getEid(), userId); } catch (UserPermissionException e) { @@ -1739,7 +1735,7 @@ protected ControllerState getState(VelocityPortlet portlet, RunData rundata, Cla { if (portlet == null) { - Log.warn("chef", ".getState(): portlet null"); + log.warn("portlet null"); return null; } @@ -1762,7 +1758,7 @@ protected ControllerState getState(String peid, RunData rundata, Class stateClas { if (peid == null) { - Log.warn("chef", ".getState(): peid null"); + log.warn("peid null"); return null; } @@ -1787,7 +1783,7 @@ protected ControllerState getState(String peid, RunData rundata, Class stateClas } catch (Exception e) { - Log.warn("chef", "getState: " + e.getClass() + ":" + e.getMessage()); + log.warn(e.getMessage(), e); } return null; @@ -1851,7 +1847,7 @@ protected void releaseState(String peid, RunData rundata) } catch (Exception e) { - Log.warn("chef", "releaseState: " + e.getClass() + ":" + e.getMessage()); + log.warn(e.getMessage(), e); } } // releaseState @@ -1917,7 +1913,7 @@ private void processImportedUserFile(SessionState state, Context context, Refere context.put("importedUsers", list); } catch (Exception e) { - Log.error("chef", "Error reading imported file: " + e.getClass() + " : " + e.getMessage()); + log.error("Error reading imported file: {}", e.getMessage(), e); addAlert(state, rb.getString("import.error")); return; } diff --git a/userauditservice/tool/src/java/org/sakaiproject/userauditservice/tool/UserAuditEventLog.java b/userauditservice/tool/src/java/org/sakaiproject/userauditservice/tool/UserAuditEventLog.java index 441f53968136..0efdb741839b 100644 --- a/userauditservice/tool/src/java/org/sakaiproject/userauditservice/tool/UserAuditEventLog.java +++ b/userauditservice/tool/src/java/org/sakaiproject/userauditservice/tool/UserAuditEventLog.java @@ -39,8 +39,8 @@ import javax.faces.context.FacesContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.db.api.SqlService; import org.sakaiproject.jsf.util.LocaleUtil; @@ -53,7 +53,7 @@ import org.sakaiproject.user.api.UserNotDefinedException; public class UserAuditEventLog { - private static final Log log = LogFactory.getLog(UserAuditEventLog.class); + private static final Logger log = LoggerFactory.getLogger(UserAuditEventLog.class); protected List<EventLog> eventLog = new ArrayList<EventLog>(); // Static comparators public static final Comparator<EventLog> displayNameComparatorEL; @@ -367,7 +367,7 @@ private void getEvents() } catch (SQLException e) { - log.warn("Error trying to close the result set in the Roster Event Log!", e); + log.warn("Error trying to close the result set in the Roster Event Logger!", e); } try { @@ -378,7 +378,7 @@ private void getEvents() } catch (SQLException e) { - log.warn("Error trying to close the statement in the Roster Event Log!", e); + log.warn("Error trying to close the statement in the Roster Event Logger!", e); } try { @@ -389,7 +389,7 @@ private void getEvents() } catch (SQLException e) { - log.warn("Error trying to close the database connection in the Roster Event Log!", e); + log.warn("Error trying to close the database connection in the Roster Event Logger!", e); } } } diff --git a/userauditservice/util/src/java/org/sakaiproject/userauditservice/util/UserAuditJsfTool.java b/userauditservice/util/src/java/org/sakaiproject/userauditservice/util/UserAuditJsfTool.java index c231d27db0e4..80e73fb1ad47 100644 --- a/userauditservice/util/src/java/org/sakaiproject/userauditservice/util/UserAuditJsfTool.java +++ b/userauditservice/util/src/java/org/sakaiproject/userauditservice/util/UserAuditJsfTool.java @@ -31,8 +31,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.tool.api.ToolSession; import org.sakaiproject.tool.api.SessionManager; @@ -51,7 +51,7 @@ public class UserAuditJsfTool extends JsfTool { */ private static final long serialVersionUID = -976719461956856669L; - private static final Log logger = LogFactory.getLog(UserAuditJsfTool.class); + private static final Logger logger = LoggerFactory.getLogger(UserAuditJsfTool.class); private SessionManager sessionManager; diff --git a/userauditservice/util/src/java/org/sakaiproject/userauditservice/util/UserAuditRegistrationUtil.java b/userauditservice/util/src/java/org/sakaiproject/userauditservice/util/UserAuditRegistrationUtil.java index 4cd58737e7d5..8a83c5b276aa 100644 --- a/userauditservice/util/src/java/org/sakaiproject/userauditservice/util/UserAuditRegistrationUtil.java +++ b/userauditservice/util/src/java/org/sakaiproject/userauditservice/util/UserAuditRegistrationUtil.java @@ -21,8 +21,8 @@ package org.sakaiproject.userauditservice.util; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -44,7 +44,7 @@ public class UserAuditRegistrationUtil implements UserAuditRegistration { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(UserAuditRegistrationUtil.class); + private static Logger M_log = LoggerFactory.getLogger(UserAuditRegistrationUtil.class); // Services needed protected SqlService sqlService; diff --git a/usermembership/impl/src/java/org/sakaiproject/umem/impl/AuthzImpl.java b/usermembership/impl/src/java/org/sakaiproject/umem/impl/AuthzImpl.java index 799183b4be80..592686bbe5c6 100644 --- a/usermembership/impl/src/java/org/sakaiproject/umem/impl/AuthzImpl.java +++ b/usermembership/impl/src/java/org/sakaiproject/umem/impl/AuthzImpl.java @@ -21,8 +21,8 @@ package org.sakaiproject.umem.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.SecurityService; import org.sakaiproject.authz.cover.FunctionManager; import org.sakaiproject.site.cover.SiteService; @@ -31,7 +31,7 @@ public class AuthzImpl implements Authz { - private static Log LOG = LogFactory.getLog(AuthzImpl.class); + private static Logger LOG = LoggerFactory.getLogger(AuthzImpl.class); /** Sakai services */ private SecurityService M_secs; diff --git a/usermembership/tool/src/java/org/sakaiproject/umem/tool/jsf/HtmlSortHeaderRenderer.java b/usermembership/tool/src/java/org/sakaiproject/umem/tool/jsf/HtmlSortHeaderRenderer.java index 3c6bae913f17..dbbcc639d8b1 100644 --- a/usermembership/tool/src/java/org/sakaiproject/umem/tool/jsf/HtmlSortHeaderRenderer.java +++ b/usermembership/tool/src/java/org/sakaiproject/umem/tool/jsf/HtmlSortHeaderRenderer.java @@ -53,8 +53,8 @@ import javax.faces.context.ResponseWriter; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.myfaces.component.UserRoleUtils; import org.apache.myfaces.component.html.ext.HtmlDataTable; import org.apache.myfaces.custom.sortheader.HtmlCommandSortHeader; @@ -69,7 +69,7 @@ * @author <a href="mailto:jholtzman@berkeley.edu">Josh Holtzman </a> */ public class HtmlSortHeaderRenderer extends HtmlLinkRendererBase { - private static final Log log = LogFactory.getLog(HtmlSortHeaderRenderer.class); + private static final Logger log = LoggerFactory.getLogger(HtmlSortHeaderRenderer.class); public final static String CURRENT_SORT_STYLE = "currentSort"; public final static String NOT_CURRENT_SORT_STYLE = "notCurrentSort"; diff --git a/usermembership/tool/src/java/org/sakaiproject/umem/tool/ui/Export.java b/usermembership/tool/src/java/org/sakaiproject/umem/tool/ui/Export.java index 7389933420ba..a5ef420101da 100644 --- a/usermembership/tool/src/java/org/sakaiproject/umem/tool/ui/Export.java +++ b/usermembership/tool/src/java/org/sakaiproject/umem/tool/ui/Export.java @@ -28,8 +28,8 @@ import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.jsf.spreadsheet.SpreadsheetDataFileWriterCsv; import org.sakaiproject.jsf.spreadsheet.SpreadsheetDataFileWriterXls; import org.sakaiproject.jsf.spreadsheet.SpreadsheetUtil; @@ -39,7 +39,7 @@ public class Export { /** Our log (commons). */ - private static Log LOG = LogFactory.getLog(SiteListBean.class); + private static Logger LOG = LoggerFactory.getLogger(SiteListBean.class); /** Resource bundle */ private static transient ResourceLoader msgs = new ResourceLoader("org.sakaiproject.umem.tool.bundle.Messages"); diff --git a/usermembership/tool/src/java/org/sakaiproject/umem/tool/ui/SiteListBean.java b/usermembership/tool/src/java/org/sakaiproject/umem/tool/ui/SiteListBean.java index a269884e2a1c..b2b2ade26e05 100644 --- a/usermembership/tool/src/java/org/sakaiproject/umem/tool/ui/SiteListBean.java +++ b/usermembership/tool/src/java/org/sakaiproject/umem/tool/ui/SiteListBean.java @@ -43,8 +43,8 @@ import javax.faces.context.FacesContext; import javax.faces.event.ActionEvent; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.api.AuthzGroup; import org.sakaiproject.authz.api.AuthzGroupService; import org.sakaiproject.authz.api.AuthzPermissionException; @@ -82,7 +82,7 @@ public class SiteListBean { private static final String SORT_USER_STATUS = "userStatus"; private static final String SORT_SITE_TERM = "siteTerm"; /** Our log (commons). */ - private static Log LOG = LogFactory.getLog(SiteListBean.class); + private static Logger LOG = LoggerFactory.getLogger(SiteListBean.class); /** Resource bundle */ private transient ResourceLoader msgs = new ResourceLoader("org.sakaiproject.umem.tool.bundle.Messages"); /** Controller fields */ diff --git a/usermembership/tool/src/java/org/sakaiproject/umem/tool/ui/UserListBean.java b/usermembership/tool/src/java/org/sakaiproject/umem/tool/ui/UserListBean.java index 213e9c385da4..d60533def48c 100644 --- a/usermembership/tool/src/java/org/sakaiproject/umem/tool/ui/UserListBean.java +++ b/usermembership/tool/src/java/org/sakaiproject/umem/tool/ui/UserListBean.java @@ -47,8 +47,8 @@ import javax.faces.model.SelectItem; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.db.api.SqlService; import org.sakaiproject.tool.api.ToolManager; @@ -83,7 +83,7 @@ public class UserListBean { private static final String CFG_USER_TYPE_LIMIT_TO_LIST = "userType.limitToList"; /** Our log (commons). */ - private static Log LOG = LogFactory.getLog(UserListBean.class); + private static Logger LOG = LoggerFactory.getLogger(UserListBean.class); /** Resource bundle */ private transient ResourceLoader msgs = new ResourceLoader("org.sakaiproject.umem.tool.bundle.Messages"); diff --git a/velocity/tool/src/java/org/sakaiproject/cheftool/ControllerState.java b/velocity/tool/src/java/org/sakaiproject/cheftool/ControllerState.java index a89f315d9109..9441d77cdfa8 100644 --- a/velocity/tool/src/java/org/sakaiproject/cheftool/ControllerState.java +++ b/velocity/tool/src/java/org/sakaiproject/cheftool/ControllerState.java @@ -111,7 +111,7 @@ public String getKey() */ public void update(Observable o, Object arg) { - // Log.debug("chef", this + ".update: " + arg.toString()); + // Logger.debug("chef", this + ".update: " + arg.toString()); // // CourierService.deliver(getSetId(), getId()); diff --git a/velocity/tool/src/java/org/sakaiproject/cheftool/NewPagedResourceAction.java b/velocity/tool/src/java/org/sakaiproject/cheftool/NewPagedResourceAction.java index 0f7c28265798..6b008402275e 100644 --- a/velocity/tool/src/java/org/sakaiproject/cheftool/NewPagedResourceAction.java +++ b/velocity/tool/src/java/org/sakaiproject/cheftool/NewPagedResourceAction.java @@ -24,6 +24,7 @@ import java.util.List; import java.util.Vector; +import lombok.extern.slf4j.Slf4j; import org.sakaiproject.cheftool.api.Menu; import org.sakaiproject.cheftool.api.MenuItem; import org.sakaiproject.cheftool.menu.MenuEntry; @@ -38,6 +39,7 @@ * PagedResourceAction is a base class that handles paged display of lists of Resourecs. * </p> */ +@Slf4j public abstract class NewPagedResourceAction extends VelocityPortletPaneledAction { /** The default number of items per page. */ @@ -139,17 +141,13 @@ protected void initState(SessionState state, VelocityPortlet portlet, JetspeedRu if (size.intValue() <= 0) { size = new Integer(DEFAULT_PAGE_SIZE); - if (Log.getLogger("chef").isDebugEnabled()) - Log - .debug("chef", this + ".initState: size parameter invalid 1: " - + config.getInitParameter(PARAM_PAGESIZE)); + log.debug("size parameter invalid 1: {}", config.getInitParameter(PARAM_PAGESIZE)); } state.setAttribute(STATE_PAGESIZE, size); } catch (Exception any) { - if (Log.getLogger("chef").isDebugEnabled()) - Log.debug("chef", this + ".initState: size parameter invalid 2: " + any.toString()); + log.debug("size parameter invalid 2: {}", any.toString()); state.setAttribute(STATE_PAGESIZE, new Integer(DEFAULT_PAGE_SIZE)); } } diff --git a/velocity/tool/src/java/org/sakaiproject/cheftool/PagedResourceAction.java b/velocity/tool/src/java/org/sakaiproject/cheftool/PagedResourceAction.java index 0ccd1c608976..cc2d57b16ac7 100644 --- a/velocity/tool/src/java/org/sakaiproject/cheftool/PagedResourceAction.java +++ b/velocity/tool/src/java/org/sakaiproject/cheftool/PagedResourceAction.java @@ -24,6 +24,7 @@ import java.util.List; import java.util.Vector; +import lombok.extern.slf4j.Slf4j; import org.sakaiproject.cheftool.api.Menu; import org.sakaiproject.cheftool.api.MenuItem; import org.sakaiproject.cheftool.menu.MenuDivider; @@ -40,6 +41,7 @@ * PagedResourceAction is a base class that handles paged display of lists of Resourecs. * </p> */ +@Slf4j public abstract class PagedResourceAction extends VelocityPortletPaneledAction { @@ -110,15 +112,13 @@ protected void initState(SessionState state, VelocityPortlet portlet, JetspeedRu if (size.intValue() <= 0) { size = new Integer(DEFAULT_PAGE_SIZE); - if (Log.getLogger("chef").isDebugEnabled()) - Log.debug("chef", this + ".initState: size parameter invalid: " + config.getInitParameter(PARAM_PAGESIZE)); + log.debug("size parameter invalid: {}", config.getInitParameter(PARAM_PAGESIZE)); } state.setAttribute(STATE_PAGESIZE, size); } catch (Exception any) { - if (Log.getLogger("chef").isDebugEnabled()) - Log.debug("chef", this + ".initState: size parameter invalid: " + any.toString()); + log.debug("size parameter invalid: {}", any.toString()); state.setAttribute(STATE_PAGESIZE, new Integer(DEFAULT_PAGE_SIZE)); } } diff --git a/velocity/tool/src/java/org/sakaiproject/cheftool/PagedResourceActionII.java b/velocity/tool/src/java/org/sakaiproject/cheftool/PagedResourceActionII.java index 0b5c862edff3..16020e927801 100644 --- a/velocity/tool/src/java/org/sakaiproject/cheftool/PagedResourceActionII.java +++ b/velocity/tool/src/java/org/sakaiproject/cheftool/PagedResourceActionII.java @@ -24,6 +24,7 @@ import java.util.List; import java.util.Vector; +import lombok.extern.slf4j.Slf4j; import org.sakaiproject.cheftool.api.Menu; import org.sakaiproject.cheftool.api.MenuItem; import org.sakaiproject.cheftool.menu.MenuDivider; @@ -43,6 +44,7 @@ * PagedResourceAction is a base class that handles paged display of lists of Resourecs with service support for paging. * </p> */ +@Slf4j public abstract class PagedResourceActionII extends VelocityPortletPaneledAction { protected static ResourceLoader rb_praII = new ResourceLoader("velocity-tool"); @@ -154,15 +156,13 @@ protected void initState(SessionState state, VelocityPortlet portlet, JetspeedRu if (size.intValue() <= 0) { size = new Integer(DEFAULT_PAGE_SIZE); - if (Log.getLogger("chef").isDebugEnabled()) - Log.debug("chef", this + ".initState: size parameter invalid: " + config.getInitParameter(PARAM_PAGESIZE)); + log.debug("size parameter invalid: {}", config.getInitParameter(PARAM_PAGESIZE)); } state.setAttribute(STATE_PAGESIZE, size); } catch (Exception any) { - if (Log.getLogger("chef").isDebugEnabled()) - Log.debug("chef", this + ".initState: size parameter invalid: " + any.toString()); + log.debug("size parameter invalid: {}" + any.toString()); state.setAttribute(STATE_PAGESIZE, new Integer(DEFAULT_PAGE_SIZE)); } } diff --git a/velocity/tool/src/java/org/sakaiproject/cheftool/PagedResourceHelperAction.java b/velocity/tool/src/java/org/sakaiproject/cheftool/PagedResourceHelperAction.java index e94de2d7a650..005a7e43757d 100644 --- a/velocity/tool/src/java/org/sakaiproject/cheftool/PagedResourceHelperAction.java +++ b/velocity/tool/src/java/org/sakaiproject/cheftool/PagedResourceHelperAction.java @@ -25,6 +25,7 @@ import java.util.ResourceBundle; import java.util.Vector; +import lombok.extern.slf4j.Slf4j; import org.sakaiproject.cheftool.api.Menu; import org.sakaiproject.cheftool.api.MenuItem; import org.sakaiproject.cheftool.menu.MenuDivider; @@ -41,6 +42,7 @@ * PagedResourceAction is a base class that handles paged display of lists of Resourecs. * </p> */ +@Slf4j public abstract class PagedResourceHelperAction extends VelocityPortletPaneledAction { protected static ResourceBundle rb = ResourceBundle.getBundle("velocity-tool"); @@ -115,15 +117,13 @@ protected void initState(SessionState state, VelocityPortlet portlet, JetspeedRu if (size.intValue() <= 0) { size = new Integer(DEFAULT_PAGE_SIZE); - if (Log.getLogger("chef").isDebugEnabled()) - Log.debug("chef", this + ".initState: size parameter invalid: " + config.getInitParameter(PARAM_PAGESIZE)); + log.debug("size parameter invalid: {}", config.getInitParameter(PARAM_PAGESIZE)); } state.setAttribute(STATE_PAGESIZE, size); } catch (Exception any) { - if (Log.getLogger("chef").isDebugEnabled()) - Log.debug("chef", this + ".initState: size parameter invalid: " + any.toString()); + log.debug("size parameter invalid: {}", any.toString()); state.setAttribute(STATE_PAGESIZE, new Integer(DEFAULT_PAGE_SIZE)); } } diff --git a/velocity/tool/src/java/org/sakaiproject/cheftool/ToolServlet.java b/velocity/tool/src/java/org/sakaiproject/cheftool/ToolServlet.java index 031ca4b12feb..f13acfb55b81 100644 --- a/velocity/tool/src/java/org/sakaiproject/cheftool/ToolServlet.java +++ b/velocity/tool/src/java/org/sakaiproject/cheftool/ToolServlet.java @@ -30,8 +30,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.cheftool.api.Alert; import org.sakaiproject.cheftool.api.Menu; import org.sakaiproject.cheftool.menu.MenuImpl; @@ -63,7 +63,7 @@ public abstract class ToolServlet extends VmServlet private static final long serialVersionUID = 1L; /** Our logger. */ - private static Log M_log = LogFactory.getLog(ToolServlet.class); + private static Logger M_log = LoggerFactory.getLogger(ToolServlet.class); /** ToolSession attribute name holding the helper id, if we are in helper mode. NOTE: promote to Tool -ggolden */ protected static final String HELPER_ID = "sakai.tool.helper.id"; diff --git a/velocity/tool/src/java/org/sakaiproject/cheftool/VelocityPortletPaneledAction.java b/velocity/tool/src/java/org/sakaiproject/cheftool/VelocityPortletPaneledAction.java index 1f6909b53c66..2dbf64b500a6 100644 --- a/velocity/tool/src/java/org/sakaiproject/cheftool/VelocityPortletPaneledAction.java +++ b/velocity/tool/src/java/org/sakaiproject/cheftool/VelocityPortletPaneledAction.java @@ -39,8 +39,8 @@ import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.authz.cover.SecurityService; import org.sakaiproject.cheftool.api.Alert; import org.sakaiproject.cheftool.api.Menu; @@ -78,7 +78,7 @@ public abstract class VelocityPortletPaneledAction extends ToolServlet private static final long serialVersionUID = 1L; /** Our logger. */ - private static Log M_log = LogFactory.getLog(VelocityPortletPaneledAction.class); + private static Logger M_log = LoggerFactory.getLogger(VelocityPortletPaneledAction.class); /** message bundle */ private static ResourceLoader rb = new ResourceLoader("velocity-tool"); @@ -118,72 +118,6 @@ public VelocityPortletPaneledAction() { contentHostingService = (ContentHostingService) ComponentManager.get(ContentHostingService.class.getName()); } - protected class MyLogger - { - public void warn(String channel, String msg) - { - M_log.warn(msg); - } - - public void warn(String channel, String msg, Throwable e) - { - M_log.warn(msg, e); - } - - public void debug(String channel, String msg) - { - M_log.debug(msg); - } - - public void debug(String channel, String msg, Throwable e) - { - M_log.debug(msg, e); - } - - public void info(String channel, String msg) - { - M_log.info(msg); - } - - public void info(String channel, String msg, Throwable e) - { - M_log.info(msg, e); - } - - public void error(String channel, String msg) - { - M_log.error(msg); - } - - public void error(String channel, String msg, Throwable e) - { - M_log.error(msg, e); - } - - // to support: if (Log.getLogger("chef").isDebugEnabled()) - public MyLogger getLogger(String name) - { - return this; - } - - public boolean isDebugEnabled() - { - return M_log.isDebugEnabled(); - } - - public boolean isWarnEnabled() - { - return M_log.isWarnEnabled(); - } - - public boolean isInfoEnabled() - { - return M_log.isInfoEnabled(); - } - } - - protected MyLogger Log = new MyLogger(); - protected void initState(SessionState state, VelocityPortlet portlet, JetspeedRunData rundata) { HttpServletRequest req = rundata.getRequest(); diff --git a/velocity/tool/src/java/org/sakaiproject/cheftool/VelocityPortletStateAction.java b/velocity/tool/src/java/org/sakaiproject/cheftool/VelocityPortletStateAction.java index accbd1777708..7af275435993 100644 --- a/velocity/tool/src/java/org/sakaiproject/cheftool/VelocityPortletStateAction.java +++ b/velocity/tool/src/java/org/sakaiproject/cheftool/VelocityPortletStateAction.java @@ -21,6 +21,7 @@ package org.sakaiproject.cheftool; +import lombok.extern.slf4j.Slf4j; import org.sakaiproject.event.api.SessionState; /** @@ -28,7 +29,7 @@ * VelocityPortletStateAction is an extension of VelocityPortletAction which provides a way to associate Controller state with each instances of the portlet using this action. * </p> */ - +@Slf4j public abstract class VelocityPortletStateAction extends VelocityPortletPaneledAction { /** @@ -63,7 +64,7 @@ protected ControllerState getState(VelocityPortlet portlet, RunData rundata, Cla { if (portlet == null) { - Log.warn("chef", this + ".getState(): portlet null"); + log.warn("portlet null"); return null; } @@ -86,7 +87,7 @@ protected ControllerState getState(String peid, RunData rundata, Class stateClas { if (peid == null) { - Log.warn("chef", this + ".getState(): peid null"); + log.warn("peid null"); return null; } @@ -113,7 +114,7 @@ protected ControllerState getState(String peid, RunData rundata, Class stateClas } catch (Exception e) { - Log.warn("chef", "", e); + log.warn(e.getMessage(), e); } return null; @@ -177,7 +178,7 @@ protected void releaseState(String peid, RunData rundata) } catch (Exception e) { - Log.warn("chef", "", e); + log.warn(e.getMessage(), e); } } // releaseState diff --git a/web/web-impl/impl/src/java/org/sakaiproject/web/impl/WebServiceImpl.java b/web/web-impl/impl/src/java/org/sakaiproject/web/impl/WebServiceImpl.java index d6adceb26a09..fea248b1117a 100644 --- a/web/web-impl/impl/src/java/org/sakaiproject/web/impl/WebServiceImpl.java +++ b/web/web-impl/impl/src/java/org/sakaiproject/web/impl/WebServiceImpl.java @@ -29,8 +29,8 @@ import java.util.Vector; import org.apache.commons.codec.binary.Base64; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.entity.api.Entity; import org.sakaiproject.entity.api.EntityTransferrer; import org.sakaiproject.entity.api.HttpAccess; @@ -56,7 +56,7 @@ public class WebServiceImpl implements WebService, EntityTransferrer { - private static Log M_log = LogFactory.getLog(WebServiceImpl.class); + private static Logger M_log = LoggerFactory.getLogger(WebServiceImpl.class); private static final String TOOL_ID = "sakai.iframe"; diff --git a/web/web-portlet/src/java/org/sakaiproject/portlet/util/VelocityHelper.java b/web/web-portlet/src/java/org/sakaiproject/portlet/util/VelocityHelper.java index d589615a041f..667a2b1be475 100644 --- a/web/web-portlet/src/java/org/sakaiproject/portlet/util/VelocityHelper.java +++ b/web/web-portlet/src/java/org/sakaiproject/portlet/util/VelocityHelper.java @@ -16,8 +16,8 @@ import org.apache.velocity.runtime.RuntimeConstants; import org.apache.velocity.app.VelocityEngine; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * a simple VelocityHelper Utility @@ -25,7 +25,7 @@ public class VelocityHelper { /** Our log (commons). */ - private static Log M_log = LogFactory.getLog(VelocityHelper.class); + private static Logger M_log = LoggerFactory.getLogger(VelocityHelper.class); public static VelocityEngine makeEngine(PortletContext pContext) throws java.io.IOException,org.apache.velocity.exception.ResourceNotFoundException, diff --git a/web/web-portlet/src/java/org/sakaiproject/portlets/PortletIFrame.java b/web/web-portlet/src/java/org/sakaiproject/portlets/PortletIFrame.java index e49d7a670e6b..85c89df57b60 100644 --- a/web/web-portlet/src/java/org/sakaiproject/portlets/PortletIFrame.java +++ b/web/web-portlet/src/java/org/sakaiproject/portlets/PortletIFrame.java @@ -22,8 +22,8 @@ package org.sakaiproject.portlets; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.validator.routines.UrlValidator; import org.apache.velocity.VelocityContext; import org.apache.velocity.app.VelocityEngine; @@ -76,7 +76,7 @@ */ public class PortletIFrame extends GenericPortlet { - private static final Log M_log = LogFactory.getLog(PortletIFrame.class); + private static final Logger M_log = LoggerFactory.getLogger(PortletIFrame.class); /** Event for accessing the web-content tool */ protected final static String EVENT_ACCESS_WEB_CONTENT = "webcontent.read"; diff --git a/web/web-tool/tool/src/java/org/sakaiproject/web/tool/IFrameAction.java b/web/web-tool/tool/src/java/org/sakaiproject/web/tool/IFrameAction.java index 07293179b656..2efd7d891bfc 100644 --- a/web/web-tool/tool/src/java/org/sakaiproject/web/tool/IFrameAction.java +++ b/web/web-tool/tool/src/java/org/sakaiproject/web/tool/IFrameAction.java @@ -29,8 +29,8 @@ import java.util.Properties; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.validator.UrlValidator; import org.sakaiproject.authz.api.AuthzGroup; import org.sakaiproject.authz.api.GroupNotDefinedException; @@ -80,7 +80,7 @@ */ public class IFrameAction extends VelocityPortletPaneledAction { - private static Log M_log = LogFactory.getLog(IFrameAction.class); + private static Logger M_log = LoggerFactory.getLogger(IFrameAction.class); /** Event for accessing the web-content tool */ protected final static String EVENT_ACCESS_WEB_CONTENT = "webcontent.read"; diff --git a/webservices/cxf/src/java/org/sakaiproject/webservices/Activity.java b/webservices/cxf/src/java/org/sakaiproject/webservices/Activity.java index 42e770d9270a..e442556a945d 100644 --- a/webservices/cxf/src/java/org/sakaiproject/webservices/Activity.java +++ b/webservices/cxf/src/java/org/sakaiproject/webservices/Activity.java @@ -1,7 +1,7 @@ package org.sakaiproject.webservices; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.event.api.EventQueryService; import org.sakaiproject.tool.api.Session; @@ -27,7 +27,7 @@ @WebService @SOAPBinding(style = SOAPBinding.Style.RPC, use = SOAPBinding.Use.LITERAL) public class Activity extends AbstractWebService { - private static final Log LOG = LogFactory.getLog(Activity.class); + private static final Logger LOG = LoggerFactory.getLogger(Activity.class); /** * Returns a list of events of a user between 2 dates. As this one requires 2 Date objects, diff --git a/webservices/cxf/src/java/org/sakaiproject/webservices/Assignments.java b/webservices/cxf/src/java/org/sakaiproject/webservices/Assignments.java index fbb27b89687f..3428a331cdcd 100644 --- a/webservices/cxf/src/java/org/sakaiproject/webservices/Assignments.java +++ b/webservices/cxf/src/java/org/sakaiproject/webservices/Assignments.java @@ -17,8 +17,8 @@ import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.assignment.api.Assignment; import org.sakaiproject.assignment.api.AssignmentContent; import org.sakaiproject.assignment.api.AssignmentContentEdit; @@ -68,7 +68,7 @@ @SOAPBinding(style= SOAPBinding.Style.RPC, use= SOAPBinding.Use.LITERAL) public class Assignments extends AbstractWebService { - private static final Log LOG = LogFactory.getLog(Assignments.class); + private static final Logger LOG = LoggerFactory.getLogger(Assignments.class); /** The maximum trial number to get an uniq assignment title in gradebook */ private static final int MAXIMUM_ATTEMPTS_FOR_UNIQUENESS = 100; diff --git a/webservices/cxf/src/java/org/sakaiproject/webservices/ContentHosting.java b/webservices/cxf/src/java/org/sakaiproject/webservices/ContentHosting.java index 40c7af5da65c..8f1716c9a8c4 100644 --- a/webservices/cxf/src/java/org/sakaiproject/webservices/ContentHosting.java +++ b/webservices/cxf/src/java/org/sakaiproject/webservices/ContentHosting.java @@ -29,8 +29,8 @@ import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.content.api.ContentCollection; import org.sakaiproject.content.api.ContentCollectionEdit; import org.sakaiproject.content.api.ContentEntity; @@ -69,7 +69,7 @@ @SOAPBinding(style = SOAPBinding.Style.RPC, use = SOAPBinding.Use.LITERAL) public class ContentHosting extends AbstractWebService { - private static final Log LOG = LogFactory.getLog(ContentHosting.class); + private static final Logger LOG = LoggerFactory.getLogger(ContentHosting.class); private static final String VIRTUAL_ROOT_ID = "Virtual-Root-Identifier"; private static final String VIRTUAL_ROOT_NAME = "Federated Collections"; private static final String RESOURCE_TYPE_COLLECTION = "collection"; @@ -890,4 +890,4 @@ public String siteHideResources( return "success"; } -} \ No newline at end of file +} diff --git a/webservices/cxf/src/java/org/sakaiproject/webservices/MessageForums.java b/webservices/cxf/src/java/org/sakaiproject/webservices/MessageForums.java index 8a0d9dc8c50b..b762fa02e0a3 100644 --- a/webservices/cxf/src/java/org/sakaiproject/webservices/MessageForums.java +++ b/webservices/cxf/src/java/org/sakaiproject/webservices/MessageForums.java @@ -15,8 +15,8 @@ */ package org.sakaiproject.webservices; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.api.app.messageforums.Area; import org.sakaiproject.api.app.messageforums.DiscussionForum; import org.sakaiproject.api.app.messageforums.DiscussionTopic; @@ -50,7 +50,7 @@ public class MessageForums extends AbstractWebService { */ protected final static String CURRENT_TOOL = "sakai:ToolComponent:current.tool"; - private static Log LOG = LogFactory.getLog(MessageForums.class); + private static Logger LOG = LoggerFactory.getLogger(MessageForums.class); /** * Adds a message to an existing forum or if there are no forums to add, adds a forum diff --git a/webservices/cxf/src/java/org/sakaiproject/webservices/SakaiConfiguration.java b/webservices/cxf/src/java/org/sakaiproject/webservices/SakaiConfiguration.java index 32e804218981..30121e579f6f 100644 --- a/webservices/cxf/src/java/org/sakaiproject/webservices/SakaiConfiguration.java +++ b/webservices/cxf/src/java/org/sakaiproject/webservices/SakaiConfiguration.java @@ -16,8 +16,8 @@ package org.sakaiproject.webservices; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.log4j.LogManager; import org.apache.log4j.PropertyConfigurator; import org.sakaiproject.component.api.ServerConfigurationService; @@ -53,7 +53,7 @@ @WebService @SOAPBinding(style = SOAPBinding.Style.RPC, use = SOAPBinding.Use.LITERAL) public class SakaiConfiguration extends AbstractWebService { - private static final Log LOG = LogFactory.getLog(SakaiConfiguration.class); + private static final Logger LOG = LoggerFactory.getLogger(SakaiConfiguration.class); @WebMethod @Path("/adjustLogLevel") @@ -266,4 +266,4 @@ private String getXML(String rootNodeName, Map<String, String> propertyMap) { return Xml.writeDocumentToString(doc); } -} \ No newline at end of file +} diff --git a/webservices/cxf/src/java/org/sakaiproject/webservices/SakaiGradebook.java b/webservices/cxf/src/java/org/sakaiproject/webservices/SakaiGradebook.java index 331577b16790..53628db3d78a 100644 --- a/webservices/cxf/src/java/org/sakaiproject/webservices/SakaiGradebook.java +++ b/webservices/cxf/src/java/org/sakaiproject/webservices/SakaiGradebook.java @@ -1,7 +1,7 @@ package org.sakaiproject.webservices; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.service.gradebook.shared.GradingScaleDefinition; import org.sakaiproject.tool.api.Session; @@ -38,7 +38,7 @@ @WebService @SOAPBinding(style = SOAPBinding.Style.RPC, use = SOAPBinding.Use.LITERAL) public class SakaiGradebook extends AbstractWebService { - private static final Log LOG = LogFactory.getLog(SakaiGradebook.class); + private static final Logger LOG = LoggerFactory.getLogger(SakaiGradebook.class); protected GradebookFrameworkService gradebookFrameworkService; diff --git a/webservices/cxf/src/java/org/sakaiproject/webservices/SakaiJob.java b/webservices/cxf/src/java/org/sakaiproject/webservices/SakaiJob.java index d9a404d3bf9f..7ec0794df19d 100644 --- a/webservices/cxf/src/java/org/sakaiproject/webservices/SakaiJob.java +++ b/webservices/cxf/src/java/org/sakaiproject/webservices/SakaiJob.java @@ -24,8 +24,8 @@ import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.quartz.JobBuilder; import org.quartz.JobDataMap; import org.quartz.JobDetail; @@ -47,7 +47,7 @@ @SOAPBinding(style = SOAPBinding.Style.RPC, use = SOAPBinding.Use.LITERAL) public class SakaiJob extends AbstractWebService { - private static final Log LOG = LogFactory.getLog(SakaiJob.class); + private static final Logger LOG = LoggerFactory.getLogger(SakaiJob.class); /** * Delete a job from the Job Scheduler diff --git a/webservices/cxf/src/java/org/sakaiproject/webservices/SakaiLogin.java b/webservices/cxf/src/java/org/sakaiproject/webservices/SakaiLogin.java index 1269f8312c51..aa4a4459b877 100644 --- a/webservices/cxf/src/java/org/sakaiproject/webservices/SakaiLogin.java +++ b/webservices/cxf/src/java/org/sakaiproject/webservices/SakaiLogin.java @@ -25,8 +25,8 @@ import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.cxf.message.Message; import org.apache.cxf.phase.PhaseInterceptorChain; import org.apache.cxf.transport.http.AbstractHTTPDestination; @@ -38,7 +38,7 @@ @SOAPBinding(style= SOAPBinding.Style.RPC, use= SOAPBinding.Use.LITERAL) public class SakaiLogin extends AbstractWebService { - private static final Log LOG = LogFactory.getLog(SakaiLogin.class); + private static final Logger LOG = LoggerFactory.getLogger(SakaiLogin.class); /** * Login with the supplied credentials and return the session string which can be used in subsequent web service calls, ie via SakaiScript diff --git a/webservices/cxf/src/java/org/sakaiproject/webservices/SakaiPortalLogin.java b/webservices/cxf/src/java/org/sakaiproject/webservices/SakaiPortalLogin.java index b278b0402c5e..4e3b82eb52d7 100644 --- a/webservices/cxf/src/java/org/sakaiproject/webservices/SakaiPortalLogin.java +++ b/webservices/cxf/src/java/org/sakaiproject/webservices/SakaiPortalLogin.java @@ -24,8 +24,8 @@ import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.api.Session; import org.sakaiproject.user.api.User; @@ -79,7 +79,7 @@ @SOAPBinding(style = SOAPBinding.Style.RPC, use = SOAPBinding.Use.LITERAL) public class SakaiPortalLogin extends AbstractWebService { - private static final Log LOG = LogFactory.getLog(SakaiPortalLogin.class); + private static final Logger LOG = LoggerFactory.getLogger(SakaiPortalLogin.class); private User getSakaiUser(String id) { User user = null ; diff --git a/webservices/cxf/src/java/org/sakaiproject/webservices/SakaiReport.java b/webservices/cxf/src/java/org/sakaiproject/webservices/SakaiReport.java index ba4691e457c3..4da5ee6864b8 100644 --- a/webservices/cxf/src/java/org/sakaiproject/webservices/SakaiReport.java +++ b/webservices/cxf/src/java/org/sakaiproject/webservices/SakaiReport.java @@ -17,8 +17,8 @@ import org.apache.commons.codec.digest.DigestUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.xml.serializer.utils.XMLChar; import org.json.JSONArray; import org.json.JSONException; @@ -69,7 +69,7 @@ @SOAPBinding(style = SOAPBinding.Style.RPC, use = SOAPBinding.Use.LITERAL) public class SakaiReport extends AbstractWebService { - private static final Log LOG = LogFactory.getLog(SakaiReport.class); + private static final Logger LOG = LoggerFactory.getLogger(SakaiReport.class); private SqlService sqlService; diff --git a/webservices/cxf/src/java/org/sakaiproject/webservices/SakaiScript.java b/webservices/cxf/src/java/org/sakaiproject/webservices/SakaiScript.java index 29264aa5c78e..27a2fb922fc6 100644 --- a/webservices/cxf/src/java/org/sakaiproject/webservices/SakaiScript.java +++ b/webservices/cxf/src/java/org/sakaiproject/webservices/SakaiScript.java @@ -40,8 +40,8 @@ import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.LocaleUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.cxf.message.Message; import org.apache.cxf.phase.PhaseInterceptorChain; import org.apache.cxf.transport.http.AbstractHTTPDestination; @@ -91,7 +91,7 @@ @SOAPBinding(style = SOAPBinding.Style.RPC, use = SOAPBinding.Use.LITERAL) public class SakaiScript extends AbstractWebService { - private static final Log LOG = LogFactory.getLog(SakaiScript.class); + private static final Logger LOG = LoggerFactory.getLogger(SakaiScript.class); private static final String ADMIN_SITE_REALM = "/site/!admin"; private static final String SESSION_ATTR_NAME_ORIGIN = "origin"; diff --git a/webservices/cxf/src/java/org/sakaiproject/webservices/ShortenedUrl.java b/webservices/cxf/src/java/org/sakaiproject/webservices/ShortenedUrl.java index b5ea73084c9c..f34ffe713b32 100644 --- a/webservices/cxf/src/java/org/sakaiproject/webservices/ShortenedUrl.java +++ b/webservices/cxf/src/java/org/sakaiproject/webservices/ShortenedUrl.java @@ -24,8 +24,8 @@ import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.tool.api.Session; /** @@ -38,7 +38,7 @@ @SOAPBinding(style = SOAPBinding.Style.RPC, use = SOAPBinding.Use.LITERAL) public class ShortenedUrl extends AbstractWebService { - private static final Log LOG = LogFactory.getLog(ShortenedUrl.class); + private static final Logger LOG = LoggerFactory.getLogger(ShortenedUrl.class); /** * Shorten a URL. Optionally specify the secure property to get a longer key, 22 chars vs 6. diff --git a/webservices/cxf/src/java/org/sakaiproject/webservices/TestsAndQuizzes.java b/webservices/cxf/src/java/org/sakaiproject/webservices/TestsAndQuizzes.java index b68d589bc30a..e31ff582b41f 100644 --- a/webservices/cxf/src/java/org/sakaiproject/webservices/TestsAndQuizzes.java +++ b/webservices/cxf/src/java/org/sakaiproject/webservices/TestsAndQuizzes.java @@ -15,8 +15,8 @@ */ package org.sakaiproject.webservices; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sakaiproject.exception.IdUnusedException; import org.sakaiproject.site.api.Site; import org.sakaiproject.site.api.SiteService.SelectionType; @@ -64,7 +64,7 @@ @SOAPBinding(style = SOAPBinding.Style.RPC, use = SOAPBinding.Use.LITERAL) public class TestsAndQuizzes extends AbstractWebService { - private static final Log LOG = LogFactory.getLog(TestsAndQuizzes.class); + private static final Logger LOG = LoggerFactory.getLogger(TestsAndQuizzes.class); /** * createAsessmentFromText - WS Endpoint, exposing the SamLite createImportedAssessment() diff --git a/webservices/cxf/src/test/java/org/sakaiproject/webservices/SakaiScriptAddMemberToSiteWithRoleBatchTest.java b/webservices/cxf/src/test/java/org/sakaiproject/webservices/SakaiScriptAddMemberToSiteWithRoleBatchTest.java index 313a6d2cf139..0ef6e49b1cf4 100644 --- a/webservices/cxf/src/test/java/org/sakaiproject/webservices/SakaiScriptAddMemberToSiteWithRoleBatchTest.java +++ b/webservices/cxf/src/test/java/org/sakaiproject/webservices/SakaiScriptAddMemberToSiteWithRoleBatchTest.java @@ -29,8 +29,8 @@ import org.sakaiproject.site.api.Site; import org.junit.rules.ExpectedException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.lang.RuntimeException; diff --git a/webservices/cxf/src/test/java/org/sakaiproject/webservices/SakaiScriptChangeSiteMemberStatusTest.java b/webservices/cxf/src/test/java/org/sakaiproject/webservices/SakaiScriptChangeSiteMemberStatusTest.java index 55952eb3d741..4cb8d5774445 100644 --- a/webservices/cxf/src/test/java/org/sakaiproject/webservices/SakaiScriptChangeSiteMemberStatusTest.java +++ b/webservices/cxf/src/test/java/org/sakaiproject/webservices/SakaiScriptChangeSiteMemberStatusTest.java @@ -29,8 +29,8 @@ import org.sakaiproject.authz.api.AuthzGroup; import org.sakaiproject.authz.api.Member; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.lang.RuntimeException; diff --git a/webservices/cxf/src/test/java/org/sakaiproject/webservices/SakaiScriptRemoveMemberFromSiteBatchTest.java b/webservices/cxf/src/test/java/org/sakaiproject/webservices/SakaiScriptRemoveMemberFromSiteBatchTest.java index 8f8fa4303642..55427f941a65 100644 --- a/webservices/cxf/src/test/java/org/sakaiproject/webservices/SakaiScriptRemoveMemberFromSiteBatchTest.java +++ b/webservices/cxf/src/test/java/org/sakaiproject/webservices/SakaiScriptRemoveMemberFromSiteBatchTest.java @@ -29,8 +29,8 @@ import org.sakaiproject.site.api.Site; import org.junit.rules.ExpectedException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.lang.RuntimeException; diff --git a/webservices/cxf/src/test/java/org/sakaiproject/webservices/SakaiScriptSetUserPropertyTest.java b/webservices/cxf/src/test/java/org/sakaiproject/webservices/SakaiScriptSetUserPropertyTest.java index 07f6f347fcaf..dd02a3840675 100644 --- a/webservices/cxf/src/test/java/org/sakaiproject/webservices/SakaiScriptSetUserPropertyTest.java +++ b/webservices/cxf/src/test/java/org/sakaiproject/webservices/SakaiScriptSetUserPropertyTest.java @@ -29,8 +29,8 @@ import org.sakaiproject.user.api.UserEdit; import org.junit.rules.ExpectedException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.lang.RuntimeException; diff --git a/webservices/cxf/src/test/java/org/sakaiproject/webservices/SakaiScriptSetUserTimeZoneTest.java b/webservices/cxf/src/test/java/org/sakaiproject/webservices/SakaiScriptSetUserTimeZoneTest.java index 8d69703785ed..dedc9eb54bef 100644 --- a/webservices/cxf/src/test/java/org/sakaiproject/webservices/SakaiScriptSetUserTimeZoneTest.java +++ b/webservices/cxf/src/test/java/org/sakaiproject/webservices/SakaiScriptSetUserTimeZoneTest.java @@ -29,8 +29,8 @@ import org.sakaiproject.user.api.User; import org.junit.rules.ExpectedException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.lang.RuntimeException;