diff --git a/ccm-auth-http/src/com/arsdigita/auth/http/HTTPAuthServlet.java b/ccm-auth-http/src/com/arsdigita/auth/http/HTTPAuthServlet.java index 0262cc6e9..1f5518a3f 100755 --- a/ccm-auth-http/src/com/arsdigita/auth/http/HTTPAuthServlet.java +++ b/ccm-auth-http/src/com/arsdigita/auth/http/HTTPAuthServlet.java @@ -75,12 +75,12 @@ import sun.misc.BASE64Encoder; *

* *

- * Now on the IIS server export the public key into a separate + * Now on the IIS server exportUsers the public key into a separate * file like this: *

* *
- * keytool -export -alias ccmkey -file c:\temp\public_cert
+ * keytool -exportUsers -alias ccmkey -file c:\temp\public_cert
  * 
* *

diff --git a/ccm-core/src/com/arsdigita/bebop/Page.java b/ccm-core/src/com/arsdigita/bebop/Page.java index eb7e26909..111c67742 100755 --- a/ccm-core/src/com/arsdigita/bebop/Page.java +++ b/ccm-core/src/com/arsdigita/bebop/Page.java @@ -165,38 +165,38 @@ public class Page extends SimpleComponent implements Container { */ private boolean m_finished = false; /** - * indicates whether pageState.stateAsURL() should export the entire state for this page, or - * whether it should only export the control event as a URL and use the HttpSession for the rest + * indicates whether pageState.stateAsURL() should exportUsers the entire state for this page, or + * whether it should only exportUsers the control event as a URL and use the HttpSession for the rest * of the page state. */ private boolean m_useHttpSession = false; /** - * Returns true if this page should export state through the HttpSession instead of + * Returns true if this page should exportUsers state through the HttpSession instead of * the URL query string. *

- * If this returns true, then PageState.stateAsURL() will only export the control + * If this returns true, then PageState.stateAsURL() will only exportUsers the control * event as a URL query string. If this returns false, then stateAsURL() will - * export the entire page state. + * exportUsers the entire page state. * * @see PageState#stateAsURL * - * @return true if this page should export state through the HttpSession; - * false if it should export using the URL query string. + * @return true if this page should exportUsers state through the HttpSession; + * false if it should exportUsers using the URL query string. */ public boolean isUsingHttpSession() { return m_useHttpSession; } /** - * Indicates to this page whether it should export its entire state to subsequent requests + * Indicates to this page whether it should exportUsers its entire state to subsequent requests * through the URL query string, or if it should use the HttpSession instead and only use the * URL query string for the control event. * * @see PageState#stateAsURL * - * @param b true if PageState.stateAsURL() will export only the control event as a - * URL query string. false if stateAsURL() will export the entire page + * @param b true if PageState.stateAsURL() will exportUsers only the control event as a + * URL query string. false if stateAsURL() will exportUsers the entire page * state. */ public void setUsingHttpSession(boolean b) { @@ -585,7 +585,7 @@ public class Page extends SimpleComponent implements Container { * @pre state != null */ public void generateXML(PageState state, Document parent) { - // always export page state as HTTP session + // always exportUsers page state as HTTP session if (m_useHttpSession) { state.stateAsHttpSession(); } diff --git a/ccm-core/src/com/arsdigita/metadata/DynamicObjectType.java b/ccm-core/src/com/arsdigita/metadata/DynamicObjectType.java index 4a078dcee..bdde5aa00 100755 --- a/ccm-core/src/com/arsdigita/metadata/DynamicObjectType.java +++ b/ccm-core/src/com/arsdigita/metadata/DynamicObjectType.java @@ -907,12 +907,12 @@ public class DynamicObjectType extends DynamicElement { * the usage is * * java com.arsdigita.persistence.metadataDyanmicObjectType - * <[import | export]> <DynamicObjectType> <FileLocation> + * <[import | exportUsers]> <DynamicObjectType> <FileLocation> * <StartupScript> <WebAppRoot> * *

*

* - * So, to export the dynamic type MyDynamicType from the database to + * So, to exportUsers the dynamic type MyDynamicType from the database to * the file system, you can type * - * java com.arsdigita.persistence.metadata.DynamicObjectType export + * java com.arsdigita.persistence.metadata.DynamicObjectType exportUsers * com.arsdigita.cms.MyDynamicType /tmp/MyDynamicType.pdl * /home/tomcat/webapps/enterprise/WEB-INF/resources/enterprise.init * /home/tomcat/webapps/enterprise @@ -955,7 +955,7 @@ public class DynamicObjectType extends DynamicElement { */ static public void main(String args[]) { String IMPORT = "import"; - String EXPORT = "export"; + String EXPORT = "exportUsers"; String usageString = "Usage: java DyanmicObjectType " + " <[" + IMPORT + " | " + EXPORT + "]> " + " "; @@ -969,7 +969,7 @@ public class DynamicObjectType extends DynamicElement { if (!(type.equalsIgnoreCase(IMPORT) || type.equalsIgnoreCase(EXPORT))) { System.err.println ("The first argument must specify whether you wish to " + - "'import' or 'export'" + Utilities.LINE_BREAK + usageString); + "'import' or 'exportUsers'" + Utilities.LINE_BREAK + usageString); } String objectType = args[1]; diff --git a/ccm-core/src/com/arsdigita/portation/Marshaller.java b/ccm-core/src/com/arsdigita/portation/Marshaller.java index bdd494df2..8138df940 100644 --- a/ccm-core/src/com/arsdigita/portation/Marshaller.java +++ b/ccm-core/src/com/arsdigita/portation/Marshaller.java @@ -44,11 +44,11 @@ public class Marshaller { /** - * Main export method. Organizes the objects into list of the same type - * and calls a second export method for each list. + * Main exportUsers method. Organizes the objects into list of the same type + * and calls a second exportUsers method for each list. * * @param objects All objects to be exported - * @param format The export style/format e.g. CSV or JSON + * @param format The exportUsers style/format e.g. CSV or JSON * @param filename The name of the file to be exported to */ public void exportObjects(List objects, Format format, @@ -88,15 +88,15 @@ public class Marshaller { /** * Selects the right marshaller for the given type, initializes that - * marshaller for the given export wishes and calls the export method of + * marshaller for the given exportUsers wishes and calls the exportUsers method of * that marshaller upon the given list of same typed objects. * - * Naming convention for the export file name: + * Naming convention for the exportUsers file name: * __. * * @param list List of objects to be exported of the same type * @param type The class of the type - * @param format The export style + * @param format The exportUsers style * @param filename The filename * @param The type of the current marshaller */ diff --git a/ccm-core/src/com/arsdigita/portation/categories/User/User.java b/ccm-core/src/com/arsdigita/portation/categories/User/User.java deleted file mode 100644 index c20baad69..000000000 --- a/ccm-core/src/com/arsdigita/portation/categories/User/User.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (C) 2015 LibreCCM Foundation. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301 USA - */ -package com.arsdigita.portation.categories.User; - -import com.arsdigita.kernel.EmailAddress; -import com.arsdigita.portation.AbstractMarshaller; -import com.arsdigita.portation.Identifiable; -import com.arsdigita.portation.categories.Group.Group; -import org.apache.log4j.Logger; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -/** - * @author convertMailAdresses(Iterator it) { - List mailAdresses = new ArrayList<>(); - if (it != null) { - while (it.hasNext()) { - mailAdresses.add(((EmailAddress) it.next()).getEmailAddress()); - } - } else { - logger.error("A Failed to export, due to empty user list."); - } - return mailAdresses; - } - - @Override - public String getTrunkClass() { - return trunkClass; - } - - @Override - public void setTrunkClass(String trunkClass) { - this.trunkClass = trunkClass; - } - - @Override - public AbstractMarshaller getMarshaller() { - return new UserMarshaller(); - } - - public long getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getPersonName() { - return personName; - } - - public void setPersonName(String personName) { - this.personName = personName; - } - - public String getScreenName() { - return screenName; - } - - public void setScreenName(String screenName) { - this.screenName = screenName; - } - - public String getDisplayName() { - return displayName; - } - - public void setDisplayName(String displayName) { - this.displayName = displayName; - } - - public List getGroups() { - return groups; - } - - public void setGroups(List groups) { - this.groups = groups; - } - - public List getMailAdresses() { - return mailAdresses; - } - - public void setMailAdresses(List mailAdresses) { - this.mailAdresses = mailAdresses; - } -} diff --git a/ccm-core/src/com/arsdigita/portation/categories/core/Group/Group.java b/ccm-core/src/com/arsdigita/portation/categories/core/Group/Group.java new file mode 100644 index 000000000..d1f028be9 --- /dev/null +++ b/ccm-core/src/com/arsdigita/portation/categories/core/Group/Group.java @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2015 LibreCCM Foundation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package com.arsdigita.portation.categories.core.Group; + +import com.arsdigita.portation.AbstractMarshaller; +import com.arsdigita.portation.Identifiable; +import com.arsdigita.portation.categories.core.Party.Party; +import com.arsdigita.portation.categories.core.Utils.CollectionConverter; + +import java.util.List; + +/** + * @author Tobias Osmers<\a> - * @version created the 31.05.16 + * @version created the 01.06.16 */ -public class Group implements Identifiable { - - private String trunkClass; - - public Group(com.arsdigita.kernel.Group sysGroup) { - this.trunkClass = sysGroup.getClass().getName(); - } - - @Override - public String getTrunkClass() { - return trunkClass; - } - - @Override - public void setTrunkClass(String trunkClass) { - this.trunkClass = trunkClass; - } - - @Override - public AbstractMarshaller getMarshaller() { - return null; - } +public class GroupMarshaller extends AbstractMarshaller { } diff --git a/ccm-core/src/com/arsdigita/portation/categories/core/Party/Party.java b/ccm-core/src/com/arsdigita/portation/categories/core/Party/Party.java new file mode 100644 index 000000000..da1f7d879 --- /dev/null +++ b/ccm-core/src/com/arsdigita/portation/categories/core/Party/Party.java @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2015 LibreCCM Foundation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package com.arsdigita.portation.categories.core.Party; + +import com.arsdigita.portation.AbstractMarshaller; +import com.arsdigita.portation.Identifiable; +import com.arsdigita.portation.categories.core.Utils.CollectionConverter; + +import java.util.List; + +/** + * @author Tobias Osmers<\a> + * @version created the 01.06.16 + */ +public class PartyMarshaller extends AbstractMarshaller { +} diff --git a/ccm-core/src/com/arsdigita/portation/categories/core/User/User.java b/ccm-core/src/com/arsdigita/portation/categories/core/User/User.java new file mode 100644 index 000000000..24c469a53 --- /dev/null +++ b/ccm-core/src/com/arsdigita/portation/categories/core/User/User.java @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2015 LibreCCM Foundation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package com.arsdigita.portation.categories.core.User; + +import com.arsdigita.portation.AbstractMarshaller; +import com.arsdigita.portation.Identifiable; +import com.arsdigita.portation.categories.core.Group.Group; +import com.arsdigita.portation.categories.core.Party.Party; +import com.arsdigita.portation.categories.core.Utils.CollectionConverter; + +import java.util.List; + +/** + * @author Tobias Osmers<\a> + * @version created the 01.06.16 + */ +public class CollectionConverter { + private static final Logger logger = Logger.getLogger(CollectionConverter.class); + + public static List convertParties(PartyCollection partyCollection) { + List parties = new ArrayList<>(); + if (partyCollection != null) { + while (partyCollection.next()) { + parties.add(new Party(partyCollection.getParty())); + } + partyCollection.close(); + } else { + logger.error("A Failed to exportUsers, cause party collection is null."); + } + return parties; + } + + public static List convertUsers(UserCollection userCollection) { + List users = new ArrayList<>(); + if (userCollection != null) { + while (userCollection.next()) { + users.add(new User(userCollection.getUser())); + } + userCollection.close(); + } else { + logger.error("A Failed to exportUsers, cause user collection is null."); + } + return users; + } + + public static List convertGroups(GroupCollection groupCollection) { + List groups = new ArrayList<>(); + if (groupCollection != null) { + while (groupCollection.next()) { + groups.add(new Group(groupCollection.getGroup())); + } + groupCollection.close(); + } else { + logger.error("A Failed to exportUsers, cause group collection is null."); + } + return groups; + } + + public static List convertMailAddresses(Iterator it) { + List mailAddresses = new ArrayList<>(); + if (it != null) { + while (it.hasNext()) { + mailAddresses.add(((EmailAddress) it.next()).getEmailAddress()); + } + } else { + logger.error("A Failed to exportUsers, cause mail collection is null."); + } + return mailAddresses; + } +} diff --git a/ccm-core/src/com/arsdigita/portation/cmd/CoreExport.java b/ccm-core/src/com/arsdigita/portation/cmd/CoreExport.java new file mode 100644 index 000000000..fc60b0239 --- /dev/null +++ b/ccm-core/src/com/arsdigita/portation/cmd/CoreExport.java @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2015 LibreCCM Foundation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package com.arsdigita.portation.cmd; + +import com.arsdigita.kernel.GroupCollection; +import com.arsdigita.kernel.PartyCollection; +import com.arsdigita.kernel.UserCollection; +import com.arsdigita.portation.Format; +import com.arsdigita.portation.categories.core.Group.Group; +import com.arsdigita.portation.categories.core.Group.GroupMarshaller; +import com.arsdigita.portation.categories.core.Party.Party; +import com.arsdigita.portation.categories.core.Party.PartyMarshaller; +import com.arsdigita.portation.categories.core.User.User; +import com.arsdigita.portation.categories.core.User.UserMarshaller; +import com.arsdigita.portation.categories.core.Utils.CollectionConverter; +import org.apache.log4j.Logger; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author []\n" + - "\n" + - "Available commands:\n" + - "\tlist \t\t Shows information on how to use this tool.\n" + - "\texport \t\t Exports the chosen category to xml file.\n" + - "\n" + - "Available categories for export:\n" + - " \t\t users \t all users of the system\n" + - " \t\t groups \t all groups of the system\n" + - "Use for exporting java objects of a specified class to a xml-file.\n" - ); - } - private void export(String[] args) { if (args.length < 2) { printUsage(); System.exit(-1); } - final String category = args[1]; + System.out.printf("\nCategory is %s\n", category); - switch (category) { - case "users": - try { - System.out.printf("\nStarting export of users...\n\n"); - UserExport userExport = new UserExport(); - userExport.export(); + try { + switch (category) { + case "parties": + System.out.printf("\nStarting export of all parties...\n\n"); + CoreExport.retrieveParties(); + CoreExport.exportParties(); System.out.printf("\n...done!\n\n"); - } catch (Exception ex) { - logger.error("ERROR", ex); - } - break; - case "groups": - break; - default: - printUsage(); - break; + break; + + case "users": + System.out.printf("\nStarting export of all users...\n\n"); + CoreExport.retrieveUsers(); + CoreExport.exportUsers(); + System.out.printf("\n...done!\n\n"); + break; + + case "groups": + System.out.printf("\nStarting export of all groups...\n\n"); + CoreExport.retrieveGroups(); + CoreExport.exportGroups(); + System.out.printf("\n...done!\n\n"); + break; + + default: + printUsage(); + break; + } + } catch (Exception ex) { + logger.error("ERROR", ex); } } - private void createTestFolder() { - + private void printUsage() { + System.err.printf( + "\t\t\t--- ExportCliTool ---\n" + + "usage:\t []\n" + + "\n" + + "Available commands:\n" + + "\tlist \t\t Shows information on how to use this tool.\n" + + "\texportUsers \t\t Exports the chosen category to xml file.\n" + + "\n" + + "Available categories for exportUsers:\n" + + " \t\t users \t all users of the system\n" + + " \t\t groups \t all groups of the system\n" + + "Use for exporting java objects of a specified class to a xml-file.\n" + ); } } diff --git a/ccm-core/src/com/arsdigita/portation/cmd/UserExport.java b/ccm-core/src/com/arsdigita/portation/cmd/UserExport.java deleted file mode 100644 index f223ce8b3..000000000 --- a/ccm-core/src/com/arsdigita/portation/cmd/UserExport.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2015 LibreCCM Foundation. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301 USA - */ -package com.arsdigita.portation.cmd; - -import com.arsdigita.portation.categories.User.User; -import com.arsdigita.kernel.UserCollection; -import com.arsdigita.portation.Format; -import com.arsdigita.portation.categories.User.UserMarshaller; -import org.apache.log4j.Logger; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -/** - * @author System.out.println(l.toString())); - Arrays.stream(com.arsdigita.kernel.User.class.getFields()).forEach(l -> System.out.println(l.toString())); - } - - public void export() { - UserMarshaller userMarshaller = new UserMarshaller(); - userMarshaller.prepare(Format.XML, "PortationTestFiles", "test1", true); - userMarshaller.exportList(users); - } -} diff --git a/ccm-core/src/com/arsdigita/ui/login/UserEditForm.java b/ccm-core/src/com/arsdigita/ui/login/UserEditForm.java index acb1f7f80..3f6fdce7e 100755 --- a/ccm-core/src/com/arsdigita/ui/login/UserEditForm.java +++ b/ccm-core/src/com/arsdigita/ui/login/UserEditForm.java @@ -77,7 +77,7 @@ public class UserEditForm extends UserForm addProcessListener(this); - // export return URL + // exportUsers return URL m_returnURL = new Hidden(new URLParameter (LoginHelper.RETURN_URL_PARAM_NAME)); m_returnURL.setPassIn(true); diff --git a/ccm-core/src/com/arsdigita/util/ServletUtils.java b/ccm-core/src/com/arsdigita/util/ServletUtils.java index 4cdadcadf..181b00384 100755 --- a/ccm-core/src/com/arsdigita/util/ServletUtils.java +++ b/ccm-core/src/com/arsdigita/util/ServletUtils.java @@ -44,8 +44,8 @@ public class ServletUtils { * "one"=1, "two"=2, and "three"=3, then exportURLVars(req, "one two") * will return "one=1&two=2". * @param req the HttpServletRequest - * @param vars a space-separated list of variables to export. If vars - * is null, export all available. + * @param vars a space-separated list of variables to exportUsers. If vars + * is null, exportUsers all available. */ public static final String exportURLVars(HttpServletRequest req, String vars) { diff --git a/ccm-core/test/src/com/arsdigita/bebop/SessionStateTest.java b/ccm-core/test/src/com/arsdigita/bebop/SessionStateTest.java index ac86132c3..415c17aa7 100755 --- a/ccm-core/test/src/com/arsdigita/bebop/SessionStateTest.java +++ b/ccm-core/test/src/com/arsdigita/bebop/SessionStateTest.java @@ -91,7 +91,7 @@ public class SessionStateTest extends TestCase { *

* then follows a control link which changes state on component 1. * verifies that new page has right state, and that control links - * don't export state directly. + * don't exportUsers state directly. *

* follows the second control link. verifies that the state on * component 1 is preserved, after already checking that the state diff --git a/ccm-ldn-aplaws/web/themes/mandalay/user/includes/types/SciPublications/common.xsl b/ccm-ldn-aplaws/web/themes/mandalay/user/includes/types/SciPublications/common.xsl index a0639f1ec..c3ccf1c6f 100644 --- a/ccm-ldn-aplaws/web/themes/mandalay/user/includes/types/SciPublications/common.xsl +++ b/ccm-ldn-aplaws/web/themes/mandalay/user/includes/types/SciPublications/common.xsl @@ -846,7 +846,7 @@