|
What this is
Other links
The source code/* * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/admin/importexport/jive/JiveGroupXML.java,v 1.3 2005/01/18 11:52:14 minhnn Exp $ * $Author: minhnn $ * $Revision: 1.3 $ * $Date: 2005/01/18 11:52:14 $ * * ==================================================================== * * Copyright (C) 2002-2005 by MyVietnam.net * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or any later version. * * All copyright notices regarding mvnForum MUST remain intact * in the scripts and in the outputted HTML. * The "powered by" text/logo with a link back to * http://www.mvnForum.com and http://www.MyVietnam.net in the * footer of the pages MUST remain visible when the pages * are viewed on the internet or intranet. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * Support can be obtained from support forums at: * http://www.mvnForum.com/mvnforum/index * * Correspondence and Marketing Questions can be sent to: * info@MyVietnam.net * * @author: Igor Manic imanic@users.sourceforge.net */ package com.mvnforum.admin.importexport.jive; import com.mvnforum.admin.GroupXML; import net.myvietnam.mvncore.exception.*; /** * @author <a href="mailto:imanic@users.sourceforge.net">Igor Manic * @version $Revision: 1.3 $, $Date: 2005/01/18 11:52:14 $ * <br/> * <code>JiveGroupXML class encapsulates processing of * groups' definitions found in the Jive XML file. It implements * methods to be called from XML parsing routine, adds some additional * processing and checking, and calls corresponding methods of * <code>GroupXML and other neccessary classes in order to perform * the actual creation of a group, as well as assigning members to the group. */ public class JiveGroupXML { private GroupXML groupXML=null; private boolean groupCreated=false; public JiveGroupXML() { super(); groupXML=new GroupXML(); groupCreated=false; } public void setGroupID(String id) { groupXML.setGroupID(id); } /** * This method simply calls <code>setGroupID(). * It's defined only to avoid property-setter problems with digester * (since it doesn't seem to recognize <code>setGroupID() as a setter * method for <code>groupID property). */ public void setGroupId(String id) { setGroupID(id); } private String groupName=null; public void setGroupName(String value) throws CreateException { if ( (value==null) || (value.equals("")) ) { throw new CreateException("Cannot create a group with an empty GroupName."); } else this.groupName=value; } private String groupDesc=null; public void setGroupDescription(String value) throws CreateException { this.groupDesc=value; } private String groupCreationDate=null; public void setGroupCreationDate(String value) throws CreateException { this.groupCreationDate=value; } private String groupModifiedDate=null; public void setGroupModifiedDate(String value) throws CreateException { this.groupModifiedDate=value; } private String groupOwnerName=null; public void setGroupOwnerName(String value) throws CreateException { this.groupOwnerName=value; } public void addJiveGroup() throws CreateException, DuplicateKeyException, ObjectNotFoundException, DatabaseException, ForeignKeyNotFoundException { /* First check if the digester already called this method. * It will happen even under normal circumstances, if this group has * subelements that need it already be defined, so they first call * this method to create group before creating data that refer him. */ if (groupCreated) return; if ( (groupName==null) || (groupName.equals("")) ) { throw new CreateException("Cannot create a group with an empty GroupName."); } else { ImportJive.addMessage("Adding Jive group \""+groupName+"\"."); groupXML.addGroup(groupOwnerName, groupName, groupDesc, null/*groupOption*/, groupCreationDate, groupModifiedDate); groupCreated=true; } } public void addJiveGroupMember(String username) throws CreateException, DuplicateKeyException, ObjectNotFoundException, DatabaseException, ForeignKeyNotFoundException { if ( (!groupCreated) || (groupXML.getGroupID()<0) ) { addJiveGroup(); } if ( (username==null) || (username.equals("")) ) { throw new CreateException("Cannot create a group member with an empty MemberName."); } else { ImportJive.addMessage("Adding group member \""+username+"\"."); groupXML.addMemberGroup(username, null/*privilege*/, null/*creationDate*/, null/*modifiedDate*/); } } } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.