CCM NG: Cleanup and JavaDoc for ccm-shortcuts
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4170 8810af33-2d31-482b-a856-94f89814c4dfpull/2/head
parent
784722ddd0
commit
4cc7891126
|
|
@ -22,6 +22,9 @@ import javax.persistence.EntityManager;
|
|||
import org.libreccm.shortcuts.ShortcutsConstants;
|
||||
|
||||
/**
|
||||
* Setups the {@code shortcuts-manager} role. The
|
||||
* {@link ShortcutsConstants#SHORTSCUT_MANAGE_PRIVILEGE} is granted to this
|
||||
* role.
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
|
|
@ -41,9 +44,9 @@ public class ShortcutsRolesSetup {
|
|||
final Permission permission = new Permission();
|
||||
permission.setGrantee(shortcutsManager);
|
||||
permission.setGrantedPrivilege(
|
||||
ShortcutsConstants.SHORTSCUT_MANAGE_PRIVILEGE);
|
||||
ShortcutsConstants.SHORTSCUT_MANAGE_PRIVILEGE);
|
||||
permission.setObject(null);
|
||||
|
||||
|
||||
entityManager.persist(permission);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@ import javax.persistence.NamedQuery;
|
|||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
*
|
||||
* Entity representing a single shortcut.
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@Entity
|
||||
|
|
@ -52,15 +53,24 @@ public class Shortcut implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = -5674633339633714327L;
|
||||
|
||||
/**
|
||||
* Database internal ID of the shortcut.
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "SHORTCUT_ID")
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private long shortcutId;
|
||||
|
||||
/**
|
||||
* The URL to redirect (the URL which a visitor calls).
|
||||
*/
|
||||
@Column(name = "URL_KEY", length = 1024, unique = true)
|
||||
@NotEmpty
|
||||
private String urlKey;
|
||||
|
||||
/**
|
||||
* The URL to which the requeset for {@link #urlKey} is redirected.
|
||||
*/
|
||||
@Column(name = "REDIRECT", length = 1024)
|
||||
@NotEmpty
|
||||
private String redirect;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@ import javax.persistence.TypedQuery;
|
|||
import javax.transaction.Transactional;
|
||||
|
||||
/**
|
||||
*
|
||||
* Repository class for {@link Shortcut} entities.
|
||||
*
|
||||
* @author <a href="konerman@tzi.de">Alexander Konermann</a>
|
||||
*/
|
||||
@RequestScoped
|
||||
|
|
|
|||
|
|
@ -30,7 +30,9 @@ import org.libreccm.shortcuts.ui.ShortcutsSettingsPane;
|
|||
import org.libreccm.web.ApplicationType;
|
||||
|
||||
/**
|
||||
*
|
||||
* The {@code Shortcuts} module for CCM. Defines the {@code Shortcuts}
|
||||
* application and sets up the module when the module is installed.
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@Module(
|
||||
|
|
|
|||
|
|
@ -1,45 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2013 Jens Pelzetter
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
package org.libreccm.shortcuts;
|
||||
|
||||
import org.libreccm.shortcuts.ui.AdminPanel;
|
||||
import com.arsdigita.ui.admin.applications.AbstractSingletonApplicationManager;
|
||||
import com.arsdigita.ui.admin.applications.ApplicationInstanceAwareContainer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class ShortcutsAppManager extends AbstractSingletonApplicationManager<Shortcuts>{
|
||||
|
||||
public Class<Shortcuts> getApplication() {
|
||||
return Shortcuts.class;
|
||||
}
|
||||
|
||||
public ApplicationInstanceAwareContainer getApplicationAdminForm() {
|
||||
final ApplicationInstanceAwareContainer container = new ApplicationInstanceAwareContainer();
|
||||
container.add(new AdminPanel());
|
||||
|
||||
return container;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -27,6 +27,7 @@ import javax.enterprise.context.RequestScoped;
|
|||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* Retrieves an instance of the {@code Shortcuts} application.
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@
|
|||
package org.libreccm.shortcuts;
|
||||
|
||||
/**
|
||||
*
|
||||
* Constants for the {@code Shortcuts} module.
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public final class ShortcutsConstants {
|
||||
|
|
@ -30,6 +31,10 @@ public final class ShortcutsConstants {
|
|||
public static final String SHORTCUTS_APP_TYPE
|
||||
= "org.libreccm.shortcuts.Shortcuts";
|
||||
|
||||
/**
|
||||
* Resource bundle which provides the localised messages and labels for
|
||||
* the UIs of the {@code Shortcuts} module.
|
||||
*/
|
||||
public static final String SHORTCUTS_BUNDLE
|
||||
= "org.libreccm.shortcuts.ShortcutsResources";
|
||||
|
||||
|
|
@ -38,8 +43,15 @@ public final class ShortcutsConstants {
|
|||
*/
|
||||
public static final String SHORTCUTS_PRIMARY_URL = "/shortcuts/";
|
||||
|
||||
/**
|
||||
* The privilege which must be granted to a user if the user wants to
|
||||
* manage (create, edit, delete) shortcuts.
|
||||
*/
|
||||
public static final String SHORTSCUT_MANAGE_PRIVILEGE = "manage_shortcuts";
|
||||
|
||||
/**
|
||||
* Private constructor to forbid creation of instances of this class.
|
||||
*/
|
||||
private ShortcutsConstants() {
|
||||
//Nothing
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,11 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
*
|
||||
* A Servlet filter which intercepts all requests to CCM and checks of there is
|
||||
* a shortcut for the requested URL. If there is matching shortcut the request
|
||||
* is redirected to the URL specified in the matching shortcut. If no matching
|
||||
* shortcut is found the next filter in the filter chain is called.
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@WebFilter(urlPatterns = {"/*"})
|
||||
|
|
|
|||
|
|
@ -26,6 +26,10 @@ import java.util.UUID;
|
|||
import org.libreccm.security.ShortcutsRolesSetup;
|
||||
|
||||
/**
|
||||
* Setups the the {@code Shortcuts module}. Creates the singleton application
|
||||
* instance for shortcuts and creates a role to which the
|
||||
* {@code manage_shortcuts} is granted.
|
||||
*
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
|
|
@ -44,7 +48,7 @@ public class ShortcutsSetup extends AbstractCcmApplicationSetup {
|
|||
getEntityManager().persist(shortcuts);
|
||||
|
||||
final ShortcutsRolesSetup rolesSetup = new ShortcutsRolesSetup(
|
||||
getEntityManager());
|
||||
getEntityManager());
|
||||
rolesSetup.setupShortcutsRoles();
|
||||
|
||||
// final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
|
|
|
|||
|
|
@ -36,7 +36,8 @@ import java.util.Locale;
|
|||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
*
|
||||
* For for creating and editing shortcuts.
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class ShortcutForm extends Form {
|
||||
|
|
|
|||
|
|
@ -31,15 +31,32 @@ import com.arsdigita.ui.admin.applications.AbstractAppSettingsPane;
|
|||
import org.libreccm.shortcuts.ShortcutsConstants;
|
||||
|
||||
/**
|
||||
*
|
||||
* Pane which is used in the {@code /ccm/admin/} application for providing
|
||||
* an admininstration UI for shortcuts.
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class ShortcutsSettingsPane extends AbstractAppSettingsPane {
|
||||
|
||||
/**
|
||||
* Parameter for the selected shortcut.
|
||||
*/
|
||||
private final StringParameter selectedShortcutParam;
|
||||
/**
|
||||
* Selection model for the selected shortcut.
|
||||
*/
|
||||
private final ParameterSingleSelectionModel<String> selectedShortcut;
|
||||
/**
|
||||
* Table listing all shortcuts.
|
||||
*/
|
||||
private final ShortcutsTable shortcutsTable;
|
||||
/**
|
||||
* Link for creating a new shortcut.
|
||||
*/
|
||||
private final ActionLink addShortcutLink;
|
||||
/**
|
||||
* Form for creating and editing shortcuts.
|
||||
*/
|
||||
private final ShortcutForm shortcutForm;
|
||||
|
||||
public ShortcutsSettingsPane(
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ import org.libreccm.shortcuts.ShortcutsConstants;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Table which lists all shortcuts.
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue