added:
[mir.git] / source / mircoders / localizer / MirAdminInterfaceLocalizer.java
index 3585935..0377c70 100755 (executable)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with  any library licensed under the Apache Software License, 
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library 
- * (or with modified versions of the above that use the same license as the above), 
- * and distribute linked combinations including the two.  You must obey the 
- * GNU General Public License in all respects for all of the code used other than 
- * the above mentioned libraries.  If you modify this file, you may extend this 
- * exception to your version of the file, but you are not obligated to do so.  
+ * the code of this program with  any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two.  You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries.  If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
  * If you do not wish to do so, delete this exception statement from your version.
  */
 package mircoders.localizer;
@@ -33,12 +33,12 @@ import java.util.List;
 import java.util.Map;
 
 import mir.entity.adapter.EntityAdapter;
+import mir.generator.Generator;
 
 /**
+ * Interface to allow for localized changed to the workings of the admin system
  *
- * <p>Title: Interface to allow for localized changed to the workings of the admin system</p>
  * @author Zapata
- * @version 1.0
  */
 
 public interface MirAdminInterfaceLocalizer {
@@ -62,27 +62,58 @@ public interface MirAdminInterfaceLocalizer {
    */
   public String makePasswordDigest(String aPassword);
 
-
   /**
+   * Allows different "generators" (templates) to be used for certain pages
    *
+   * @param aPage The identifier of the page
+   * @param aUser the user (can be used to allow different users to see different pages
+   * @param aDefault The default generator
    * @return
    */
-  public List simpleCommentOperations();
+  public String getAdminPageGenerator(String aPage, Map aTemplateData, EntityAdapter aUser, String aDefault) throws MirLocalizerExc;
 
   /**
+   * Prepares an article preview
    *
-   * @param aName
-   * @return
+   * @param aPreviewPage there may be different preview pages for a single article.
+   *     (i.e. the same article may lead to different pages) this parameter selects one
+   *      of those versions. See also {@link #getPreviewPages}.
+   * @param anArticle the article to be previewed
+   * @param aContext the context to be supplied to the generator
+   * @return the generator to be used to generate the preview
    */
-  public MirSimpleEntityOperation simpleCommentOperationForName(String aName);
+  public Generator prepareArticlePreview(String aPreviewPage, EntityAdapter anArticle, Map aContext)
+      throws MirLocalizerExc, MirLocalizerFailure;
 
+  /**
+   * Return the available preview variations of one article
+   */
+  public List getPreviewPages(EntityAdapter anArticle) throws MirLocalizerExc, MirLocalizerFailure;
 
+  /**
+   * Get the {@link List} of {@link EntityOperation}s available for comments
+   */
+  public List simpleCommentOperations();
+
+  /**
+   * Get the {@link List} of {@link EntityOperation}s available for articles
+   */
   public List simpleArticleOperations();
-  public MirSimpleEntityOperation simpleArticleOperationForName(String aName);
 
-  public interface MirSimpleEntityOperation {
+  public interface EntityOperation {
+    /**
+     * Returns the name of the operation. Must be unique and immutable.
+     */
     public String getName();
-    public boolean isAvailable(EntityAdapter anEntity);
-    public void perform(EntityAdapter aUser, EntityAdapter anEntity);
+
+    /**
+     * Is the operation valid for the given {@link EntityAdapter}
+     */
+    public boolean isAvailable(EntityAdapter anEntity) throws MirLocalizerExc, MirLocalizerFailure;
+
+    /**
+     * perform the operation on the given {@link EntityAdapter} as the given user
+     */ 
+    public void perform(EntityAdapter aUser, EntityAdapter anEntity) throws MirLocalizerExc, MirLocalizerFailure;
   }
 }
\ No newline at end of file