You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2005/01/20 16:23:36 UTC

svn commit: r125781 - /lenya/trunk/src/java/org/apache/lenya/cms/ant/RenameLabelTask.java /lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/ChangeLabel.java

Author: andreas
Date: Thu Jan 20 07:23:35 2005
New Revision: 125781

URL: http://svn.apache.org/viewcvs?view=rev&rev=125781
Log:
usecase framework used to change navigation title
Added:
   lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/ChangeLabel.java
Removed:
   lenya/trunk/src/java/org/apache/lenya/cms/ant/RenameLabelTask.java

Deleted: /lenya/trunk/src/java/org/apache/lenya/cms/ant/RenameLabelTask.java
Url: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/ant/RenameLabelTask.java?view=auto&rev=125780
==============================================================================

Added: lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/ChangeLabel.java
Url: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/ChangeLabel.java?view=auto&rev=125781
==============================================================================
--- (empty file)
+++ lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/ChangeLabel.java	Thu Jan 20 07:23:35 2005
@@ -0,0 +1,62 @@
+/*
+ * Copyright  1999-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache 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.apache.org/licenses/LICENSE-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.apache.lenya.cms.site.usecases;
+
+import org.apache.lenya.cms.publication.Document;
+import org.apache.lenya.cms.site.SiteException;
+import org.apache.lenya.cms.site.SiteManager;
+import org.apache.lenya.cms.usecase.DocumentUsecase;
+
+/**
+ * Change the label of a document.
+ * 
+ * @version $Id:$
+ */
+public class ChangeLabel extends DocumentUsecase {
+
+    protected static final String LABEL = "label";
+    protected static final String DOCUMENT_ID = "documentId";
+
+    /**
+     * @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters()
+     */
+    protected void initParameters() {
+        super.initParameters();
+        Document document = getSourceDocument();
+        setParameter(DOCUMENT_ID, document.getId());
+        try {
+            SiteManager manager = document.getPublication().getSiteManager(document
+                    .getIdentityMap());
+            setParameter(LABEL, manager.getLabel(document));
+        } catch (SiteException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    /**
+     * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
+     */
+    protected void doExecute() throws Exception {
+        super.doExecute();
+
+        Document document = getSourceDocument();
+        SiteManager manager = document.getPublication().getSiteManager(document.getIdentityMap());
+
+        String label = getParameterAsString(LABEL);
+        manager.setLabel(document, label);
+    }
+}
\ No newline at end of file

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org