restructures the portation package and adds export funktionalities for parties, users and groups
git-svn-id: https://svn.libreccm.org/ccm/trunk@4129 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
7a22894ce7
commit
f989a1306b
|
|
@ -75,12 +75,12 @@ import sun.misc.BASE64Encoder;
|
|||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* 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:
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* keytool -export -alias ccmkey -file c:\temp\public_cert
|
||||
* keytool -exportUsers -alias ccmkey -file c:\temp\public_cert
|
||||
* </pre>
|
||||
*
|
||||
* <p>
|
||||
|
|
|
|||
|
|
@ -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 <code>true</code> if this page should export state through the HttpSession instead of
|
||||
* Returns <code>true</code> if this page should exportUsers state through the HttpSession instead of
|
||||
* the URL query string.
|
||||
* <P>
|
||||
* If this returns <code>true</code>, then PageState.stateAsURL() will only export the control
|
||||
* If this returns <code>true</code>, then PageState.stateAsURL() will only exportUsers the control
|
||||
* event as a URL query string. If this returns <code>false</code>, then stateAsURL() will
|
||||
* export the entire page state.
|
||||
* exportUsers the entire page state.
|
||||
*
|
||||
* @see PageState#stateAsURL
|
||||
*
|
||||
* @return <code>true</code> if this page should export state through the HttpSession;
|
||||
* <code>false</code> if it should export using the URL query string.
|
||||
* @return <code>true</code> if this page should exportUsers state through the HttpSession;
|
||||
* <code>false</code> 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 <code>true</code> if PageState.stateAsURL() will export only the control event as a
|
||||
* URL query string. <code>false</code> if stateAsURL() will export the entire page
|
||||
* @param b <code>true</code> if PageState.stateAsURL() will exportUsers only the control event as a
|
||||
* URL query string. <code>false</code> 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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -907,12 +907,12 @@ public class DynamicObjectType extends DynamicElement {
|
|||
* the usage is
|
||||
* <code>
|
||||
* java com.arsdigita.persistence.metadataDyanmicObjectType
|
||||
* <[import | export]> <DynamicObjectType> <FileLocation>
|
||||
* <[import | exportUsers]> <DynamicObjectType> <FileLocation>
|
||||
* <StartupScript> <WebAppRoot>
|
||||
* </code>
|
||||
* <p>
|
||||
* <ul>
|
||||
* <li>The first item, "import" or "export" tells the method whether
|
||||
* <li>The first item, "import" or "exportUsers" tells the method whether
|
||||
* you are loading a file into the database or you want to print
|
||||
* a file in the database into the file system.</li>
|
||||
*
|
||||
|
|
@ -940,10 +940,10 @@ public class DynamicObjectType extends DynamicElement {
|
|||
* </li>
|
||||
* </ul>
|
||||
*
|
||||
* 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
|
||||
* <code>
|
||||
* 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 + "]> <DynamicObjectType> " +
|
||||
"<FileLocation> <StartupScript> <WebAppRoot>";
|
||||
|
|
@ -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];
|
||||
|
|
|
|||
|
|
@ -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<? extends Identifiable> 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:
|
||||
* <basic file name>__<type/class name>.<format>
|
||||
*
|
||||
* @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 <I> The type of the current marshaller
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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 <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||
* @version created the 31.05.16
|
||||
*/
|
||||
public class User implements Identifiable {
|
||||
private static final Logger logger = Logger.getLogger(User.class);
|
||||
|
||||
private String trunkClass;
|
||||
private long id;
|
||||
private String name;
|
||||
private String personName;
|
||||
private String screenName;
|
||||
private String displayName;
|
||||
private List<Group> groups;
|
||||
private String primaryMailAdress;
|
||||
private List<String> mailAdresses;
|
||||
|
||||
public User(com.arsdigita.kernel.User sysUser) {
|
||||
this.trunkClass = sysUser.getClass().getName();
|
||||
|
||||
this.id = sysUser.getID().longValue();
|
||||
this.name = sysUser.getName();
|
||||
this.personName = sysUser.getPersonName().toString();
|
||||
this.screenName = sysUser.getScreenName();
|
||||
this.displayName = sysUser.getDisplayName();
|
||||
this.groups = convertGroups(sysUser.getGroups());
|
||||
this.primaryMailAdress = sysUser.getPrimaryEmail().getEmailAddress();
|
||||
this.mailAdresses = convertMailAdresses(sysUser.getAlternateEmails());
|
||||
}
|
||||
|
||||
private List<Group> convertGroups(com.arsdigita.kernel.GroupCollection groupCollection) {
|
||||
List<Group> groups = new ArrayList<>();
|
||||
if (groupCollection != null) {
|
||||
while (groupCollection.next()) {
|
||||
groups.add(new Group(groupCollection.getGroup()));
|
||||
}
|
||||
groupCollection.close();
|
||||
} else {
|
||||
logger.error("A Failed to export, due to empty user list.");
|
||||
}
|
||||
return groups;
|
||||
}
|
||||
|
||||
private List<String> convertMailAdresses(Iterator it) {
|
||||
List<String> 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<? extends Identifiable> 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<Group> getGroups() {
|
||||
return groups;
|
||||
}
|
||||
|
||||
public void setGroups(List<Group> groups) {
|
||||
this.groups = groups;
|
||||
}
|
||||
|
||||
public List<String> getMailAdresses() {
|
||||
return mailAdresses;
|
||||
}
|
||||
|
||||
public void setMailAdresses(List<String> mailAdresses) {
|
||||
this.mailAdresses = mailAdresses;
|
||||
}
|
||||
}
|
||||
|
|
@ -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 <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||
* @version created the 31.05.16
|
||||
*/
|
||||
public class Group extends Party {
|
||||
|
||||
private List<Party> members;
|
||||
private List<Group> subGroups;
|
||||
|
||||
public Group(com.arsdigita.kernel.Group sysGroup) {
|
||||
super(sysGroup);
|
||||
|
||||
this.members = CollectionConverter.convertParties(sysGroup.getMembers());
|
||||
this.subGroups = CollectionConverter.convertGroups(sysGroup.getSubgroups());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractMarshaller<? extends Identifiable> getMarshaller() {
|
||||
return new GroupMarshaller();
|
||||
}
|
||||
|
||||
public List<Party> getMembers() {
|
||||
return members;
|
||||
}
|
||||
|
||||
public void setMembers(List<Party> members) {
|
||||
this.members = members;
|
||||
}
|
||||
|
||||
public List<Group> getSubGroups() {
|
||||
return subGroups;
|
||||
}
|
||||
|
||||
public void setSubGroups(List<Group> subGroups) {
|
||||
this.subGroups = subGroups;
|
||||
}
|
||||
}
|
||||
|
|
@ -16,35 +16,13 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package com.arsdigita.portation.categories.Group;
|
||||
package com.arsdigita.portation.categories.core.Group;
|
||||
|
||||
import com.arsdigita.portation.AbstractMarshaller;
|
||||
import com.arsdigita.portation.Identifiable;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:tosmers@uni-bremen.de>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<? extends Identifiable> getMarshaller() {
|
||||
return null;
|
||||
}
|
||||
public class GroupMarshaller extends AbstractMarshaller<Group> {
|
||||
}
|
||||
|
|
@ -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 <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||
* @version created the 01.06.16
|
||||
*/
|
||||
public class Party implements Identifiable {
|
||||
|
||||
private String trunkClass;
|
||||
|
||||
private long id;
|
||||
private String name;
|
||||
private String displayName;
|
||||
private String primaryMailAddress;
|
||||
private List<String> mailAddresses;
|
||||
|
||||
public Party(com.arsdigita.kernel.Party sysParty) {
|
||||
this.trunkClass = sysParty.getClass().getName();
|
||||
|
||||
this.id = sysParty.getID().longValue();
|
||||
this.name = sysParty.getName();
|
||||
this.displayName = sysParty.getDisplayName();
|
||||
if (sysParty.getPrimaryEmail() != null)
|
||||
this.primaryMailAddress = sysParty.getPrimaryEmail().getEmailAddress();
|
||||
this.mailAddresses = CollectionConverter.convertMailAddresses(sysParty.getAlternateEmails());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTrunkClass() {
|
||||
return trunkClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTrunkClass(String trunkClass) {
|
||||
this.trunkClass = trunkClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractMarshaller<? extends Identifiable> getMarshaller() {
|
||||
return new PartyMarshaller();
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
public void setDisplayName(String displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
public String getPrimaryMailAddress() {
|
||||
return primaryMailAddress;
|
||||
}
|
||||
|
||||
public void setPrimaryMailAddress(String primaryMailAddress) {
|
||||
this.primaryMailAddress = primaryMailAddress;
|
||||
}
|
||||
|
||||
public List<String> getMailAddresses() {
|
||||
return mailAddresses;
|
||||
}
|
||||
|
||||
public void setMailAddresses(List<String> mailAddresses) {
|
||||
this.mailAddresses = mailAddresses;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||
* @version created the 01.06.16
|
||||
*/
|
||||
public class PartyMarshaller extends AbstractMarshaller<Party> {
|
||||
}
|
||||
|
|
@ -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 <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||
* @version created the 31.05.16
|
||||
*/
|
||||
public class User extends Party implements Identifiable {
|
||||
|
||||
private String personName;
|
||||
private String screenName;
|
||||
private List<Group> groups;
|
||||
|
||||
public User(com.arsdigita.kernel.User sysUser) {
|
||||
super(sysUser);
|
||||
|
||||
this.personName = sysUser.getPersonName().toString();
|
||||
this.screenName = sysUser.getScreenName();
|
||||
this.groups = CollectionConverter.convertGroups(sysUser.getGroups());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractMarshaller<? extends Identifiable> getMarshaller() {
|
||||
return new UserMarshaller();
|
||||
}
|
||||
|
||||
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 List<Group> getGroups() {
|
||||
return groups;
|
||||
}
|
||||
|
||||
public void setGroups(List<Group> groups) {
|
||||
this.groups = groups;
|
||||
}
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package com.arsdigita.portation.categories.User;
|
||||
package com.arsdigita.portation.categories.core.User;
|
||||
|
||||
import com.arsdigita.portation.AbstractMarshaller;
|
||||
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* 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.Utils;
|
||||
|
||||
import com.arsdigita.kernel.EmailAddress;
|
||||
import com.arsdigita.kernel.GroupCollection;
|
||||
import com.arsdigita.kernel.PartyCollection;
|
||||
import com.arsdigita.kernel.UserCollection;
|
||||
import com.arsdigita.portation.categories.core.Group.Group;
|
||||
import com.arsdigita.portation.categories.core.Party.Party;
|
||||
import com.arsdigita.portation.categories.core.User.User;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||
* @version created the 01.06.16
|
||||
*/
|
||||
public class CollectionConverter {
|
||||
private static final Logger logger = Logger.getLogger(CollectionConverter.class);
|
||||
|
||||
public static List<Party> convertParties(PartyCollection partyCollection) {
|
||||
List<Party> 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<User> convertUsers(UserCollection userCollection) {
|
||||
List<User> 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<Group> convertGroups(GroupCollection groupCollection) {
|
||||
List<Group> 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<String> convertMailAddresses(Iterator it) {
|
||||
List<String> 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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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 <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||
* @version created the 25.05.16
|
||||
*/
|
||||
class CoreExport {
|
||||
private final static Logger logger = Logger.getLogger(CoreExport.class);
|
||||
|
||||
private static List<Party> parties = new ArrayList<>();
|
||||
private static List<User> users = new ArrayList<>();
|
||||
private static List<Group> groups = new ArrayList<>();
|
||||
|
||||
static void retrieveParties() {
|
||||
System.out.println("\n...0...\n");
|
||||
parties = CollectionConverter.convertParties(com.arsdigita.kernel.Party.retrieveAllParties());
|
||||
}
|
||||
static void exportParties() {
|
||||
PartyMarshaller partyMarshaller = new PartyMarshaller();
|
||||
partyMarshaller.prepare(Format.XML, "PortationTestFiles", "partyExport_test01", true);
|
||||
partyMarshaller.exportList(parties);
|
||||
}
|
||||
|
||||
static void retrieveUsers() {
|
||||
System.out.println("\n...1...\n");
|
||||
users = CollectionConverter.convertUsers(com.arsdigita.kernel.User.retrieveAll());
|
||||
}
|
||||
static void exportUsers() {
|
||||
UserMarshaller userMarshaller = new UserMarshaller();
|
||||
userMarshaller.prepare(Format.XML, "PortationTestFiles", "userExport_test01", true);
|
||||
userMarshaller.exportList(users);
|
||||
}
|
||||
|
||||
static void retrieveGroups() {
|
||||
System.out.println("\n...2...\n");
|
||||
groups = CollectionConverter.convertGroups(com.arsdigita.kernel.Group.retrieveAll());
|
||||
}
|
||||
static void exportGroups() {
|
||||
GroupMarshaller groupMarshaller = new GroupMarshaller();
|
||||
groupMarshaller.prepare(Format.XML, "PortationTestFiles", "groupExport_test01", true);
|
||||
groupMarshaller.exportList(groups);
|
||||
}
|
||||
}
|
||||
|
|
@ -23,7 +23,7 @@ import org.apache.commons.cli.CommandLine;
|
|||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Commandline tool to export all the objects of a specified class to a xml-file.
|
||||
* Commandline tool to exportUsers all the objects of a specified class to a xml-file.
|
||||
*
|
||||
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||
* @version created the 25.05.16
|
||||
|
|
@ -50,16 +50,14 @@ public class ExportCliTool extends Program {
|
|||
printUsage();
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
final String command = args[0];
|
||||
System.out.printf("Command ist %s\n", command);
|
||||
System.out.printf("\nCommand is %s\n", command);
|
||||
|
||||
switch (command) {
|
||||
case "help":
|
||||
printUsage();
|
||||
break;
|
||||
case "export":
|
||||
createTestFolder();
|
||||
export(args);
|
||||
break;
|
||||
default:
|
||||
|
|
@ -68,50 +66,59 @@ public class ExportCliTool extends Program {
|
|||
}
|
||||
}
|
||||
|
||||
private void printUsage() {
|
||||
System.err.printf(
|
||||
"\t\t\t--- ExportCliTool ---\n" +
|
||||
"usage:\t<command> [<category>]\n" +
|
||||
"\n" +
|
||||
"Available commands:\n" +
|
||||
"\tlist \t\t Shows information on how to use this tool.\n" +
|
||||
"\texport <category> \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<command> [<category>]\n" +
|
||||
"\n" +
|
||||
"Available commands:\n" +
|
||||
"\tlist \t\t Shows information on how to use this tool.\n" +
|
||||
"\texportUsers <category> \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"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||
* @version created the 25.05.16
|
||||
*/
|
||||
class UserExport {
|
||||
private final static Logger logger = Logger.getLogger(UserExport.class);
|
||||
|
||||
private final UserCollection userCollection = com.arsdigita.kernel.User.retrieveAll();
|
||||
private List<User> users = new ArrayList<>();
|
||||
|
||||
UserExport() {
|
||||
prepare();
|
||||
}
|
||||
|
||||
private void prepare() {
|
||||
if (userCollection != null) {
|
||||
while (userCollection.next()) {
|
||||
users.add(new User(userCollection.getUser()));
|
||||
}
|
||||
userCollection.close();
|
||||
} else {
|
||||
logger.error("A Failed to export, due to empty user list.");
|
||||
}
|
||||
|
||||
Arrays.stream(com.arsdigita.kernel.User.class.getDeclaredFields()).forEach(l -> 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);
|
||||
}
|
||||
}
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ public class SessionStateTest extends TestCase {
|
|||
* <p>
|
||||
* 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.
|
||||
* <p>
|
||||
* follows the second control link. verifies that the state on
|
||||
* component 1 is preserved, after already checking that the state
|
||||
|
|
|
|||
|
|
@ -846,7 +846,7 @@
|
|||
<ul class="publicationDownloads">
|
||||
<li>
|
||||
<a>
|
||||
<xsl:attribute name="href">/ccm/scipublications/export/?format=bibtex&publication=<xsl:value-of select="./masterVersion/id"/></xsl:attribute>
|
||||
<xsl:attribute name="href">/ccm/scipublications/exportUsers/?format=bibtex&publication=<xsl:value-of select="./masterVersion/id"/></xsl:attribute>
|
||||
<xsl:attribute name="title">
|
||||
<xsl:call-template name="mandalay:getStaticText">
|
||||
<xsl:with-param name="module" select="'SciPublications'"/>
|
||||
|
|
@ -861,7 +861,7 @@
|
|||
</li>
|
||||
<li>
|
||||
<a>
|
||||
<xsl:attribute name="href">/ccm/scipublications/export/?format=ris&publication=<xsl:value-of select="./masterVersion/id"/></xsl:attribute>
|
||||
<xsl:attribute name="href">/ccm/scipublications/exportUsers/?format=ris&publication=<xsl:value-of select="./masterVersion/id"/></xsl:attribute>
|
||||
<xsl:attribute name="title">
|
||||
<xsl:call-template name="mandalay:getStaticText">
|
||||
<xsl:with-param name="module" select="'SciPublications'"/>
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
along with Mandalay. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<!-- Generation of the export links for publications -->
|
||||
<!-- Generation of the exportUsers links for publications -->
|
||||
|
||||
<xsl:stylesheet
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public class CategoryExportTool extends Program {
|
|||
public CategoryExportTool() {
|
||||
super("Category Export Tool",
|
||||
"1.0.1",
|
||||
"[app URL] [context] [export dir] [key] [url] [title] [version]");
|
||||
"[app URL] [context] [exportUsers dir] [key] [url] [title] [version]");
|
||||
getOptions().addOption
|
||||
(OptionBuilder
|
||||
.hasArg(false)
|
||||
|
|
|
|||
|
|
@ -807,7 +807,7 @@
|
|||
<ul class="publicationDownloads">
|
||||
<li>
|
||||
<a>
|
||||
<xsl:attribute name="href">/ccm/scipublications/export/?format=bibtex&publication=<xsl:value-of select="./masterVersion/id"/></xsl:attribute>
|
||||
<xsl:attribute name="href">/ccm/scipublications/exportUsers/?format=bibtex&publication=<xsl:value-of select="./masterVersion/id"/></xsl:attribute>
|
||||
<xsl:attribute name="title">
|
||||
<xsl:call-template name="mandalay:getStaticText">
|
||||
<xsl:with-param name="module" select="'SciPublications'"/>
|
||||
|
|
@ -822,7 +822,7 @@
|
|||
</li>
|
||||
<li>
|
||||
<a>
|
||||
<xsl:attribute name="href">/ccm/scipublications/export/?format=ris&publication=<xsl:value-of select="./masterVersion/id"/></xsl:attribute>
|
||||
<xsl:attribute name="href">/ccm/scipublications/exportUsers/?format=ris&publication=<xsl:value-of select="./masterVersion/id"/></xsl:attribute>
|
||||
<xsl:attribute name="title">
|
||||
<xsl:call-template name="mandalay:getStaticText">
|
||||
<xsl:with-param name="module" select="'SciPublications'"/>
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
along with Mandalay. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<!-- Generation of the export links for publications -->
|
||||
<!-- Generation of the exportUsers links for publications -->
|
||||
|
||||
<xsl:stylesheet
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
|
|
|
|||
|
|
@ -846,7 +846,7 @@
|
|||
<ul class="publicationDownloads">
|
||||
<li>
|
||||
<a>
|
||||
<xsl:attribute name="href">/ccm/scipublications/export/?format=bibtex&publication=<xsl:value-of select="./masterVersion/id"/></xsl:attribute>
|
||||
<xsl:attribute name="href">/ccm/scipublications/exportUsers/?format=bibtex&publication=<xsl:value-of select="./masterVersion/id"/></xsl:attribute>
|
||||
<xsl:attribute name="title">
|
||||
<xsl:call-template name="mandalay:getStaticText">
|
||||
<xsl:with-param name="module" select="'SciPublications'"/>
|
||||
|
|
@ -861,7 +861,7 @@
|
|||
</li>
|
||||
<li>
|
||||
<a>
|
||||
<xsl:attribute name="href">/ccm/scipublications/export/?format=ris&publication=<xsl:value-of select="./masterVersion/id"/></xsl:attribute>
|
||||
<xsl:attribute name="href">/ccm/scipublications/exportUsers/?format=ris&publication=<xsl:value-of select="./masterVersion/id"/></xsl:attribute>
|
||||
<xsl:attribute name="title">
|
||||
<xsl:call-template name="mandalay:getStaticText">
|
||||
<xsl:with-param name="module" select="'SciPublications'"/>
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
along with Mandalay. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<!-- Generation of the export links for publications -->
|
||||
<!-- Generation of the exportUsers links for publications -->
|
||||
|
||||
<xsl:stylesheet
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
|
|
|
|||
|
|
@ -125,10 +125,10 @@ class Exporter {
|
|||
//Get the exporter for the specified format.
|
||||
exporter = SciPublicationsExporters.getInstance().getExporterForFormat(format);
|
||||
if (exporter == null) {
|
||||
LOGGER.warn(String.format("The requested export format '%s' is not supported yet.",
|
||||
LOGGER.warn(String.format("The requested exportUsers format '%s' is not supported yet.",
|
||||
format));
|
||||
response.sendError(HttpServletResponse.SC_BAD_REQUEST,
|
||||
String.format("The requested export format '%s' is not supported yet.",
|
||||
String.format("The requested exportUsers format '%s' is not supported yet.",
|
||||
format));
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ import java.math.BigDecimal;
|
|||
* the SciPublications module. The application will be mounted at
|
||||
* <code>/ccm/scipubliations/</code>. The functions are accessed using
|
||||
* an additional URL fragment. For example, if you want to access the
|
||||
* export function, you will use the URL
|
||||
* <code>/ccm/scipublications/export/</code>.
|
||||
* exportUsers function, you will use the URL
|
||||
* <code>/ccm/scipublications/exportUsers/</code>.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -57,12 +57,12 @@ import org.apache.log4j.Logger;
|
|||
* <p> The
|
||||
* <code>SciPublicationsServlet</code> processes the
|
||||
* {@link HttpServletRequest} and calls the requested actions. The available
|
||||
* actions are: </p> <dl> <dt><code>export</code></dt> <dd> <p> The
|
||||
* <code>export</code> action exports content items of the type
|
||||
* actions are: </p> <dl> <dt><code>exportUsers</code></dt> <dd> <p> The
|
||||
* <code>exportUsers</code> action exports content items of the type
|
||||
* {@link Publication} in several formats, like <em>BibTeX</em> or <em>RIS</em>.
|
||||
* The export action has the following query parameters: </p> <dl> <dt><code>format</code></dt>
|
||||
* <dd>Specifies the format which is used to export the publications.</dd> <dt><code>publication</code></dt>
|
||||
* <dd>Specifies the publication(s) to export using the ID(s) of the
|
||||
* The exportUsers action has the following query parameters: </p> <dl> <dt><code>format</code></dt>
|
||||
* <dd>Specifies the format which is used to exportUsers the publications.</dd> <dt><code>publication</code></dt>
|
||||
* <dd>Specifies the publication(s) to exportUsers using the ID(s) of the
|
||||
* publications. This parameter can occur more than one time. In this case, all
|
||||
* publications specified by the parameters will be exported as a single file in
|
||||
* specified format</dd> <dt><code>category</code></dt> <dd>Specifies a category
|
||||
|
|
@ -140,7 +140,7 @@ public class SciPublicationsServlet extends BaseApplicationServlet {
|
|||
final Document document = page.buildDocument(request, response);
|
||||
final PresentationManager presenter = Templating.getPresentationManager();
|
||||
presenter.servePage(document, request, response);
|
||||
} else if ("export".equals(path)) {
|
||||
} else if ("exportUsers".equals(path)) {
|
||||
LOGGER.debug("Export a publication");
|
||||
|
||||
Map<String, String[]> parameters;
|
||||
|
|
@ -220,10 +220,10 @@ public class SciPublicationsServlet extends BaseApplicationServlet {
|
|||
//Get the exporter for the specified format.
|
||||
exporter = SciPublicationsExporters.getInstance().getExporterForFormat(format);
|
||||
if (exporter == null) {
|
||||
LOGGER.warn(String.format("The requested export format '%s' is not supported yet.",
|
||||
LOGGER.warn(String.format("The requested exportUsers format '%s' is not supported yet.",
|
||||
format));
|
||||
response.sendError(HttpServletResponse.SC_BAD_REQUEST,
|
||||
String.format("The requested export format '%s' is not supported yet.",
|
||||
String.format("The requested exportUsers format '%s' is not supported yet.",
|
||||
format));
|
||||
return;
|
||||
}
|
||||
|
|
@ -313,7 +313,7 @@ public class SciPublicationsServlet extends BaseApplicationServlet {
|
|||
return;
|
||||
}
|
||||
|
||||
//Retrieve the ids of the publication(s) to export from the
|
||||
//Retrieve the ids of the publication(s) to exportUsers from the
|
||||
//request.
|
||||
BigDecimal publicationId;
|
||||
publicationIds = new ArrayList<BigDecimal>();
|
||||
|
|
@ -466,9 +466,9 @@ public class SciPublicationsServlet extends BaseApplicationServlet {
|
|||
// + "term id. Neither was found in the query parameters."
|
||||
// + "Responding with BAD_REQUEST status.");
|
||||
// response.sendError(HttpServletResponse.SC_BAD_REQUEST,
|
||||
// "The export action needs either a publication id or "
|
||||
// "The exportUsers action needs either a publication id or "
|
||||
// + "a term id. Neither was found in the query parameters.");
|
||||
//Otherwise, export all publications
|
||||
//Otherwise, exportUsers all publications
|
||||
final DataCollection publications = SessionManager.getSession().retrieve(
|
||||
Publication.BASE_DATA_OBJECT_TYPE);
|
||||
|
||||
|
|
@ -526,7 +526,7 @@ public class SciPublicationsServlet extends BaseApplicationServlet {
|
|||
* Helper method for exporting publications specified by a list of IDs.
|
||||
*
|
||||
* @param format The format to use.
|
||||
* @param publicationIds The IDs of the publications to export
|
||||
* @param publicationIds The IDs of the publications to exportUsers
|
||||
* @param response The {@link HttpServletResponse} to use
|
||||
* @throws IOException Thrown by some methods called by this method.
|
||||
*/
|
||||
|
|
@ -543,11 +543,11 @@ public class SciPublicationsServlet extends BaseApplicationServlet {
|
|||
|
||||
if (exporter == null) {
|
||||
LOGGER.warn(String.format(
|
||||
"The requested export format '%s' is not supported yet.",
|
||||
"The requested exportUsers format '%s' is not supported yet.",
|
||||
format));
|
||||
response.sendError(HttpServletResponse.SC_BAD_REQUEST,
|
||||
String.format(
|
||||
"The requested export format '%s' is not supported yet.",
|
||||
"The requested exportUsers format '%s' is not supported yet.",
|
||||
format));
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -31,15 +31,15 @@ public interface SciPublicationsExporter {
|
|||
|
||||
/**
|
||||
*
|
||||
* @return A description of the export format provided by this exporter.
|
||||
* @return A description of the exportUsers format provided by this exporter.
|
||||
*/
|
||||
PublicationFormat getSupportedFormat();
|
||||
|
||||
/**
|
||||
* Exports an publication to the format provided by this exporter.
|
||||
*
|
||||
* @param publication The publication to export.
|
||||
* @return The data of the publication in the provided export format.
|
||||
* @param publication The publication to exportUsers.
|
||||
* @return The data of the publication in the provided exportUsers format.
|
||||
*/
|
||||
String exportPublication(Publication publication);
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ public final class SciPublicationsExporters {
|
|||
|
||||
/**
|
||||
*
|
||||
* @return A list of all supported export formats.
|
||||
* @return A list of all supported exportUsers formats.
|
||||
*/
|
||||
public List<PublicationFormat> getSupportedFormats() {
|
||||
List<PublicationFormat> supportedFormats;
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public class SciPublicationsImporters {
|
|||
|
||||
/**
|
||||
*
|
||||
* @return A list of all supported export formats.
|
||||
* @return A list of all supported exportUsers formats.
|
||||
*/
|
||||
public List<PublicationFormat> getSupportedFormats() {
|
||||
List<PublicationFormat> supportedFormats;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* This component creates export links for all publications in a category. The export works with the descendCategories
|
||||
* This component creates exportUsers links for all publications in a category. The exportUsers works with the descendCategories
|
||||
* parameter set to true and false. Filters from a {@link CustomizableObjectList} are also supported. To add the
|
||||
* component add the following to your JSP template:
|
||||
*
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ public class ReportPanel extends SimpleContainer {
|
|||
// Export to CSV
|
||||
Label exportLabel = new Label(GlobalizationUtil.globalize("simplesurvey.ui.admin.export_response_data"));
|
||||
Link exportLink = new Link("Export to CSV file",
|
||||
"export.jsp");
|
||||
"exportUsers.jsp");
|
||||
try {
|
||||
exportLink.addPrintListener(new PrintListener() {
|
||||
public void prepare(PrintEvent event) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue