001/* 002 * Copyright 2016 Anyware Services 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.ametys.web.publication; 017 018import java.time.ZonedDateTime; 019import java.util.ArrayList; 020import java.util.Collections; 021import java.util.List; 022 023import org.ametys.core.schedule.Runnable; 024import org.ametys.core.user.UserIdentity; 025import org.ametys.runtime.i18n.I18nizableText; 026 027/** 028 * A {@link Runnable} which schedules a {@link PublishOrUnpublishPageSchedulable} task for unpublishing a page. 029 */ 030public class UnpublishPageRunnable extends AbstractPublishOrUnpublishPageRunnable 031{ 032 /** 033 * Constructor 034 * @param pageId The id of the page to unpublish 035 * @param pageName The name of the page to unpublish 036 * @param userIdentity The {@link UserIdentity} to launch the runnable task 037 * @param date The date when to unpublish the page 038 */ 039 public UnpublishPageRunnable(String pageId, String pageName, UserIdentity userIdentity, ZonedDateTime date) 040 { 041 super(pageId, pageName, userIdentity, date); 042 } 043 044 @Override 045 public I18nizableText getLabel() 046 { 047 return new I18nizableText("plugin.web", "PLUGINS_WEB_RUNNABLE_UNPUBLISH_PAGE_LABEL", Collections.singletonList(_pageName)); 048 } 049 050 @Override 051 public I18nizableText getDescription() 052 { 053 List<String> parameters = new ArrayList<>(); 054 parameters.add(_pageId); 055 parameters.add(_pageName); 056 return new I18nizableText("plugin.web", "PLUGINS_WEB_RUNNABLE_UNPUBLISH_PAGE_DESCRIPTION", parameters); 057 } 058}