001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://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: http://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: http://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.gwt.shared.rpc; 029 030import org.opencms.db.CmsResourceState; 031import org.opencms.gwt.shared.CmsBroadcastMessage; 032import org.opencms.gwt.shared.CmsCategoryTreeEntry; 033import org.opencms.gwt.shared.CmsContextMenuEntryBean; 034import org.opencms.gwt.shared.CmsCoreData; 035import org.opencms.gwt.shared.CmsCoreData.AdeContext; 036import org.opencms.gwt.shared.CmsCoreData.UserInfo; 037import org.opencms.gwt.shared.CmsResourceCategoryInfo; 038import org.opencms.gwt.shared.CmsReturnLinkInfo; 039import org.opencms.gwt.shared.CmsUserSettingsBean; 040import org.opencms.gwt.shared.CmsValidationQuery; 041import org.opencms.gwt.shared.CmsValidationResult; 042import org.opencms.util.CmsUUID; 043 044import java.util.List; 045import java.util.Map; 046import java.util.Set; 047 048import com.google.gwt.user.client.rpc.AsyncCallback; 049import com.google.gwt.user.client.rpc.SynchronizedRpcRequest; 050 051/** 052 * Provides general core services.<p> 053 * 054 * @since 8.0.0 055 * 056 * @see org.opencms.gwt.CmsCoreService 057 * @see org.opencms.gwt.shared.rpc.I_CmsCoreService 058 * @see org.opencms.gwt.shared.rpc.I_CmsCoreServiceAsync 059 */ 060public interface I_CmsCoreServiceAsync { 061 062 /** 063 * Changes the password of the current user.<p> 064 * 065 * @param oldPassword the old password 066 * @param newPassword the value entered for the new password 067 * @param newPasswordConfirm the value entered for the confirmation of the new password 068 * 069 * @param callback the callback for the result 070 */ 071 void changePassword( 072 String oldPassword, 073 String newPassword, 074 String newPasswordConfirm, 075 AsyncCallback<String> callback); 076 077 /** 078 * Creates a new UUID.<p> 079 * 080 * @param callback the async callback 081 */ 082 void createUUID(AsyncCallback<CmsUUID> callback); 083 084 /** 085 * Returns the latest messages for the current user.<p> 086 * 087 * @param callback the async callback 088 */ 089 void getBroadcast(AsyncCallback<List<CmsBroadcastMessage>> callback); 090 091 /** 092 * Returns the categories for the given search parameters.<p> 093 * 094 * @param fromCatPath the category path to start with, can be <code>null</code> or empty to use the root 095 * @param includeSubCats if to include all categories, or first level child categories only 096 * @param refVfsPath the reference path (site-relative path according to which the available category repositories are determined), 097 * can be <code>null</code> to only use the system repository 098 * @param callback the async callback 099 */ 100 void getCategories( 101 String fromCatPath, 102 boolean includeSubCats, 103 String refVfsPath, 104 AsyncCallback<List<CmsCategoryTreeEntry>> callback); 105 106 /** 107 * Returns the categories for the given search parameters.<p> 108 * 109 * @param fromCatPath the category path to start with, can be <code>null</code> or empty to use the root 110 * @param includeSubCats if to include all categories, or first level child categories only 111 * @param refVfsPath the reference path (site-relative path according to which the available category repositories are determined), 112 * can be <code>null</code> to only use the system repository 113 * @param withRepositories flag, indicating if also the category repositories should be returned as category 114 * @param callback the async callback 115 */ 116 void getCategories( 117 String fromCatPath, 118 boolean includeSubCats, 119 String refVfsPath, 120 boolean withRepositories, 121 AsyncCallback<List<CmsCategoryTreeEntry>> callback); 122 123 /** 124 * Returns the categories for the given reference site-path.<p> 125 * 126 * @param sitePath the reference site-path 127 * @param callback the async callback 128 */ 129 void getCategoriesForSitePath(String sitePath, AsyncCallback<List<CmsCategoryTreeEntry>> callback); 130 131 /** 132 * Returns the category information for the given resource.<p> 133 * 134 * @param structureId the resource structure id 135 * @param callback the callback which receives the result 136 */ 137 void getCategoryInfo(CmsUUID structureId, AsyncCallback<CmsResourceCategoryInfo> callback); 138 139 /** 140 * Returns a list of menu entry beans for the context menu.<p> 141 * 142 * @param structureId the structure id of the resource for which to get the context menu 143 * @param context the ade context (sitemap or containerpage) 144 * @param callback the asynchronous callback 145 */ 146 void getContextMenuEntries( 147 CmsUUID structureId, 148 AdeContext context, 149 AsyncCallback<List<CmsContextMenuEntryBean>> callback); 150 151 /** 152 * Given a return code, returns the link to the page which corresponds to the return code.<p> 153 * 154 * @param returnCode the return code 155 * @param callback the asynchronous callback 156 */ 157 void getLinkForReturnCode(String returnCode, AsyncCallback<CmsReturnLinkInfo> callback); 158 159 /** 160 * Gets the resource state of a resource.<p> 161 * 162 * @param structureId the structure id of the resource 163 * @param callback the callback which receives the result 164 */ 165 void getResourceState(CmsUUID structureId, AsyncCallback<CmsResourceState> callback); 166 167 /** 168 * Returns a unique filename for the given base name and the parent folder.<p> 169 * 170 * This is executed in a synchronized request.<p> 171 * 172 * @param parentFolder the parent folder of the file 173 * @param baseName the proposed file name 174 * @param callback the callback which receives the result 175 */ 176 void getUniqueFileName(String parentFolder, String baseName, AsyncCallback<String> callback); 177 178 /** 179 * Returns the user info.<p> 180 * 181 * @param callback the callback 182 */ 183 void getUserInfo(AsyncCallback<UserInfo> callback); 184 185 /** 186 * Returns a link for the OpenCms workplace that will reload the whole workplace, switch to the explorer view, the 187 * site of the given explorerRootPath and show the folder given in the explorerRootPath.<p> 188 * 189 * @param structureId the structure id of the resource for which to open the workplace 190 * @param callback the callback which receives the result 191 */ 192 void getWorkplaceLink(CmsUUID structureId, AsyncCallback<String> callback); 193 194 /** 195 * Loads the user settings for the current user.<p> 196 * 197 * @param callback the callback to call with the result 198 */ 199 void loadUserSettings(AsyncCallback<CmsUserSettingsBean> callback); 200 201 /** 202 * Locks the given resource with a temporary lock if it exists.<p> 203 * If the resource does not exist yet, the closest existing ancestor folder will check if it is lockable.<p> 204 * 205 * @param sitePath the site path of the resource to lock 206 * @param callback the async callback 207 */ 208 void lockIfExists(String sitePath, AsyncCallback<String> callback); 209 210 /** 211 * Locks the given resource with a temporary lock if it exists.<p> 212 * If the resource does not exist yet, the closest existing ancestor folder will check if it is lockable.<p> 213 * 214 * @param sitePath the site path of the resource to lock 215 * @param loadTime the time when the requested resource was loaded 216 * @param callback the async callback 217 */ 218 void lockIfExists(String sitePath, long loadTime, AsyncCallback<String> callback); 219 220 /** 221 * Locks the given resource with a temporary lock.<p> 222 * 223 * @param structureId the resource structure id 224 * @param callback the async callback 225 */ 226 void lockTemp(CmsUUID structureId, AsyncCallback<String> callback); 227 228 /** 229 * Locks the given resource with a temporary lock.<p> 230 * Locking will fail in case the requested resource has been changed since the given load time.<p> 231 * 232 * @param structureId the resource structure id 233 * @param loadTime the time when the requested resource was loaded 234 * @param callback the async callback 235 */ 236 void lockTemp(CmsUUID structureId, long loadTime, AsyncCallback<String> callback); 237 238 /** 239 * Generates core data for prefetching in the host page.<p> 240 * 241 * @param callback the async callback 242 */ 243 void prefetch(AsyncCallback<CmsCoreData> callback); 244 245 /** 246 * Saves the user settings for the current user.<p> 247 * 248 * @param userSettings the new values for the user settings 249 * @param edited the keys of the user settings which were actually edited 250 * @param resultCallback the callback to call when the operation has finished 251 */ 252 void saveUserSettings(Map<String, String> userSettings, Set<String> edited, AsyncCallback<Void> resultCallback); 253 254 /** 255 * Sets the categories of the given resource. Will remove all other categories.<p> 256 * 257 * @param structureId the resource structure id 258 * @param categories the categories to set 259 * @param callback the callback which receives the result 260 */ 261 void setResourceCategories(CmsUUID structureId, List<String> categories, AsyncCallback<Void> callback); 262 263 /** 264 * Sets the show editor help flag.<p> 265 * 266 * @param showHelp the show help flag 267 * @param callback the asynchronous callback 268 */ 269 void setShowEditorHelp(boolean showHelp, AsyncCallback<Void> callback); 270 271 /** 272 * Writes the tool-bar visibility into the session cache.<p> 273 * 274 * @param visible <code>true</code> if the tool-bar is visible 275 * @param callback the call-back executed on response 276 */ 277 void setToolbarVisible(boolean visible, AsyncCallback<Void> callback); 278 279 /** 280 * Unlocks the given resource.<p> 281 * 282 * @param structureId the resource structure id 283 * @param callback the async callback 284 */ 285 @SynchronizedRpcRequest 286 void unlock(CmsUUID structureId, AsyncCallback<String> callback); 287 288 /** 289 * Unlocks the given resource.<p> 290 * 291 * @param rootPath the resource root path 292 * @param callback the async callback 293 */ 294 @SynchronizedRpcRequest 295 void unlock(String rootPath, AsyncCallback<String> callback); 296 297 /** 298 * Performs a batch of validations and returns the results.<p> 299 * 300 * @param validationQueries a map from field names to validation queries 301 * @param callback the asynchronous callback 302 */ 303 void validate( 304 Map<String, CmsValidationQuery> validationQueries, 305 AsyncCallback<Map<String, CmsValidationResult>> callback); 306 307 /** 308 * Performs a batch of validations using a custom form validator class.<p> 309 * 310 * @param formValidatorClass the class name of the form validator 311 * @param validationQueries a map from field names to validation queries 312 * @param values the map of all field values 313 * @param config the form validator configuration string 314 * @param callback the asynchronous callback 315 */ 316 void validate( 317 String formValidatorClass, 318 Map<String, CmsValidationQuery> validationQueries, 319 Map<String, String> values, 320 String config, 321 AsyncCallback<Map<String, CmsValidationResult>> callback); 322 323}