Commit 4ed845ff authored by Matija Obreza's avatar Matija Obreza

Updated javadoc

parent e47c0f12
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -20,6 +20,7 @@ import java.util.UUID;
import org.apache.commons.collections4.CollectionUtils;
import org.genesys.blocks.model.QUuidModel;
import org.genesys.blocks.model.UuidModel;
import com.querydsl.core.BooleanBuilder;
......@@ -34,7 +35,7 @@ public class UuidModelFilter extends AuditedVersionedModelFilter {
/**
* Builds the query.
*
* @param auditedVersionedModel the audited versioned model
* @param uuidModel the uuid model
* @param builder the builder
*/
protected void buildQuery(final QUuidModel uuidModel, final BooleanBuilder builder) {
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -32,7 +32,9 @@ import org.genesys.blocks.util.JsonClassNameWriter;
public interface AclAwareModel extends Serializable, EntityId {
/**
* Objects belonging to some parent can override this method
* Objects belonging to some parent can override this method.
*
* @return the parent ACL object (null by default)
*/
default AclAwareModel aclParentObject() {
return null;
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -39,8 +39,8 @@ public interface AclObjectIdentityPersistence extends JpaRepository<AclObjectIde
/**
* Clear the parentObject of child OID that use this oID as parentObject
*
* @param oID
*
* @param oID the object identifier ID
*/
@Modifying
@Query("update AclObjectIdentity aoi set aoi.parentObject = null where aoi.parentObject = ?1")
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -36,6 +36,7 @@ import org.springframework.security.core.userdetails.UserDetailsService;
*/
public interface BasicUserService<R extends GrantedAuthority, T extends BasicUser<R>> extends UserDetailsService {
/** The system admin. */
public String SYSTEM_ADMIN = "SYSTEM_ADMIN";
/**
......@@ -158,9 +159,9 @@ public interface BasicUserService<R extends GrantedAuthority, T extends BasicUse
T setAccountType(T user, AccountType accountType);
/**
* Update user's last login date
*
* @param userName
* Update user's last login date.
*
* @param userName the user name
* @throws NoUserFoundException if username not found in the system
*/
void updateLastLogin(String userName) throws NoUserFoundException;
......
......@@ -40,15 +40,15 @@ public interface CustomAclService {
Permission[] getAvailablePermissions(String className);
/**
* Get SID by ID
*
* Get SID by ID.
*
* @param id -- ID of an AclSid entity
* @return persisted AclSid entity with specified id
*/
AclSid getSid(Long id);
/**
* Gets the sid of the specified authority
* Gets the sid of the specified authority.
*
* @param authority the authority (must start with "ROLE_")
* @return the authority sid
......@@ -84,15 +84,15 @@ public interface CustomAclService {
void removePermissionsFor(AclSid sid);
/**
* Get object identity by internal id
*
* Get object identity by internal id.
*
* @param id AclObjectIdentity id
* @return
* @return the object identity
*/
AclObjectIdentity getObjectIdentity(long id);
/**
* Gets the object identity for object of type className with specified id
* Gets the object identity for object of type className with specified id.
*
* @param id the id
* @param className the clazz
......@@ -101,7 +101,7 @@ public interface CustomAclService {
AclObjectIdentity getObjectIdentity(long id, String className);
/**
* Gets the object identity of the entity
* Gets the object identity of the entity.
*
* @param entity the entity
* @return the object identity
......@@ -138,8 +138,8 @@ public interface CustomAclService {
*
* @param entity the entity
* @param sid the sid
* @param permissionMap the permission map
* @return
* @param permissions the permissions
* @return the acl object identity
*/
AclObjectIdentity setPermissions(AclAwareModel entity, AclSid sid, final Permissions permissions);
......@@ -148,8 +148,8 @@ public interface CustomAclService {
*
* @param objectIdentity the object identity
* @param sid the sid
* @param permissionMap the permission map
* @return
* @param permissions the permissions
* @return the acl object identity
*/
AclObjectIdentity setPermissions(AclObjectIdentity objectIdentity, AclSid sid, final Permissions permissions);
......@@ -199,8 +199,8 @@ public interface CustomAclService {
List<Long> listObjectIdentityIdsForSid(Class<? extends AclAwareModel> clazz, AclSid sid, Permission permission);
/**
* Make entity publicly readable (or not)
*
* Make entity publicly readable (or not).
*
* @param aclAwareModel The entity
* @param publiclyReadable true or false?
* @since 1.4
......@@ -208,7 +208,8 @@ public interface CustomAclService {
void makePubliclyReadable(AclAwareModel aclAwareModel, boolean publiclyReadable);
/**
* Cleanup ACL: remove {@link AclEntry} and {@link AclObjectIdentity} for missing ACL-aware entities, remove obsolete {@link AclClass}
* Cleanup ACL: remove {@link AclEntry} and {@link AclObjectIdentity} for
* missing ACL-aware entities, remove obsolete {@link AclClass}.
*/
void cleanupAcl();
}
......@@ -74,6 +74,7 @@ public abstract class BasicUserServiceImpl<R extends GrantedAuthority, T extends
@Autowired(required = false)
private PasswordPolicy passwordPolicy;
/** The acl entry repository. */
@Autowired(required = false)
protected AclEntryPersistence aclEntryRepository;
......@@ -97,15 +98,20 @@ public abstract class BasicUserServiceImpl<R extends GrantedAuthority, T extends
}
}
/**
* Gets the user repository.
*
* @return the user repository
*/
protected abstract JpaRepository<T, Long> getUserRepository();
/**
* Implementations must create a user with specified username with ADMINISTRATOR
* role and account type {@link AccountType#SYSTEM}
*
* role and account type {@link AccountType#SYSTEM}.
*
* @param username Generally SYSTEM_ADMIN
* @return user instance with ADMINISTRATOR role
* @throws UserException
* @throws UserException the user exception
*/
protected abstract T createSystemAdministrator(String username) throws UserException;
......@@ -164,6 +170,12 @@ public abstract class BasicUserServiceImpl<R extends GrantedAuthority, T extends
return deepLoad(user);
}
/**
* Deep load.
*
* @param user the user
* @return the t
*/
public T deepLoad(final T user) {
if (user != null) {
user.getRoles().size();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment