KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > magnolia > module > admininterface > commands > DeactivationCommand


1 /**
2  *
3  * Magnolia and its source-code is licensed under the LGPL.
4  * You may copy, adapt, and redistribute this file for commercial or non-commercial use.
5  * When copying, adapting, or redistributing this document in keeping with the guidelines above,
6  * you are required to provide proper attribution to obinary.
7  * If you reproduce or distribute the document without making any substantive modifications to its content,
8  * please use the following attribution line:
9  *
10  * Copyright 2006 obinary Ltd. (http://www.obinary.com) All rights reserved.
11  *
12  */

13 package info.magnolia.module.admininterface.commands;
14
15 import info.magnolia.cms.beans.config.ContentRepository;
16 import info.magnolia.cms.exchange.Syndicator;
17 import info.magnolia.cms.i18n.MessagesManager;
18 import info.magnolia.cms.util.AlertUtil;
19 import info.magnolia.cms.util.FactoryUtil;
20 import info.magnolia.cms.util.Rule;
21 import info.magnolia.context.Context;
22
23 import org.slf4j.Logger;
24 import org.slf4j.LoggerFactory;
25
26
27 /**
28  * the deactivation command which do real deactivation
29  * @author jackie
30  */

31 public class DeactivationCommand extends BaseRepositoryCommand {
32
33     private static Logger log = LoggerFactory.getLogger(DeactivationCommand.class);
34
35     public boolean execute(Context ctx) throws Exception JavaDoc {
36         try{
37             Syndicator syndicator = (Syndicator) FactoryUtil.newInstance(Syndicator.class);
38             syndicator.init(ctx.getUser(), this.getRepository(), ContentRepository.getDefaultWorkspace(this.getRepository()), new Rule());
39             syndicator.deActivate(getPath());
40         }
41         catch(Exception JavaDoc e){
42             AlertUtil.setException(MessagesManager.get("tree.error.deactivate"), e, ctx);
43             return false;
44         }
45         return true;
46     }
47
48 }
49
Popular Tags