JavaDoc
parent
b5e33557a6
commit
f9eac9c1c2
|
|
@ -13,6 +13,8 @@ import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Model for the current asset folder. Provides data about the folder for the
|
||||||
|
* template.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
|
|
@ -20,24 +22,54 @@ import javax.inject.Named;
|
||||||
@Named("AssetFolderModel")
|
@Named("AssetFolderModel")
|
||||||
public class AssetFolderModel {
|
public class AssetFolderModel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* How many objects are in the folder (subfolders and assets)?
|
||||||
|
*/
|
||||||
private long count;
|
private long count;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Index of the first result shown.
|
||||||
|
*/
|
||||||
private int firstResult;
|
private int firstResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The maximum number of results on a page.
|
||||||
|
*/
|
||||||
private int maxResults;
|
private int maxResults;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The objects (subfolders and assets) in the folder.
|
||||||
|
*/
|
||||||
private List<AssetFolderRowModel> rows;
|
private List<AssetFolderRowModel> rows;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The breadcrumbs of the folder path.
|
||||||
|
*/
|
||||||
private List<FolderBreadcrumbsModel> breadcrumbs;
|
private List<FolderBreadcrumbsModel> breadcrumbs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The path of the folder.
|
||||||
|
*/
|
||||||
private String path;
|
private String path;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can the current user create sub folders in this folder?
|
||||||
|
*/
|
||||||
private boolean canCreateSubFolders;
|
private boolean canCreateSubFolders;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can the current folder create assets in this folder?
|
||||||
|
*/
|
||||||
private boolean canCreateAssets;
|
private boolean canCreateAssets;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The permissions granted to the current user.
|
||||||
|
*/
|
||||||
private List<GrantedPrivilegeModel> currentUserPermissions;
|
private List<GrantedPrivilegeModel> currentUserPermissions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The privileges granted to different roles for the current folder.
|
||||||
|
*/
|
||||||
private List<PrivilegesGrantedToRoleModel> grantedPermissions;
|
private List<PrivilegesGrantedToRoleModel> grantedPermissions;
|
||||||
|
|
||||||
private List<String> privileges;
|
private List<String> privileges;
|
||||||
|
|
|
||||||
|
|
@ -5,26 +5,58 @@
|
||||||
*/
|
*/
|
||||||
package org.librecms.ui.contentsections;
|
package org.librecms.ui.contentsections;
|
||||||
|
|
||||||
|
import org.libreccm.l10n.GlobalizationHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* A object in an assets folder, either a subfolder or an asset.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
public class AssetFolderRowModel {
|
public class AssetFolderRowModel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the object deletable?
|
||||||
|
*/
|
||||||
private boolean deletable;
|
private boolean deletable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the object a folder?
|
||||||
|
*/
|
||||||
private boolean folder;
|
private boolean folder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the object is a folder: The path of the folder, otherwise
|
||||||
|
* {@code null}.
|
||||||
|
*/
|
||||||
private String folderPath;
|
private String folderPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the object.
|
||||||
|
*/
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The object is a not a CMS object, but some other object put into the
|
||||||
|
* category backing the folder.
|
||||||
|
*/
|
||||||
private boolean noneCmsObject;
|
private boolean noneCmsObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The localized title of the folder. If available this title is provided in
|
||||||
|
* the negotiated language (see
|
||||||
|
* {@link GlobalizationHelper#getNegotiatedLocale()}. If this is not
|
||||||
|
* possible, default value for the default language is used.s
|
||||||
|
*/
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of the object.
|
||||||
|
*/
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The permissions granted to the current user for the object.
|
||||||
|
*/
|
||||||
private AssetPermissionsModel permissions;
|
private AssetPermissionsModel permissions;
|
||||||
|
|
||||||
public boolean isDeletable() {
|
public boolean isDeletable() {
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import javax.enterprise.context.Dependent;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* A model bean for the tree of asset folder of a content section.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
|
|
@ -19,9 +20,14 @@ import javax.inject.Inject;
|
||||||
public class AssetFolderTree
|
public class AssetFolderTree
|
||||||
extends AbstractFolderTree<AssetFolderTreeNode, AssetPermissionsModel> {
|
extends AbstractFolderTree<AssetFolderTreeNode, AssetPermissionsModel> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link AssetPermissionsModelProvider} used to create the
|
||||||
|
* {@link AssetPermissionsModel} for the folder and the currentu user.
|
||||||
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private AssetPermissionsModelProvider assetPermissions;
|
private AssetPermissionsModelProvider assetPermissions;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AssetFolderTreeNode newFolderTreeNode() {
|
public AssetFolderTreeNode newFolderTreeNode() {
|
||||||
return new AssetFolderTreeNode();
|
return new AssetFolderTreeNode();
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
package org.librecms.ui.contentsections;
|
package org.librecms.ui.contentsections;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* A node of the {@link AssetFolderTree}.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -15,99 +15,264 @@ import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* A permissions checker for assets. Checks the permissions of the current user
|
||||||
|
* for an {@link Asset}.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
@RequestScoped
|
@RequestScoped
|
||||||
public class AssetPermissionsChecker {
|
public class AssetPermissionsChecker {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link PermissionChecker} instance to use.
|
||||||
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private PermissionChecker permissionChecker;
|
private PermissionChecker permissionChecker;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks for a permission granting the {@link AssetPrivileges#CREATE_NEW}
|
||||||
|
* for the provided {@link Asset}.
|
||||||
|
*
|
||||||
|
* @param asset The asset to use.
|
||||||
|
*
|
||||||
|
* @return {@code true} if there is permission granting the
|
||||||
|
* {@link AssetPrivileges#CREATE_NEW} privilege for the provided
|
||||||
|
* {@link Asset} to the current user, {@code false} otherwise.
|
||||||
|
*/
|
||||||
public boolean canCreateAssets(final Asset asset) {
|
public boolean canCreateAssets(final Asset asset) {
|
||||||
return permissionChecker.isPermitted(
|
return permissionChecker.isPermitted(
|
||||||
AssetPrivileges.CREATE_NEW, asset
|
AssetPrivileges.CREATE_NEW, asset
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks for a permission granting the {@link AssetPrivileges#CREATE_NEW}
|
||||||
|
* for the provided {@link ContentSection}.
|
||||||
|
*
|
||||||
|
* @param section The content section.
|
||||||
|
*
|
||||||
|
* @return {@code true} if there is permission granting the
|
||||||
|
* {@link AssetPrivileges#CREATE_NEW} privilege for the provided
|
||||||
|
* {@link ContentSection} to the current user, {@code false}
|
||||||
|
* otherwise.
|
||||||
|
*/
|
||||||
public boolean canCreateAssets(final ContentSection section) {
|
public boolean canCreateAssets(final ContentSection section) {
|
||||||
return permissionChecker.isPermitted(
|
return permissionChecker.isPermitted(
|
||||||
AssetPrivileges.CREATE_NEW, section.getRootAssetsFolder()
|
AssetPrivileges.CREATE_NEW, section.getRootAssetsFolder()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks for a permission granting the {@link AssetPrivileges#CREATE_NEW}
|
||||||
|
* for the provided {@link Folder}.
|
||||||
|
*
|
||||||
|
* @param folder The folder.
|
||||||
|
*
|
||||||
|
* @return {@code true} if there is permission granting the
|
||||||
|
* {@link AssetPrivileges#CREATE_NEW} privilege for the provided
|
||||||
|
* {@link Folder} to the current user, {@code false}
|
||||||
|
* otherwise.
|
||||||
|
*/
|
||||||
public boolean canCreateAssets(final Folder folder) {
|
public boolean canCreateAssets(final Folder folder) {
|
||||||
return permissionChecker.isPermitted(
|
return permissionChecker.isPermitted(
|
||||||
AssetPrivileges.CREATE_NEW, folder
|
AssetPrivileges.CREATE_NEW, folder
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks for a permission granting the {@link AssetPrivileges#DELETE}
|
||||||
|
* for the provided {@link Asset}.
|
||||||
|
*
|
||||||
|
* @param asset The asset to use.
|
||||||
|
*
|
||||||
|
* @return {@code true} if there is permission granting the
|
||||||
|
* {@link AssetPrivileges#DELETE} privilege for the provided
|
||||||
|
* {@link Asset} to the current user, {@code false} otherwise.
|
||||||
|
*/
|
||||||
public boolean canDeleteAssets(final Asset asset) {
|
public boolean canDeleteAssets(final Asset asset) {
|
||||||
return permissionChecker.isPermitted(
|
return permissionChecker.isPermitted(
|
||||||
AssetPrivileges.DELETE, asset
|
AssetPrivileges.DELETE, asset
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks for a permission granting the {@link AssetPrivileges#DELETE}
|
||||||
|
* for the provided {@link ContentSection}.
|
||||||
|
*
|
||||||
|
* @param section The content section.
|
||||||
|
*
|
||||||
|
* @return {@code true} if there is permission granting the
|
||||||
|
* {@link AssetPrivileges#DELETE} privilege for the provided
|
||||||
|
* {@link ContentSection} to the current user, {@code false}
|
||||||
|
* otherwise.
|
||||||
|
*/
|
||||||
public boolean canDeleteAssets(final ContentSection section) {
|
public boolean canDeleteAssets(final ContentSection section) {
|
||||||
return permissionChecker.isPermitted(
|
return permissionChecker.isPermitted(
|
||||||
AssetPrivileges.DELETE, section.getRootAssetsFolder()
|
AssetPrivileges.DELETE, section.getRootAssetsFolder()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks for a permission granting the {@link AssetPrivileges#DELETE}
|
||||||
|
* for the provided {@link Folder}.
|
||||||
|
*
|
||||||
|
* @param folder The folder.
|
||||||
|
*
|
||||||
|
* @return {@code true} if there is permission granting the
|
||||||
|
* {@link AssetPrivileges#DELETE} privilege for the provided
|
||||||
|
* {@link Folder} to the current user, {@code false}
|
||||||
|
* otherwise.
|
||||||
|
*/
|
||||||
public boolean canDeleteAssets(final Folder folder) {
|
public boolean canDeleteAssets(final Folder folder) {
|
||||||
return permissionChecker.isPermitted(
|
return permissionChecker.isPermitted(
|
||||||
AssetPrivileges.DELETE, folder
|
AssetPrivileges.DELETE, folder
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks for a permission granting the {@link AssetPrivileges#USE}
|
||||||
|
* for the provided {@link Asset}.
|
||||||
|
*
|
||||||
|
* @param asset The asset to use.
|
||||||
|
*
|
||||||
|
* @return {@code true} if there is permission granting the
|
||||||
|
* {@link AssetPrivileges#USE} privilege for the provided
|
||||||
|
* {@link Asset} to the current user, {@code false} otherwise.
|
||||||
|
*/
|
||||||
public boolean canUseAssets(final Asset asset) {
|
public boolean canUseAssets(final Asset asset) {
|
||||||
return permissionChecker.isPermitted(
|
return permissionChecker.isPermitted(
|
||||||
AssetPrivileges.USE, asset
|
AssetPrivileges.USE, asset
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks for a permission granting the {@link AssetPrivileges#USE}
|
||||||
|
* for the provided {@link ContentSection}.
|
||||||
|
*
|
||||||
|
* @param section The content section.
|
||||||
|
*
|
||||||
|
* @return {@code true} if there is permission granting the
|
||||||
|
* {@link AssetPrivileges#USE} privilege for the provided
|
||||||
|
* {@link ContentSection} to the current user, {@code false}
|
||||||
|
* otherwise.
|
||||||
|
*/
|
||||||
public boolean canUseAssets(final ContentSection section) {
|
public boolean canUseAssets(final ContentSection section) {
|
||||||
return permissionChecker.isPermitted(
|
return permissionChecker.isPermitted(
|
||||||
AssetPrivileges.USE, section.getRootAssetsFolder()
|
AssetPrivileges.USE, section.getRootAssetsFolder()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks for a permission granting the {@link AssetPrivileges#USE}
|
||||||
|
* for the provided {@link Folder}.
|
||||||
|
*
|
||||||
|
* @param folder The folder.
|
||||||
|
*
|
||||||
|
* @return {@code true} if there is permission granting the
|
||||||
|
* {@link AssetPrivileges#USE} privilege for the provided
|
||||||
|
* {@link Folder} to the current user, {@code false}
|
||||||
|
* otherwise.
|
||||||
|
*/
|
||||||
public boolean canUseAssets(final Folder folder) {
|
public boolean canUseAssets(final Folder folder) {
|
||||||
return permissionChecker.isPermitted(
|
return permissionChecker.isPermitted(
|
||||||
AssetPrivileges.USE, folder
|
AssetPrivileges.USE, folder
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks for a permission granting the {@link AssetPrivileges#EDIT}
|
||||||
|
* for the provided {@link Asset}.
|
||||||
|
*
|
||||||
|
* @param asset The asset to use.
|
||||||
|
*
|
||||||
|
* @return {@code true} if there is permission granting the
|
||||||
|
* {@link AssetPrivileges#EDIT} privilege for the provided
|
||||||
|
* {@link Asset} to the current user, {@code false} otherwise.
|
||||||
|
*/
|
||||||
public boolean canEditAssets(final Asset asset) {
|
public boolean canEditAssets(final Asset asset) {
|
||||||
return permissionChecker.isPermitted(
|
return permissionChecker.isPermitted(
|
||||||
AssetPrivileges.EDIT, asset
|
AssetPrivileges.EDIT, asset
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks for a permission granting the {@link AssetPrivileges#EDIT}
|
||||||
|
* for the provided {@link ContentSection}.
|
||||||
|
*
|
||||||
|
* @param section The content section.
|
||||||
|
*
|
||||||
|
* @return {@code true} if there is permission granting the
|
||||||
|
* {@link AssetPrivileges#EDIT} privilege for the provided
|
||||||
|
* {@link ContentSection} to the current user, {@code false}
|
||||||
|
* otherwise.
|
||||||
|
*/
|
||||||
public boolean canEditAssets(final ContentSection section) {
|
public boolean canEditAssets(final ContentSection section) {
|
||||||
return permissionChecker.isPermitted(
|
return permissionChecker.isPermitted(
|
||||||
AssetPrivileges.EDIT, section.getRootAssetsFolder()
|
AssetPrivileges.EDIT, section.getRootAssetsFolder()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks for a permission granting the {@link AssetPrivileges#EDIT}
|
||||||
|
* for the provided {@link Folder}.
|
||||||
|
*
|
||||||
|
* @param folder The folder.
|
||||||
|
*
|
||||||
|
* @return {@code true} if there is permission granting the
|
||||||
|
* {@link AssetPrivileges#EDIT} privilege for the provided
|
||||||
|
* {@link Folder} to the current user, {@code false}
|
||||||
|
* otherwise.
|
||||||
|
*/
|
||||||
public boolean canEditAssets(final Folder folder) {
|
public boolean canEditAssets(final Folder folder) {
|
||||||
return permissionChecker.isPermitted(
|
return permissionChecker.isPermitted(
|
||||||
AssetPrivileges.EDIT, folder
|
AssetPrivileges.EDIT, folder
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks for a permission granting the {@link AssetPrivileges#VIEW}
|
||||||
|
* for the provided {@link Asset}.
|
||||||
|
*
|
||||||
|
* @param asset The asset to use.
|
||||||
|
*
|
||||||
|
* @return {@code true} if there is permission granting the
|
||||||
|
* {@link AssetPrivileges#VIEW} privilege for the provided
|
||||||
|
* {@link Asset} to the current user, {@code false} otherwise.
|
||||||
|
*/
|
||||||
public boolean canViewAssets(final Asset asset) {
|
public boolean canViewAssets(final Asset asset) {
|
||||||
return permissionChecker.isPermitted(
|
return permissionChecker.isPermitted(
|
||||||
AssetPrivileges.VIEW, asset
|
AssetPrivileges.VIEW, asset
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks for a permission granting the {@link AssetPrivileges#VIEW}
|
||||||
|
* for the provided {@link ContentSection}.
|
||||||
|
*
|
||||||
|
* @param section The content section.
|
||||||
|
*
|
||||||
|
* @return {@code true} if there is permission granting the
|
||||||
|
* {@link AssetPrivileges#VIEW} privilege for the provided
|
||||||
|
* {@link ContentSection} to the current user, {@code false}
|
||||||
|
* otherwise.
|
||||||
|
*/
|
||||||
public boolean canViewAssets(final ContentSection section) {
|
public boolean canViewAssets(final ContentSection section) {
|
||||||
return permissionChecker.isPermitted(
|
return permissionChecker.isPermitted(
|
||||||
AssetPrivileges.VIEW, section.getRootAssetsFolder()
|
AssetPrivileges.VIEW, section.getRootAssetsFolder()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks for a permission granting the {@link AssetPrivileges#VIEW}
|
||||||
|
* for the provided {@link Folder}.
|
||||||
|
*
|
||||||
|
* @param folder The folder.
|
||||||
|
*
|
||||||
|
* @return {@code true} if there is permission granting the
|
||||||
|
* {@link AssetPrivileges#VIEW} privilege for the provided
|
||||||
|
* {@link Folder} to the current user, {@code false}
|
||||||
|
* otherwise.
|
||||||
|
*/
|
||||||
public boolean canViewAssets(final Folder folder) {
|
public boolean canViewAssets(final Folder folder) {
|
||||||
return permissionChecker.isPermitted(
|
return permissionChecker.isPermitted(
|
||||||
AssetPrivileges.VIEW, folder
|
AssetPrivileges.VIEW, folder
|
||||||
|
|
|
||||||
|
|
@ -5,20 +5,40 @@
|
||||||
*/
|
*/
|
||||||
package org.librecms.ui.contentsections;
|
package org.librecms.ui.contentsections;
|
||||||
|
|
||||||
|
import org.librecms.contentsection.privileges.AssetPrivileges;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Model describing the permissions granted to the current user for an
|
||||||
|
* {@link Asset} or an assets {@link Folder}.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
public class AssetPermissionsModel implements PermissionsModel {
|
public class AssetPermissionsModel implements PermissionsModel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Has the user been granted the {@link AssetPrivileges#CREATE_NEW}
|
||||||
|
* privilege?
|
||||||
|
*/
|
||||||
private boolean grantedCreateNew;
|
private boolean grantedCreateNew;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Has the user been granted the {@link AssetPrivileges#DELETE} privilege?
|
||||||
|
*/
|
||||||
private boolean grantedDelete;
|
private boolean grantedDelete;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Has the user been granted the {@link AssetPrivileges#USE} privilege?
|
||||||
|
*/
|
||||||
private boolean grantedUse;
|
private boolean grantedUse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Has the user been granted the {@link AssetPrivileges#EDIT} privilege?
|
||||||
|
*/
|
||||||
private boolean grantedEdit;
|
private boolean grantedEdit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Has the user been granted the {@link AssetPrivileges#VIEW} privilege?
|
||||||
|
*/
|
||||||
private boolean grantedView;
|
private boolean grantedView;
|
||||||
|
|
||||||
public boolean isGrantedCreateNew() {
|
public boolean isGrantedCreateNew() {
|
||||||
|
|
|
||||||
|
|
@ -12,15 +12,29 @@ import javax.enterprise.context.Dependent;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* A utility CDI bean for building the {@link AssetPermissionsModel} for a asset
|
||||||
|
* {@link Folder} or an {@link Asset}.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
@Dependent
|
@Dependent
|
||||||
class AssetPermissionsModelProvider {
|
class AssetPermissionsModelProvider {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link AssetPermissionsChecker} instance to use.
|
||||||
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private AssetPermissionsChecker permissionChecker;
|
private AssetPermissionsChecker permissionChecker;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds an {@link AssetPermissionsModel} for the provided assets
|
||||||
|
* {@link Folder}
|
||||||
|
*
|
||||||
|
* @param folder The {@link Folder} for which the
|
||||||
|
* {@link AssetPermissionsModel} is build.
|
||||||
|
*
|
||||||
|
* @return The {@link AssetFolderModel} for the {@link Folder}.
|
||||||
|
*/
|
||||||
public AssetPermissionsModel buildAssetPermissionsModel(
|
public AssetPermissionsModel buildAssetPermissionsModel(
|
||||||
final Folder folder
|
final Folder folder
|
||||||
) {
|
) {
|
||||||
|
|
@ -44,6 +58,15 @@ class AssetPermissionsModelProvider {
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds an {@link AssetPermissionsModel} for the provided assets
|
||||||
|
* {@link Asset}
|
||||||
|
*
|
||||||
|
* @param folder The {@link Asset} for which the
|
||||||
|
* {@link AssetPermissionsModel} is build.
|
||||||
|
*
|
||||||
|
* @return The {@link AssetFolderModel} for the {@link Asset}.
|
||||||
|
*/
|
||||||
public AssetPermissionsModel buildAssetPermissionsModel(
|
public AssetPermissionsModel buildAssetPermissionsModel(
|
||||||
final Asset asset
|
final Asset asset
|
||||||
) {
|
) {
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,8 @@ import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.PathParam;
|
import javax.ws.rs.PathParam;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Controller for managing category systems assigned to a content section and
|
||||||
|
* their categories.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
|
|
@ -51,33 +53,70 @@ import javax.ws.rs.PathParam;
|
||||||
@Path("/{sectionIdentifier}/categorysystems")
|
@Path("/{sectionIdentifier}/categorysystems")
|
||||||
public class CategoriesController {
|
public class CategoriesController {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link CategoryManager} to use.
|
||||||
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private CategoryManager categoryManager;
|
private CategoryManager categoryManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link CategoryRepository} to use.
|
||||||
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private CategoryRepository categoryRepo;
|
private CategoryRepository categoryRepo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link CategorySystemModel} which stores the data of the selected
|
||||||
|
* category system for the view.
|
||||||
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private CategorySystemModel categorySystemModel;
|
private CategorySystemModel categorySystemModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link ContentSectionModel} which stores the data of the current
|
||||||
|
* content section for the view.
|
||||||
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private ContentSectionModel sectionModel;
|
private ContentSectionModel sectionModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link ContentSectionRepository} to use.
|
||||||
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private ContentSectionRepository sectionRepo;
|
private ContentSectionRepository sectionRepo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link GlobalizationHelper} to use.
|
||||||
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private GlobalizationHelper globalizationHelper;
|
private GlobalizationHelper globalizationHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link IdentifierParser} to use.
|
||||||
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private IdentifierParser identifierParser;
|
private IdentifierParser identifierParser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link Models} instance to use to provide data for the view.
|
||||||
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private Models models;
|
private Models models;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link PermissionChecker} to use.
|
||||||
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private PermissionChecker permissionChecker;
|
private PermissionChecker permissionChecker;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists all category systems ({@link Domain}s) assigned to the current
|
||||||
|
* {@link ContentSection}.
|
||||||
|
*
|
||||||
|
* @param sectionIdentifier The identifier of the current content section.
|
||||||
|
*
|
||||||
|
* @return The template to use for generating the view.
|
||||||
|
*/
|
||||||
@GET
|
@GET
|
||||||
@Path("/")
|
@Path("/")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
|
|
@ -105,6 +144,15 @@ public class CategoriesController {
|
||||||
return "org/librecms/ui/contentsection/categorysystems/categorysystems.xhtml";
|
return "org/librecms/ui/contentsection/categorysystems/categorysystems.xhtml";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the root category of a category system.
|
||||||
|
*
|
||||||
|
* @param sectionIdentifier The identifier of the curent content section.
|
||||||
|
* @param context The mapping context of the assigned category
|
||||||
|
* system.
|
||||||
|
*
|
||||||
|
* @return The template to use for generating the view.
|
||||||
|
*/
|
||||||
@GET
|
@GET
|
||||||
@Path("/{context}")
|
@Path("/{context}")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
|
|
@ -120,6 +168,15 @@ public class CategoriesController {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the root category of a category system.
|
||||||
|
*
|
||||||
|
* @param sectionIdentifier The identifier of the curent content section.
|
||||||
|
* @param context The mapping context of the assigned category
|
||||||
|
* system.
|
||||||
|
*
|
||||||
|
* @return The template to use for generating the view.
|
||||||
|
*/
|
||||||
@GET
|
@GET
|
||||||
@Path("/{context}/categories")
|
@Path("/{context}/categories")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
|
|
@ -131,6 +188,16 @@ public class CategoriesController {
|
||||||
return showCategorySystem(sectionIdentifier, context, "");
|
return showCategorySystem(sectionIdentifier, context, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show a category of a category system.
|
||||||
|
*
|
||||||
|
* @param sectionIdentifier The identifier of the curent content section.
|
||||||
|
* @param context The mapping context of the assigned category
|
||||||
|
* system.
|
||||||
|
* @param categoryPath The path of the category to show.
|
||||||
|
*
|
||||||
|
* @return The template to use for generating the view.
|
||||||
|
*/
|
||||||
@GET
|
@GET
|
||||||
@Path("/{context}/categories/{categoryPath:(.+)?}")
|
@Path("/{context}/categories/{categoryPath:(.+)?}")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
|
|
@ -205,6 +272,18 @@ public class CategoriesController {
|
||||||
return "org/librecms/ui/contentsection/categorysystems/categorysystem.xhtml";
|
return "org/librecms/ui/contentsection/categorysystems/categorysystem.xhtml";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a localized value to the title of the root category.
|
||||||
|
*
|
||||||
|
* @param sectionIdentifier The identifier of the current content section .
|
||||||
|
* @param context The mapping context of the assigned category
|
||||||
|
* system.
|
||||||
|
* @param localeParam The locale of the new value.
|
||||||
|
* @param value The new value.
|
||||||
|
*
|
||||||
|
* @return A redirect to the categories page or the template for generating
|
||||||
|
* an error message view.
|
||||||
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/{context}/categories/@title/add")
|
@Path("/{context}/categories/@title/add")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
|
|
@ -218,6 +297,19 @@ public class CategoriesController {
|
||||||
return addTitle(sectionIdentifier, context, "", localeParam, value);
|
return addTitle(sectionIdentifier, context, "", localeParam, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a localized value to the title of the category.
|
||||||
|
*
|
||||||
|
* @param sectionIdentifier The identifier of the current content section .
|
||||||
|
* @param context The mapping context of the assigned category
|
||||||
|
* system.
|
||||||
|
* @param categoryPathParam The path of the category.
|
||||||
|
* @param localeParam The locale of the new value.
|
||||||
|
* @param value The new value.
|
||||||
|
*
|
||||||
|
* @return A redirect to the categories page or the template for generating
|
||||||
|
* an error message view.
|
||||||
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/{context}/categories/{categoryPath:(.+)?}/@title/add")
|
@Path("/{context}/categories/{categoryPath:(.+)?}/@title/add")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
|
|
@ -255,6 +347,18 @@ public class CategoriesController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update a localized value of the title of the root category.
|
||||||
|
*
|
||||||
|
* @param sectionIdentifier The identifier of the current content section .
|
||||||
|
* @param context The mapping context of the assigned category
|
||||||
|
* system.
|
||||||
|
* @param localeParam The locale of the new value.
|
||||||
|
* @param value The new value.
|
||||||
|
*
|
||||||
|
* @return A redirect to the categories page or the template for generating
|
||||||
|
* an error message view.
|
||||||
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/{context}/categories/@title/edit/{locale}")
|
@Path("/{context}/categories/@title/edit/{locale}")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
|
|
@ -270,6 +374,19 @@ public class CategoriesController {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit the localized value to the title of a category.
|
||||||
|
*
|
||||||
|
* @param sectionIdentifier The identifier of the current content section .
|
||||||
|
* @param context The mapping context of the assigned category
|
||||||
|
* system.
|
||||||
|
* @param categoryPathParam The path of the category.
|
||||||
|
* @param localeParam The locale of the new value.
|
||||||
|
* @param value The new value.
|
||||||
|
*
|
||||||
|
* @return A redirect to the categories page or the template for generating
|
||||||
|
* an error message view.
|
||||||
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/{context}/categories/{categoryPath:(.+)?}/@title/edit/{locale}")
|
@Path("/{context}/categories/{categoryPath:(.+)?}/@title/edit/{locale}")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
|
|
@ -307,6 +424,18 @@ public class CategoriesController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a localized value from the title of the root category.
|
||||||
|
*
|
||||||
|
* @param sectionIdentifier The identifier of the current content section .
|
||||||
|
* @param context The mapping context of the assigned category
|
||||||
|
* system.
|
||||||
|
* @param localeParam The locale of the new value.
|
||||||
|
* @param value The new value.
|
||||||
|
*
|
||||||
|
* @return A redirect to the categories page or the template for generating
|
||||||
|
* an error message view.
|
||||||
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/{context}/categories/@title/remove/{locale}")
|
@Path("/{context}/categories/@title/remove/{locale}")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
|
|
@ -320,6 +449,19 @@ public class CategoriesController {
|
||||||
return removeTitle(sectionIdentifier, context, "", localeParam, value);
|
return removeTitle(sectionIdentifier, context, "", localeParam, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a localized value from the title of the category.
|
||||||
|
*
|
||||||
|
* @param sectionIdentifier The identifier of the current content section .
|
||||||
|
* @param context The mapping context of the assigned category
|
||||||
|
* system.
|
||||||
|
* @param categoryPathParam The path of the current category.
|
||||||
|
* @param localeParam The locale of the new value.
|
||||||
|
* @param value The new value.
|
||||||
|
*
|
||||||
|
* @return A redirect to the categories page or the template for generating
|
||||||
|
* an error message view.
|
||||||
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/{context}/categories/{categoryPath:(.+)?}/@title/remove/{locale}")
|
@Path("/{context}/categories/{categoryPath:(.+)?}/@title/remove/{locale}")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
|
|
@ -356,6 +498,18 @@ public class CategoriesController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a localized value to the description of the root category.
|
||||||
|
*
|
||||||
|
* @param sectionIdentifier The identifier of the current content section .
|
||||||
|
* @param context The mapping context of the assigned category
|
||||||
|
* system.
|
||||||
|
* @param localeParam The locale of the new value.
|
||||||
|
* @param value The new value.
|
||||||
|
*
|
||||||
|
* @return A redirect to the categories page or the template for generating
|
||||||
|
* an error message view.
|
||||||
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/{context}/categories/@description/add")
|
@Path("/{context}/categories/@description/add")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
|
|
@ -371,6 +525,19 @@ public class CategoriesController {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a localized value to the description of a category.
|
||||||
|
*
|
||||||
|
* @param sectionIdentifier The identifier of the current content section .
|
||||||
|
* @param context The mapping context of the assigned category
|
||||||
|
* system.
|
||||||
|
* @param categoryPathParam The path of the category.
|
||||||
|
* @param localeParam The locale of the new value.
|
||||||
|
* @param value The new value.
|
||||||
|
*
|
||||||
|
* @return A redirect to the categories page or the template for generating
|
||||||
|
* an error message view.
|
||||||
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/{context}/categories/{categoryPath:(.+)?}/@description/add")
|
@Path("/{context}/categories/{categoryPath:(.+)?}/@description/add")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
|
|
@ -408,6 +575,18 @@ public class CategoriesController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update a localized value of the description of the root category.
|
||||||
|
*
|
||||||
|
* @param sectionIdentifier The identifier of the current content section .
|
||||||
|
* @param context The mapping context of the assigned category
|
||||||
|
* system.
|
||||||
|
* @param localeParam The locale of the new value.
|
||||||
|
* @param value The new value.
|
||||||
|
*
|
||||||
|
* @return A redirect to the categories page or the template for generating
|
||||||
|
* an error message view.
|
||||||
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/{context}/categories/@description/edit/{locale}")
|
@Path("/{context}/categories/@description/edit/{locale}")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
|
|
@ -423,6 +602,19 @@ public class CategoriesController {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit the localized value to the description of a category.
|
||||||
|
*
|
||||||
|
* @param sectionIdentifier The identifier of the current content section .
|
||||||
|
* @param context The mapping context of the assigned category
|
||||||
|
* system.
|
||||||
|
* @param categoryPathParam The path of the category.
|
||||||
|
* @param localeParam The locale of the new value.
|
||||||
|
* @param value The new value.
|
||||||
|
*
|
||||||
|
* @return A redirect to the categories page or the template for generating
|
||||||
|
* an error message view.
|
||||||
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path(
|
@Path(
|
||||||
"/{context}/categories/{categoryPath:(.+)?}/@description/edit/{locale}"
|
"/{context}/categories/{categoryPath:(.+)?}/@description/edit/{locale}"
|
||||||
|
|
@ -462,6 +654,18 @@ public class CategoriesController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a localized value from the description of the root category.
|
||||||
|
*
|
||||||
|
* @param sectionIdentifier The identifier of the current content section .
|
||||||
|
* @param context The mapping context of the assigned category
|
||||||
|
* system.
|
||||||
|
* @param localeParam The locale of the new value.
|
||||||
|
* @param value The new value.
|
||||||
|
*
|
||||||
|
* @return A redirect to the categories page or the template for generating
|
||||||
|
* an error message view.
|
||||||
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/{context}/categories/@description/remove/{locale}")
|
@Path("/{context}/categories/@description/remove/{locale}")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
|
|
@ -477,6 +681,19 @@ public class CategoriesController {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a localized value from the description of the category.
|
||||||
|
*
|
||||||
|
* @param sectionIdentifier The identifier of the current content section .
|
||||||
|
* @param context The mapping context of the assigned category
|
||||||
|
* system.
|
||||||
|
* @param categoryPathParam The path of the current category.
|
||||||
|
* @param localeParam The locale of the new value.
|
||||||
|
* @param value The new value.
|
||||||
|
*
|
||||||
|
* @return A redirect to the categories page or the template for generating
|
||||||
|
* an error message view.
|
||||||
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path(
|
@Path(
|
||||||
"/{context}/categories/{categoryPath:(.+)?}/@description/remove/{locale}"
|
"/{context}/categories/{categoryPath:(.+)?}/@description/remove/{locale}"
|
||||||
|
|
@ -515,6 +732,23 @@ public class CategoriesController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update some properties of a category.
|
||||||
|
*
|
||||||
|
* @param sectionIdentifier The identifier of the current
|
||||||
|
* {@link ContentSection}.
|
||||||
|
* @param context The mapping context of the assigned category
|
||||||
|
* system.
|
||||||
|
* @param categoryPath The path of the current category.
|
||||||
|
* @param categoryName The new name of the category.
|
||||||
|
* @param uniqueId The unique ID of the category.
|
||||||
|
* @param isEnabled Is the category enabled?
|
||||||
|
* @param isVisible Is the category visible?
|
||||||
|
* @param isAbstract Is the category an abstract category?
|
||||||
|
*
|
||||||
|
* @return A redirect to the category detail page or a view for generating
|
||||||
|
* an error message.
|
||||||
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/{context}/categories/{categoryPath:(.+)?}/@properties")
|
@Path("/{context}/categories/{categoryPath:(.+)?}/@properties")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
|
|
@ -553,6 +787,19 @@ public class CategoriesController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the index element of a category.
|
||||||
|
*
|
||||||
|
* @param sectionIdentifier The identifier of the current
|
||||||
|
* {@link ContentSection}.
|
||||||
|
* @param context The mapping context of the assigned category
|
||||||
|
* system.
|
||||||
|
* @param categoryPath The path of the current category.
|
||||||
|
* @param indexElementUuid The UUID of the new index element.
|
||||||
|
*
|
||||||
|
* @return A redirect to the category page or the template for generating an
|
||||||
|
* error view.
|
||||||
|
*/
|
||||||
@GET
|
@GET
|
||||||
@Path(
|
@Path(
|
||||||
"/{context}/categories/{categoryPath:(.+)?}/@index-element/{indexElementUuid}")
|
"/{context}/categories/{categoryPath:(.+)?}/@index-element/{indexElementUuid}")
|
||||||
|
|
@ -608,6 +855,18 @@ public class CategoriesController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rests (removes) the index element of a category.
|
||||||
|
*
|
||||||
|
* @param sectionIdentifier The identifier of the current
|
||||||
|
* {@link ContentSection}.
|
||||||
|
* @param context The mapping context of the assigned category
|
||||||
|
* system.
|
||||||
|
* @param categoryPath The path of the current category.
|
||||||
|
*
|
||||||
|
* @return A redirect to the category page or the template for generating an
|
||||||
|
* error view.
|
||||||
|
*/
|
||||||
@GET
|
@GET
|
||||||
@Path("/{context}/categories/{categoryPath:(.+)?}/@index-element/reset")
|
@Path("/{context}/categories/{categoryPath:(.+)?}/@index-element/reset")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
|
|
@ -634,6 +893,21 @@ public class CategoriesController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a new subcategory to the root assets folder of a content section.
|
||||||
|
*
|
||||||
|
* @param sectionIdentifier The identifier of the current
|
||||||
|
* {@link ContentSection}.
|
||||||
|
* @param context The mapping context of the assigned category
|
||||||
|
* system.
|
||||||
|
* @param categoryName The name of the new category.
|
||||||
|
* @param uniqueId The unique ID of the new category.
|
||||||
|
* @param isEnabled Is the new category enabled.
|
||||||
|
* @param isVisible Is the new category visible?
|
||||||
|
* @param isAbstract Is the new category an abstract category?
|
||||||
|
*
|
||||||
|
* @return A redirect to the details page of the new category.
|
||||||
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/{context}/categories/@subcategories")
|
@Path("/{context}/categories/@subcategories")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
|
|
@ -659,6 +933,22 @@ public class CategoriesController {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a new subcategory to an assets folder of a content section.
|
||||||
|
*
|
||||||
|
* @param sectionIdentifier The identifier of the current
|
||||||
|
* {@link ContentSection}.
|
||||||
|
* @param context The mapping context of the assigned category
|
||||||
|
* system.
|
||||||
|
* @param categoryPath The path of the parent category.
|
||||||
|
* @param categoryName The name of the new category.
|
||||||
|
* @param uniqueId The unique ID of the new category.
|
||||||
|
* @param isEnabled Is the new category enabled.
|
||||||
|
* @param isVisible Is the new category visible?
|
||||||
|
* @param isAbstract Is the new category an abstract category?
|
||||||
|
*
|
||||||
|
* @return A redirect to the details page of the new category.
|
||||||
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/{context}/categories/{categoryPath:(.+)?}/@subcategories")
|
@Path("/{context}/categories/{categoryPath:(.+)?}/@subcategories")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
|
|
@ -697,6 +987,17 @@ public class CategoriesController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes a category.
|
||||||
|
*
|
||||||
|
* @param sectionIdentifier The identifier of the current
|
||||||
|
* {@link ContentSection}.
|
||||||
|
* @param context The mapping context of the assigned category
|
||||||
|
* system.
|
||||||
|
* @param categoryPath The path of the category to delete.
|
||||||
|
*
|
||||||
|
* @return A redirect to the detail page of the parent category.
|
||||||
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/{context}/categories/{categoryPath:(.+)?}/@delete")
|
@Path("/{context}/categories/{categoryPath:(.+)?}/@delete")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
|
|
@ -734,6 +1035,19 @@ public class CategoriesController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Moves a category to another super category.
|
||||||
|
*
|
||||||
|
** @param sectionIdentifier The identifier of the current
|
||||||
|
* {@link ContentSection}.
|
||||||
|
* @param context The mapping context of the assigned category
|
||||||
|
* system.
|
||||||
|
* @param categoryPath The path of the category to move.
|
||||||
|
* @param targetIdentifierParam The identifier of the new parent category.
|
||||||
|
*
|
||||||
|
* @return A redirect to the details page of the super category, or the
|
||||||
|
* template for showing a error view.
|
||||||
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/{context}/categories/{categoryPath:(.+)?}/@move")
|
@Path("/{context}/categories/{categoryPath:(.+)?}/@move")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
|
|
@ -794,6 +1108,19 @@ public class CategoriesController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reorders subcategories.
|
||||||
|
*
|
||||||
|
* @param sectionIdentifier The identifier of the current
|
||||||
|
* {@link ContentSection}.
|
||||||
|
* @param context The mapping context of the assigned category
|
||||||
|
* system.
|
||||||
|
* @param categoryPath The path of the category to move.
|
||||||
|
* @param direction The direction of the move.
|
||||||
|
*
|
||||||
|
* @return A redirect to the details page of the parent category or the
|
||||||
|
* template for building an error message.
|
||||||
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/{context}/categories/{categoryPath:(.+)?}/@order")
|
@Path("/{context}/categories/{categoryPath:(.+)?}/@order")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
|
|
@ -855,6 +1182,20 @@ public class CategoriesController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reorders subcategories.
|
||||||
|
*
|
||||||
|
* @param sectionIdentifier The identifier of the current
|
||||||
|
* {@link ContentSection}.
|
||||||
|
* @param context The mapping context of the assigned category
|
||||||
|
* system.
|
||||||
|
* @param categoryPath The path of the category .
|
||||||
|
* @param objectIdentifier The identifier of the object to move.
|
||||||
|
* @param direction The direction of the move.
|
||||||
|
*
|
||||||
|
* @return A redirect to the details page of the parent category or the
|
||||||
|
* template for building an error message.
|
||||||
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path(
|
@Path(
|
||||||
"/{context}/categories/{categoryPath:(.+)?}/@objects/{objectIdentifier}/order")
|
"/{context}/categories/{categoryPath:(.+)?}/@objects/{objectIdentifier}/order")
|
||||||
|
|
@ -923,6 +1264,13 @@ public class CategoriesController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method for retrieving the current {@link ContentSection},
|
||||||
|
*
|
||||||
|
* @param sectionIdentifier The identifier of the section.
|
||||||
|
*
|
||||||
|
* @return A {@link Optional} with the requested {@link ContentSection}.
|
||||||
|
*/
|
||||||
private Optional<ContentSection> retrieveContentSection(
|
private Optional<ContentSection> retrieveContentSection(
|
||||||
final String sectionIdentifier
|
final String sectionIdentifier
|
||||||
) {
|
) {
|
||||||
|
|
@ -950,6 +1298,15 @@ public class CategoriesController {
|
||||||
return sectionResult;
|
return sectionResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param sectionIdentifier The identifier of the current
|
||||||
|
* {@link ContentSection}.
|
||||||
|
* @param context The mapping context of the assigned category
|
||||||
|
* system.
|
||||||
|
* @param categoryPath The path of the category .
|
||||||
|
*
|
||||||
|
* @return A {@link RetrieveResult}.
|
||||||
|
*/
|
||||||
private RetrieveResult<Category> retrieveCategory(
|
private RetrieveResult<Category> retrieveCategory(
|
||||||
final String sectionIdentifier,
|
final String sectionIdentifier,
|
||||||
final String context,
|
final String context,
|
||||||
|
|
@ -1059,6 +1416,14 @@ public class CategoriesController {
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method for building the {@link CategoryModel} for the
|
||||||
|
* {@link Category}.
|
||||||
|
*
|
||||||
|
* @param category
|
||||||
|
*
|
||||||
|
* @return A {@link CategoryModel} for the provided category.
|
||||||
|
*/
|
||||||
private CategoryModel buildCategoryModel(final Category category) {
|
private CategoryModel buildCategoryModel(final Category category) {
|
||||||
final CategoryModel model = new CategoryModel();
|
final CategoryModel model = new CategoryModel();
|
||||||
model.setAbstractCategory(category.isAbstractCategory());
|
model.setAbstractCategory(category.isAbstractCategory());
|
||||||
|
|
@ -1153,6 +1518,13 @@ public class CategoriesController {
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build a {@link CategoryModel} fro a subcategory.
|
||||||
|
*
|
||||||
|
* @param category The subcategory to use.
|
||||||
|
*
|
||||||
|
* @return A {@link CategoryModel} for the provided {@link Category}.
|
||||||
|
*/
|
||||||
private CategoryModel buildSubCategoriesModel(final Category category) {
|
private CategoryModel buildSubCategoriesModel(final Category category) {
|
||||||
final CategoryModel model = new CategoryModel();
|
final CategoryModel model = new CategoryModel();
|
||||||
model.setAbstractCategory(category.isAbstractCategory());
|
model.setAbstractCategory(category.isAbstractCategory());
|
||||||
|
|
@ -1177,6 +1549,15 @@ public class CategoriesController {
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build a {@link CategorizedObjectModel} for an object in a {@link Folder}.
|
||||||
|
*
|
||||||
|
* @param categorization The {@link Categorization} instance of the object
|
||||||
|
* and the folder.
|
||||||
|
*
|
||||||
|
* @return A {@link CategorizedObjectModel} for the provided
|
||||||
|
* {@link Categorization}.
|
||||||
|
*/
|
||||||
private CategorizedObjectModel buildCategorizedObjectModel(
|
private CategorizedObjectModel buildCategorizedObjectModel(
|
||||||
final Categorization categorization
|
final Categorization categorization
|
||||||
) {
|
) {
|
||||||
|
|
|
||||||
|
|
@ -5,24 +5,50 @@
|
||||||
*/
|
*/
|
||||||
package org.librecms.ui.contentsections;
|
package org.librecms.ui.contentsections;
|
||||||
|
|
||||||
|
import org.libreccm.l10n.GlobalizationHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Model bean for transferring the data about an object in a folder to the
|
||||||
|
* frontend.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
public class CategorizedObjectModel {
|
public class CategorizedObjectModel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of the object.
|
||||||
|
*/
|
||||||
private long objectId;
|
private long objectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The UUID of the object.
|
||||||
|
*/
|
||||||
private String objectUuid;
|
private String objectUuid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The display name of the object.
|
||||||
|
*/
|
||||||
private String displayName;
|
private String displayName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The title of the object. If available the title is in the {@link GlobalizationHelper#getNegotiatedLocale()
|
||||||
|
* } is used. Otherwise the default language is used.
|
||||||
|
*/
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of the object.
|
||||||
|
*/
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the object the index object of the folder?
|
||||||
|
*/
|
||||||
private boolean indexObject;
|
private boolean indexObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The order index for the object.
|
||||||
|
*/
|
||||||
private long objectOrder;
|
private long objectOrder;
|
||||||
|
|
||||||
public long getObjectId() {
|
public long getObjectId() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue