001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (c) Alkacon Software GmbH & Co. KG (https://www.alkacon.com) 006 * 007 * This library is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU Lesser General Public 009 * License as published by the Free Software Foundation; either 010 * version 2.1 of the License, or (at your option) any later version. 011 * 012 * This library is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * For further information about Alkacon Software, please see the 018 * company website: https://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: https://www.opencms.org 022 * 023 * You should have received a copy of the GNU Lesser General Public 024 * License along with this library; if not, write to the Free Software 025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 026 */ 027 028package org.opencms.ade.contenteditor.shared; 029 030import java.util.List; 031 032import com.google.gwt.user.client.rpc.IsSerializable; 033 034/** 035 * Contains status information about a content augmentation that has just been run. 036 */ 037public class CmsContentAugmentationDetails implements IsSerializable { 038 039 /** Indicates that the job was aborted. */ 040 public static final String PROGRESS_ABORTED = "ABORTED"; 041 042 /** Indicates that the job has finished. */ 043 public static final String PROGRESS_DONE = "DONE"; 044 045 /** An error that happened on the server side. */ 046 private Throwable m_exception; 047 048 /** The message to display, as HTML (null for no message) . */ 049 private String m_htmlMessage; 050 051 /** 052 * The list of locales from the augmented content. 053 */ 054 private List<String> m_locales; 055 056 /** The locale to switch to (null to not switch locale). */ 057 private String m_nextLocale; 058 059 /** The progress message. */ 060 private String m_progress; 061 062 /** The result caption. */ 063 private String m_resultCaption; 064 065 /** 066 * Creates a new instance. 067 */ 068 public CmsContentAugmentationDetails() { 069 070 } 071 072 /** 073 * Gets the exception (if any) from the server side. 074 * 075 * @return the exception from the server side 076 */ 077 public Throwable getException() { 078 079 return m_exception; 080 } 081 082 /** 083 * Gets the message to display to the user, in HTML format. 084 * 085 * @return the HTML message 086 */ 087 public String getHtmlMessage() { 088 089 return m_htmlMessage; 090 } 091 092 /** 093 * Gets the locales that are part of the augmented content (as strings). 094 * 095 * @return the list of locales 096 */ 097 public List<String> getLocales() { 098 099 return m_locales; 100 } 101 102 /** 103 * Gets tje next locale to switch to (might be null if we should remain in the current locale). 104 * 105 * @return the locale to switch to 106 */ 107 public String getNextLocale() { 108 109 return m_nextLocale; 110 } 111 112 /** 113 * Gets the progress message. 114 * 115 * @return the progress message 116 */ 117 public String getProgress() { 118 119 return m_progress; 120 } 121 122 /** 123 * Gets the caption to display on the result dialog. 124 * 125 * @return the caption to display on the results dialog 126 */ 127 public String getResultCaption() { 128 129 return m_resultCaption; 130 } 131 132 /** 133 * Checks if the augmentation job was aborted. 134 * 135 * 136 * @return true if the augmentation job was aborted. 137 */ 138 public boolean isAborted() { 139 140 return PROGRESS_ABORTED.equals(m_progress); 141 } 142 143 /** 144 * Checks if the content augmentation has sucessfully completed. 145 * 146 * @return true if the content augmentation has successfully completed 147 */ 148 public boolean isDone() { 149 150 return PROGRESS_DONE.equals(m_progress); 151 } 152 153 /** 154 * Sets the exception to display. 155 * 156 * @param exception the exception to display 157 */ 158 public void setException(Throwable exception) { 159 160 m_exception = exception; 161 } 162 163 /** 164 * Sets the message to display, in HTML format 165 * 166 * @param htmlMessage the message to display 167 */ 168 public void setHtmlMessage(String htmlMessage) { 169 170 m_htmlMessage = htmlMessage; 171 } 172 173 /** 174 * Sets the locales. 175 * 176 * @param locales the locales 177 */ 178 public void setLocales(List<String> locales) { 179 180 m_locales = locales; 181 } 182 183 /** 184 * Sets the next locale to switch to (can be null if current locale should be maintained). 185 * 186 * @param nextLocale the next locale to switch to 187 */ 188 public void setNextLocale(String nextLocale) { 189 190 m_nextLocale = nextLocale; 191 } 192 193 /** 194 * Sets the progress message. 195 * 196 * @param progress the progress message 197 */ 198 public void setProgress(String progress) { 199 200 m_progress = progress; 201 } 202 203 /** 204 * Sets the caption to display on the results dialog. 205 * 206 * @param resultCaption the caption to display on the results dialog 207 */ 208 public void setResultCaption(String resultCaption) { 209 210 m_resultCaption = resultCaption; 211 } 212 213}