Subversion Repositories linshare

Compare Revisions

Rev 1133 → Rev 1134

/linshare/src/main/java/org/linagora/linshare/ldap/JScriptLdapQuery.java
193,10 → 193,10
* @return
*/
private User mapToUser(Map<String, List<String>> retMap) {
String mail = (String) retMap.get(getUserMail()).get(0);
String firstName = (String) retMap.get(getUserFirstName()).get(0);
String lastName = (String) retMap.get(getUserLastName()).get(0);
String ldapUid = (String) retMap.get(getLdapUid()).get(0);
String mail = retMap.get(getUserMail()).get(0);
String firstName = retMap.get(getUserFirstName()).get(0);
String lastName = retMap.get(getUserLastName()).get(0);
String ldapUid = retMap.get(getLdapUid()).get(0);
User user = new Internal(firstName, lastName, mail, ldapUid);
return user;
}
/linshare/src/main/java/org/linagora/linshare/ldap/JndiServices.java
292,6 → 292,7
ne = ctx.search(rewrittenBase, searchFilter, sc);
} catch (CommunicationException ce) {
LOGGER.error("ComunicationException : reconnexion to ,ldap directory");
LOGGER.error(ce.toString());
ctx.reconnect(ctx.getConnectControls());
return getEntry(base, filter, sc, scope);
} catch (NamingException nex) {
302,10 → 303,9
SearchResult sr = null;
if (ne.hasMoreElements()) {
sr = (SearchResult) ne.nextElement();
sr = ne.nextElement();
if (ne.hasMoreElements()) {
LOGGER.error("Too many entries returned (base: \"{}\", filter: \"{}\")",
searchBase, searchFilter);
LOGGER.error("Too many entries returned (base: \"{}\", filter: \"{}\")", searchBase, searchFilter);
throw new SizeLimitExceededException("Too many entries returned (base: \"" + searchBase + "\", filter: \"" + searchFilter + "\")");
} else {
return sr;
391,6 → 391,7
ne = ctx.search(rewriteBase(base), filter, sc);
} catch (CommunicationException ce) {
ctx.reconnect(ctx.getConnectControls());
LOGGER.debug(ce.toString());
return readEntry(base, filter, allowError, sc);
} catch (NamingException nex) {
if (!allowError) {
402,7 → 403,7
 
SearchResult sr = null;
if (ne.hasMore()) {
sr = (SearchResult) ne.next();
sr = ne.next();
if (ne.hasMore()) {
LOGGER.error("Too many entries returned (base: \"{}\")", base);
} else {
438,6 → 439,7
ret = true;
} catch (Exception e) {
ret = false;
LOGGER.debug(e.toString());
} finally {
bindContext.removeFromEnvironment(Context.SECURITY_AUTHENTICATION);
bindContext.removeFromEnvironment(Context.SECURITY_PRINCIPAL);
485,10 → 487,11
completedBaseDn = "," + base;
}
while (ne.hasMoreElements()) {
iist.add(((SearchResult) ne.next()).getName() + completedBaseDn);
iist.add((ne.next()).getName() + completedBaseDn);
}
} catch (CommunicationException ce) {
ctx.reconnect(ctx.getConnectControls());
LOGGER.debug(ce.toString());
return getDnList(base, filter, scope);
} catch (NamingException e) {
LOGGER.error(e.toString());
/linshare/src/main/java/org/linagora/linshare/auth/DomainAuthProviderDao.java
80,7 → 80,7
logger.debug("Retrieving user detail for ldap authentication : " + login);
String password = (String)authentication.getCredentials();
if(password == "") {
if (password.isEmpty()) {
logger.debug("User password is empty, authentification failed");
throw new BadCredentialsException(messages.getMessage("AbstractUserDetailsAuthenticationProvider.badCredentials", "Bad credentials"));
}
/linshare/src/main/java/org/linagora/linshare/core/repository/hibernate/DomainPolicyRepositoryImpl.java
42,7 → 42,7
@SuppressWarnings("unchecked")
public List<String> findAllIdentifiers() {
 
return (List<String>) getHibernateTemplate().executeFind(
return getHibernateTemplate().executeFind(
new HibernateCallback() {
public Object doInHibernate(final Session session)
throws HibernateException, SQLException {
/linshare/src/main/java/org/linagora/linshare/core/repository/hibernate/AbstractDomainRepositoryImpl.java
42,8 → 42,7
@SuppressWarnings("unchecked")
@Override
public List<String> findAllDomainIdentifiers() {
 
return (List<String>) getHibernateTemplate().executeFind(
return getHibernateTemplate().executeFind(
new HibernateCallback<List<String>>() {
public List<String> doInHibernate(final Session session)
throws HibernateException, SQLException {
56,7 → 55,7
@SuppressWarnings("unchecked")
@Override
public List<AbstractDomain> findAllDomain() {
return (List<AbstractDomain>) getHibernateTemplate().executeFind(
return getHibernateTemplate().executeFind(
new HibernateCallback<List<AbstractDomain>>() {
public List<AbstractDomain> doInHibernate(final Session session)
throws HibernateException, SQLException {
69,7 → 68,7
@SuppressWarnings("unchecked")
@Override
public List<AbstractDomain> findAllTopAndSubDomain() {
return (List<AbstractDomain>) getHibernateTemplate().executeFind(
return getHibernateTemplate().executeFind(
new HibernateCallback<List<AbstractDomain>>() {
public List<AbstractDomain> doInHibernate(final Session session)
throws HibernateException, SQLException {
83,7 → 82,7
@SuppressWarnings("unchecked")
@Override
public List<AbstractDomain> findAllTopDomain() {
return (List<AbstractDomain>) getHibernateTemplate().executeFind(
return getHibernateTemplate().executeFind(
new HibernateCallback<List<AbstractDomain>>() {
public List<AbstractDomain> doInHibernate(final Session session)
throws HibernateException, SQLException {
96,7 → 95,7
@SuppressWarnings("unchecked")
@Override
public List<AbstractDomain> findAllSubDomain() {
return (List<AbstractDomain>) getHibernateTemplate().executeFind(
return getHibernateTemplate().executeFind(
new HibernateCallback<List<AbstractDomain>>() {
public List<AbstractDomain> doInHibernate(final Session session)
throws HibernateException, SQLException {
/linshare/src/main/java/org/linagora/linshare/core/repository/hibernate/GenericUserRepositoryImpl.java
171,7 → 171,7
@Override
public List<String> findMails(final String beginWith) {
return (List<String>)getHibernateTemplate().executeFind(new HibernateCallback() {
return getHibernateTemplate().executeFind(new HibernateCallback() {
public Object doInHibernate(final Session session)
throws HibernateException, SQLException {
/linshare/src/main/java/org/linagora/linshare/core/repository/hibernate/ShareEntryRepositoryImpl.java
119,7 → 119,7
final QueryParameter queryParameter = buildQuery(searchDocumentCriterion, ANYWHERE);
return (List<ShareEntry>)getHibernateTemplate().executeFind(new HibernateCallback<List<ShareEntry>>() {
return getHibernateTemplate().executeFind(new HibernateCallback<List<ShareEntry>>() {
public List<ShareEntry> doInHibernate(final Session session) throws HibernateException, SQLException {
StringBuilder queryString = new StringBuilder("select share from ShareEntry share join share.recipient recipient join share.documentEntry.document doc join share.entryOwner sender ");
/linshare/src/main/java/org/linagora/linshare/core/repository/hibernate/DocumentEntryRepositoryImpl.java
110,7 → 110,7
return ((Long)query.iterate().next()).longValue();
}
};
Long shareResult = (Long) getHibernateTemplate().execute(action);
Long shareResult = getHibernateTemplate().execute(action);
action = new HibernateCallback<Long>() {
public Long doInHibernate(final Session session) throws HibernateException, SQLException {
119,7 → 119,7
return ((Long)query.iterate().next()).longValue();
}
};
Long anonymousShareResult = (Long) getHibernateTemplate().execute(action);
Long anonymousShareResult = getHibernateTemplate().execute(action);
result = anonymousShareResult + shareResult;
if(logger.isDebugEnabled())
148,7 → 148,7
final QueryParameter queryParameter = buildQuery(searchDocumentCriterion, ANYWHERE);
return (List<DocumentEntry>)getHibernateTemplate().executeFind(new HibernateCallback<List<DocumentEntry>>() {
return getHibernateTemplate().executeFind(new HibernateCallback<List<DocumentEntry>>() {
public List<DocumentEntry> doInHibernate(final Session session) throws HibernateException, SQLException {
StringBuilder queryString = new StringBuilder("select docEntry from DocumentEntry docEntry join docEntry.entryOwner account join docEntry.document doc ");
/linshare/src/main/java/org/linagora/linshare/core/repository/hibernate/AllowedContactRepositoryImpl.java
58,8 → 58,7
@SuppressWarnings("unchecked")
public List<AllowedContact> searchContact(final String mail, final String firstName, final String lastName, final Guest guest) {
return (List<AllowedContact>) getHibernateTemplate().executeFind(new HibernateCallback() {
return getHibernateTemplate().executeFind(new HibernateCallback() {
public Object doInHibernate(final Session session)
throws HibernateException, SQLException {
String mailQ = mail==null?"":mail;
/linshare/src/main/java/org/linagora/linshare/core/repository/hibernate/DomainPatternRepositoryImpl.java
44,7 → 44,7
@SuppressWarnings("unchecked")
@Override
public List<DomainPattern> findAllSystemDomainPattern() {
return (List<DomainPattern>) getHibernateTemplate().executeFind(
return getHibernateTemplate().executeFind(
new HibernateCallback() {
public Object doInHibernate(final Session session)
throws HibernateException, SQLException {
58,7 → 58,7
@SuppressWarnings("unchecked")
@Override
public List<DomainPattern> findAllUserDomainPattern() {
return (List<DomainPattern>) getHibernateTemplate().executeFind(
return getHibernateTemplate().executeFind(
new HibernateCallback() {
public Object doInHibernate(final Session session)
throws HibernateException, SQLException {
/linshare/src/main/java/org/linagora/linshare/core/repository/hibernate/AnonymousUrlRepositoryImpl.java
83,7 → 83,7
}
};
return (List<AnonymousUrl>) getHibernateTemplate().execute(action);
return getHibernateTemplate().execute(action);
}
 
/linshare/src/main/java/org/linagora/linshare/core/service/AnonymousShareEntryService.java
9,7 → 9,6
import org.linagora.linshare.core.domain.entities.Contact;
import org.linagora.linshare.core.domain.entities.DocumentEntry;
import org.linagora.linshare.core.domain.entities.MailContainer;
import org.linagora.linshare.core.domain.entities.ShareEntry;
import org.linagora.linshare.core.domain.entities.SystemAccount;
import org.linagora.linshare.core.domain.entities.User;
import org.linagora.linshare.core.exception.BusinessException;
/linshare/src/main/java/org/linagora/linshare/core/service/impl/AnonymousShareEntryServiceImpl.java
14,7 → 14,6
import org.linagora.linshare.core.domain.entities.Contact;
import org.linagora.linshare.core.domain.entities.DocumentEntry;
import org.linagora.linshare.core.domain.entities.MailContainer;
import org.linagora.linshare.core.domain.entities.Role;
import org.linagora.linshare.core.domain.entities.ShareLogEntry;
import org.linagora.linshare.core.domain.entities.SystemAccount;
import org.linagora.linshare.core.domain.entities.User;
/linshare/src/main/java/org/linagora/linshare/core/service/impl/ThreadServiceImpl.java
3,8 → 3,6
import java.util.ArrayList;
import java.util.List;
 
import javax.annotation.processing.Filer;
 
import org.linagora.linshare.core.domain.entities.Account;
import org.linagora.linshare.core.domain.entities.Tag;
import org.linagora.linshare.core.domain.entities.TagFilter;
13,12 → 11,10
import org.linagora.linshare.core.domain.entities.ThreadView;
import org.linagora.linshare.core.domain.entities.User;
import org.linagora.linshare.core.exception.BusinessException;
import org.linagora.linshare.core.repository.AbstractRepository;
import org.linagora.linshare.core.repository.TagRepository;
import org.linagora.linshare.core.repository.ThreadMemberRepository;
import org.linagora.linshare.core.repository.ThreadRepository;
import org.linagora.linshare.core.repository.ThreadViewRepository;
import org.linagora.linshare.core.repository.hibernate.AbstractRepositoryImpl;
import org.linagora.linshare.core.service.ThreadService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/linshare/src/main/java/org/linagora/linshare/core/service/impl/AnonymousUrlServiceImpl.java
45,6 → 45,7
logger.error("the source path is different than the anonymous url path : " + urlPath + " : " + anonymousUrl.getUrlPath());
} catch (LinShareNotSuchElementException e) {
logger.warn("the anonymousUrl '" + uuid + "' does not exist.");
logger.debug(e.toString());
}
return false;
}
/linshare/src/main/java/org/linagora/linshare/core/service/impl/UserServiceImpl.java
102,11 → 102,6
 
private final ThreadService threadService;
 
/** Constructor.
* @param userRepository repository.
* @param notifierService notifier service.
* @param ldapDao LDAP DAO.
*/
public UserServiceImpl(final UserRepository userRepository,
final NotifierService notifierService,
final LogEntryService logEntryService,
/linshare/src/main/java/org/linagora/linshare/core/service/impl/MailNotifierServiceImpl.java
275,6 → 275,7
sendNotification(mailContainer.getReplyTo(), mailContainer.getRecipient(), mailContainer);
} catch (SendFailedException e) {
unknownRecipients.add(mailContainer.getRecipient());
logger.debug(e.toString());
}
}
/linshare/src/main/java/org/linagora/linshare/core/service/impl/FunctionalityServiceImpl.java
437,14 → 437,9
// I have to check if I have the permission to modify the activation status of this functionality
if (!functionality.getActivationPolicy().isSystem()) {
for (Functionality ancestor : parentFunctionalitites) {
if(ancestor.getIdentifier().equals(functionality.getIdentifier())) { // same functionality but different entities
if (ancestor.getActivationPolicy().isMutable()) {
// the ancestor allows modifications
return true;
} else {
// the ancestor does not allow modifications
return false;
}
if (ancestor.getIdentifier().equals(functionality.getIdentifier())) { // same functionality but different entities
// return true if the ancestor allows modifications
return (ancestor.getActivationPolicy().isMutable());
}
}
// No ancestor found, modifications are allowed.
457,13 → 452,8
if (!functionality.getConfigurationPolicy().isSystem()) {
for (Functionality ancestor : parentFunctionalitites) {
if(ancestor.getIdentifier().equals(functionality.getIdentifier())) { // same functionality but different entities
if (ancestor.getConfigurationPolicy().isMutable()) {
// the ancestor allows modifications
return true;
} else {
// the ancestor does not allow modifications
return false;
}
// return true if the ancestor allows modifications
return (ancestor.getConfigurationPolicy().isMutable());
}
}
// No ancestor found, modifications are allowed.
478,13 → 468,8
if (functionality.getActivationPolicy().getStatus()) {
for (Functionality ancestor : parentFunctionalitites) {
if(ancestor.getIdentifier().equals(functionality.getIdentifier())) { // same functionality but different entities
if (ancestor.getConfigurationPolicy().getStatus()) {
// the ancestor allows modifications
return true;
} else {
// the ancestor does not allow modifications
return false;
}
// return true if the ancestor allows modifications
return (ancestor.getConfigurationPolicy().getStatus());
}
}
// No ancestor found, modifications are allowed.
/linshare/src/main/java/org/linagora/linshare/core/service/impl/UserProviderServiceImpl.java
184,7 → 184,7
 
@Override
public User auth(LdapUserProvider userProvider, String mail, String userPasswd) throws BusinessException, NamingException, IOException {
LdapUserProvider p = (LdapUserProvider)userProvider;
LdapUserProvider p = userProvider;
if(p == null) {
return null;
}
/linshare/src/main/java/org/linagora/linshare/core/service/impl/MailContentBuildingServiceImpl.java
850,7 → 850,7
namesTxt.append(name +"\n");
}
 
String number = new Integer(docNames.size()).toString();
String number = "" + docNames.size();
 
contentTXT = StringUtils.replace(contentTXT, "${firstName}", actor.getFirstName());
contentTXT = StringUtils.replace(contentTXT, "${lastName}", actor.getLastName());
/linshare/src/main/java/org/linagora/linshare/core/service/impl/AbstractDomainServiceImpl.java
173,7 → 173,7
// Remove element from its ancestor. It does not need to be updated. Do not know why, implicit update somewhere ?
if(domain.getParentDomain()!=null) {
for (Iterator<AbstractDomain> iterator = domain.getParentDomain().getSubdomain().iterator(); iterator.hasNext();) {
AbstractDomain s= (AbstractDomain) iterator.next();
AbstractDomain s = iterator.next();
if(s.getIdentifier().equals(identifier)) {
iterator.remove();
// abstractDomainRepository.update(domain.getParentDomain());
/linshare/src/main/java/org/linagora/linshare/core/utils/FileUtils.java
35,25 → 35,25
}
public static String getFriendlySize(long SizeInBytes, Messages messages) {
if(SizeInBytes<KiB){
return String.format(messages.get("components.fileUtils.bytesSize.text"),SizeInBytes);
}else if(SizeInBytes<MiB){
return String.format(messages.get("components.fileUtils.kiloSize.text"), (float)(SizeInBytes/KiB));
}else if(SizeInBytes<GiB){
return String.format(messages.get("components.fileUtils.megaSize.text"), (float)(SizeInBytes/MiB));
}else{
return String.format(messages.get("components.fileUtils.gigaSize.text"), (float)(SizeInBytes/GiB));
if (SizeInBytes < KiB){
return String.format(messages.get("components.fileUtils.bytesSize.text"), SizeInBytes);
} else if(SizeInBytes < MiB){
return String.format(messages.get("components.fileUtils.kiloSize.text"), SizeInBytes / KiB);
} else if(SizeInBytes < GiB){
return String.format(messages.get("components.fileUtils.megaSize.text"), SizeInBytes / MiB);
} else{
return String.format(messages.get("components.fileUtils.gigaSize.text"), SizeInBytes / GiB);
}
}
public static Unit getAppropriateUnitSize(long sizeInBytes){
if(sizeInBytes<KiB){
if (sizeInBytes < KiB){
return Unit.Byte;
}else if(sizeInBytes<MiB){
} else if (sizeInBytes < MiB){
return Unit.KiB;
}else if(sizeInBytes<GiB){
} else if (sizeInBytes < GiB){
return Unit.MiB;
}else{
} else{
return Unit.GiB;
}
}
68,19 → 68,19
switch (wantedUnit) {
case Byte:
res = String.format(messages.get("components.fileUtils.bytesSize.text"),SizeInBytes);
res = String.format(messages.get("components.fileUtils.bytesSize.text"), SizeInBytes);
break;
case KiB:
res = String.format(messages.get("components.fileUtils.kiloSize.text"), (float)(SizeInBytes/KiB));
res = String.format(messages.get("components.fileUtils.kiloSize.text"), SizeInBytes / KiB);
break;
case MiB:
res = String.format(messages.get("components.fileUtils.megaSize.text"), (float)(SizeInBytes/MiB));
res = String.format(messages.get("components.fileUtils.megaSize.text"), SizeInBytes / MiB);
break;
case GiB:
res = String.format(messages.get("components.fileUtils.gigaSize.text"), (float)(SizeInBytes/GiB));
res = String.format(messages.get("components.fileUtils.gigaSize.text"), SizeInBytes / GiB);
break;
default:
res = String.format(messages.get("components.fileUtils.gigaSize.text"), (float)(SizeInBytes/GiB));
res = String.format(messages.get("components.fileUtils.gigaSize.text"), SizeInBytes / GiB);
break;
}
}
/linshare/src/main/java/org/linagora/linshare/core/dao/jackRabbit/BetterRepositoryFactoryBean.java
179,7 → 179,9
try {
replacement = replaceVariables(variables,replacement,false);
} catch (IllegalArgumentException e) {
log.error(e.toString());
if (log.isDebugEnabled()) {
log.debug(e.toString());
}
}
}
 
/linshare/src/main/java/org/linagora/linshare/core/facade/impl/ThreadEntryFacadeImpl.java
309,7 → 309,7
User user = (User) accountService.findByLsUid(newMember.getLsUid());
List<ThreadMemberVo> members = new ArrayList<ThreadMemberVo>();
for (ThreadMemberVo member : members) {
if (member.getUser().getLsUid() == user.getLsUuid()) {
if (member.getUser().getLsUid().equals(user.getLsUuid())) {
// TODO error duplicate member
return;
}
/linshare/src/main/java/org/linagora/linshare/core/facade/impl/AbstractDomainFacadeImpl.java
130,7 → 130,7
 
LdapUserProvider provider = null;
String baseDn = domainVo.getDifferentialKey();
if(baseDn != "" && domainPattern != null && ldapConn != null) {
if (baseDn.isEmpty() && domainPattern != null && ldapConn != null) {
provider = new LdapUserProvider(baseDn, ldapConn, domainPattern);
}
 
511,12 → 511,16
 
} catch (UnsupportedEncodingException e) {
res = false;
logger.debug(e.toString());
} catch (GeneralSecurityException e) {
res = false;
logger.debug(e.toString());
} catch (IOException e) {
res = false;
logger.debug(e.toString());
} catch (Error err) {
res = false;
logger.error(err.toString());
}
 
return res;
585,6 → 589,7
}
} catch (BusinessException e) {
logger.error("domain not found : " + domainIdentifier);
logger.debug(e.toString());
}
}
}
/linshare/src/main/java/org/linagora/linshare/core/facade/impl/ShareFacadeImpl.java
328,6 → 328,7
hasRightsToShareWithExternals = abstractDomainService.hasRightsToShareWithExternals(sender);
} catch (BusinessException e) {
logger.error("Could not retrieve domain of sender while sharing to externals: "+sender.getAccountReprentation());
logger.debug(e.toString());
}
if (hasRightsToShareWithExternals) {
/linshare/src/main/java/org/linagora/linshare/core/domain/entities/MessagesConfiguration.java
108,14 → 108,10
@Override
public boolean equals(Object o1){
if(null==o1 || !(o1 instanceof MessagesConfiguration)){
if (null == o1 || !(o1 instanceof MessagesConfiguration)) {
return false;
}else{
if(o1==this || ((MessagesConfiguration)o1).id==this.id){
return true;
}else{
return false;
}
} else {
return (o1 == this || ((MessagesConfiguration)o1).id == this.id);
}
}
/linshare/src/main/java/org/linagora/linshare/core/domain/entities/AllowedContact.java
45,13 → 45,8
@Override
public boolean equals(Object o) {
if (null != o && o instanceof AllowedContact) {
if (o == this
|| (((AllowedContact) o).getOwner().equals(this.getOwner()) && ((AllowedContact) o)
.getContact().equals(this.getContact()))) {
return true;
} else {
return false;
}
return (o == this || (((AllowedContact) o).getOwner().equals(this.getOwner()) && ((AllowedContact) o)
.getContact().equals(this.getContact())));
} else {
return false;
}
/linshare/src/main/java/org/linagora/linshare/core/domain/entities/RecipientFavourite.java
73,29 → 73,19
this.persistenceId = persistenceId;
}
 
@Override
public boolean equals(Object o){
if(null!=o && o instanceof RecipientFavourite) {
if(o==this
|| (((RecipientFavourite)o).getOwner().equals(this.getOwner())
&& ((RecipientFavourite)o).getRecipient().equals(this.getRecipient())
)){
return true;
}else{
return false;
}
}else{
if(null != o && o instanceof RecipientFavourite) {
return (o == this || (((RecipientFavourite)o).getOwner().equals(this.getOwner())
&& ((RecipientFavourite)o).getRecipient().equals(this.getRecipient())));
} else {
return false;
}
}
 
@Override
public int hashCode(){
return this.getOwner().hashCode()+this.getRecipient().hashCode();
}
 
}
/linshare/src/main/java/org/linagora/linshare/core/domain/entities/MailContainer.java
105,7 → 105,7
return Language.FRENCH;
}
/* java.util.Locale doesn't support dutch */
if (locale.getLanguage() == "nl_NL" || locale.getLanguage() == "nl") {
if (locale.getLanguage().equals("nl_NL") || locale.getLanguage().equals("nl")) {
return Language.DUTCH;
}
return Language.DEFAULT;
/linshare/src/main/java/org/linagora/linshare/core/domain/entities/AnonymousUrl.java
5,8 → 5,6
import java.util.List;
import java.util.Set;
 
import org.linagora.linshare.core.domain.vo.DocumentVo;
 
/**
* @author fred
*
/linshare/src/main/java/org/linagora/linshare/core/domain/entities/ShareExpiryRule.java
97,7 → 97,7
public int compareTo(ShareExpiryRule o ) {
if (null ==o) return 1;
long size1 = ((ShareExpiryRule)o).getShareSizeUnit().getPlainSize(((ShareExpiryRule)o).getShareSize());
long size1 = o.getShareSizeUnit().getPlainSize(o.getShareSize());
long size2 = this.getShareSizeUnit().getPlainSize(this.getShareSize());
if (size1 < size2) {
return 1;
/linshare/src/main/java/org/linagora/linshare/core/domain/vo/AllowedMimeTypeVO.java
83,12 → 83,11
 
@Override
public boolean equals(Object obj) {
if (obj instanceof AllowedMimeTypeVO) {
AllowedMimeTypeVO vo = (AllowedMimeTypeVO) obj;
if(vo.getId()== this.getId()) return true;
else return false;
} else return false;
return (vo.getId()== this.getId());
}
return false;
}
/linshare/src/main/java/org/linagora/linshare/core/domain/transformers/impl/DocumentEntryTransformer.java
42,7 → 42,7
@Override
public DocumentEntry assemble(DocumentVo valueObject) {
if(null!=valueObject){
return (DocumentEntry) documentEntryRepository.findById(valueObject.getIdentifier());
return documentEntryRepository.findById(valueObject.getIdentifier());
}else{
return null;
}
/linshare/src/main/java/org/linagora/linshare/core/domain/transformers/impl/ThreadEntryTransformer.java
40,8 → 40,8
 
@Override
public ThreadEntry assemble(DocumentVo valueObject) {
if(null!=valueObject){
return (ThreadEntry) threadEntryRepository.findByUuid(valueObject.getIdentifier());
if(null != valueObject){
return threadEntryRepository.findByUuid(valueObject.getIdentifier());
}else{
return null;
}
/linshare/src/main/java/org/linagora/linshare/core/batches/impl/DocumentManagementBatchImpl.java
120,6 → 120,7
} catch (BusinessException ex) {
logger.error("Error when processing cleaning of document whith UID = {} during consistency check " +
"process", document.getUuid());
logger.debug(ex.toString());
}
}
}
/linshare/src/main/java/org/linagora/linshare/core/batches/impl/ShareManagementBatchImpl.java
30,8 → 30,6
import org.linagora.linshare.core.domain.entities.AnonymousShareEntry;
import org.linagora.linshare.core.domain.entities.AnonymousUrl;
import org.linagora.linshare.core.domain.entities.DocumentEntry;
import org.linagora.linshare.core.domain.entities.MailContainer;
import org.linagora.linshare.core.domain.entities.Share;
import org.linagora.linshare.core.domain.entities.ShareEntry;
import org.linagora.linshare.core.domain.entities.StringValueFunctionality;
import org.linagora.linshare.core.domain.entities.SystemAccount;
/linshare/src/main/java/org/linagora/linshare/core/business/service/impl/DocumentEntryBusinessServiceImpl.java
119,7 → 119,7
if(checkIfIsCiphered) {
docEntry.setCiphered(checkIfFileIsCiphered(fileName, myFile));
}
entity = (DocumentEntry) documentEntryRepository.create(docEntry);
entity = documentEntryRepository.create(docEntry);
owner.getEntries().add(entity);
accountRepository.update(owner);
327,10 → 327,10
ThreadEntry docEntry = new ThreadEntry(owner, fileName, document);
 
//aes encrypt ? check headers
if(checkIfIsCiphered) {
if (checkIfIsCiphered) {
docEntry.setCiphered(checkIfFileIsCiphered(fileName, myFile));
}
entity = (ThreadEntry) threadEntryRepository.create(docEntry);
entity = threadEntryRepository.create(docEntry);
owner.getEntries().add(entity);
accountRepository.update(owner);
346,7 → 346,7
@Override
public ThreadEntry findThreadEntryById(String docEntryUuid) {
return (ThreadEntry)threadEntryRepository.findByUuid(docEntryUuid);
return threadEntryRepository.findByUuid(docEntryUuid);
}
 
 
485,13 → 485,11
if (logger.isDebugEnabled()) {
logger.debug("insert of the document in jack rabbit:" + fileName + ", size:"+ size + ", path:" + path + " , type: " + mimeType);
}
 
uuid = fileSystemDao.insertFile(path, fis, size, fileName, mimeType);
} catch (FileNotFoundException e1) {
throw new TechnicalException(TechnicalErrorCode.GENERIC,
"couldn't open inputStream on the temporary file");
} finally {
 
try {
logger.debug("closing FileInputStream ");
if (fis != null)
499,8 → 497,8
} catch (IOException e) {
// Do nothing Happy java :)
logger.error("IO exception : should not happen ! ");
logger.error(e.toString());
}
 
}
return uuid;
}
/linshare/src/main/java/org/linagora/linshare/core/business/service/impl/SignatureBusinessServiceImpl.java
85,13 → 85,11
if (logger.isDebugEnabled()) {
logger.debug("insert of the document in jack rabbit:" + fileName + ", size:"+ size + ", path:" + path + " , type: " + mimeType);
}
 
uuid = fileSystemDao.insertFile(path, fis, size, fileName, mimeType);
} catch (FileNotFoundException e1) {
throw new TechnicalException(TechnicalErrorCode.GENERIC,
"couldn't open inputStream on the temporary file");
} finally {
 
try {
logger.debug("closing FileInputStream ");
if (fis != null)
99,8 → 97,8
} catch (IOException e) {
// Do nothing Happy java :)
logger.error("IO exception : should not happen ! ");
logger.error(e.toString());
}
 
}
return uuid;
}
/linshare/src/main/java/org/linagora/linshare/view/tapestry/pages/administration/UserConfig.java
175,6 → 175,7
userFacade.changePassword(userVo, oldUserPassword, newUserPassword);
} catch (BusinessException e) {
changePassword.recordError(messages.get("pages.administration.userconfig.error.wrong.password"));
logger.debug(e.toString());
return false;
}
businessMessagesManagementService.notify(new BusinessUserMessage(BusinessUserMessageType.PASSWORD_CHANGE_SUCCESS, MessageSeverity.INFO));
/linshare/src/main/java/org/linagora/linshare/view/tapestry/pages/administration/Index.java
30,7 → 30,6
import org.apache.tapestry5.annotations.SetupRender;
import org.apache.tapestry5.ioc.Messages;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.ioc.annotations.Symbol;
import org.linagora.linshare.core.domain.vo.UserVo;
import org.linagora.linshare.core.exception.BusinessException;
import org.linagora.linshare.core.facade.AbstractDomainFacade;
129,6 → 128,7
}
} catch (IOException e) {
logger.debug("Impossible to load version.properties, Is this a dev environnement?");
logger.debug(e.toString());
}
if (prop.getProperty("Implementation-Version") != null) {
return prop.getProperty("Implementation-Version");
/linshare/src/main/java/org/linagora/linshare/view/tapestry/pages/administration/domains/ManageDomain.java
58,7 → 58,7
logger.debug("Domain name identifers retrieve:" + domainNames.toString());
return (String[]) domainNames.toArray(new String[domainNames.size()]);
return domainNames.toArray(new String[domainNames.size()]);
}
public Object onException(Throwable cause) {
/linshare/src/main/java/org/linagora/linshare/view/tapestry/pages/administration/domains/CreateDomainPattern.java
70,6 → 70,7
domainPattern.setPatternDescription("");
} catch (BusinessException e) {
domainPattern = null;
logger.debug(e.toString());
}
}
}
/linshare/src/main/java/org/linagora/linshare/view/tapestry/pages/Index.java
50,9 → 50,6
import org.linagora.linshare.core.facade.AbstractDomainFacade;
import org.linagora.linshare.core.facade.ShareFacade;
import org.linagora.linshare.view.tapestry.beans.ShareSessionObjects;
import org.linagora.linshare.view.tapestry.enums.BusinessUserMessageType;
import org.linagora.linshare.view.tapestry.objects.BusinessUserMessage;
import org.linagora.linshare.view.tapestry.services.BusinessMessagesManagementService;
import org.linagora.linshare.view.tapestry.utils.WelcomeMessageUtils;
import org.slf4j.Logger;
 
/linshare/src/main/java/org/linagora/linshare/view/tapestry/pages/signature/SelectKeystore.java
202,7 → 202,7
HttpServletRequest req = requestGlobals.getHTTPServletRequest();
String useragent = (String) req.getHeader("user-agent");
String useragent = req.getHeader("user-agent");
boolean supportBrowser = UserAgent.isBrowserSupported(useragent);
List<KeystoreType> availableKeystore = new ArrayList<KeystoreType>();
/linshare/src/main/java/org/linagora/linshare/view/tapestry/pages/files/Index.java
88,7 → 88,7
@Import(library={"Index.js"})
public class Index {
 
public final static Logger Logger = LoggerFactory.getLogger(Index.class);
public final static Logger logger = LoggerFactory.getLogger(Index.class);
 
@SessionState
@Property
275,6 → 275,7
} catch (BusinessException e) {
shareSessionObjects.addError(String.format(messages.get("pages.index.message.failRemovingFile"),
((DocumentVo)currentObject).getFileName()) );
logger.debug(e.toString());
}
shareSessionObjects.removeDocument((DocumentVo)currentObject);
}
311,10 → 312,10
}
} catch (BusinessException e) {
ko = true;
shareSessionObjects.addError(String.format(messages.get("pages.index.message.failed.crypt"),
(currentObject).getFileName()) );
logger.debug(e.toString());
}
}
341,12 → 342,11
} else {
numberIgnore++; //if it exists an entry which is already encrypted ignore it
}
} catch (BusinessException e) {
ko = true;
shareSessionObjects.addError(String.format(messages.get("pages.index.message.failed.decrypt"),
(currentObject).getFileName()) );
logger.debug(e.toString());
}
}
361,27 → 361,24
* @param object
*/
@OnEvent(value="eventCryptOneDocFromListDocument")
public void cryptOneDoc(Object[] object){
public void cryptOneDoc(Object[] object) {
String pass = (String) object[0];
DocumentVo currentDocumentVo = (DocumentVo) object[1];
 
if(currentDocumentVo.getShared()) {
if (currentDocumentVo.getShared()) {
//do nothing on shared document
shareSessionObjects.addWarning(String.format(messages.get("pages.index.message.failed.crypt.sharedFile"),(currentDocumentVo).getFileName()));
} else {
//ignore already encrypted file
if(!currentDocumentVo.getEncrypted()){
try {
documentFacade.encryptDocument(currentDocumentVo, userVo,pass);
shareSessionObjects.addMessage(messages.get("pages.index.message.success.crypt"));
} catch (BusinessException e) {
shareSessionObjects.addError(String.format(messages.get("pages.index.message.failed.crypt"),
(currentDocumentVo).getFileName()) );
logger.debug(e.toString());
}
}
}
}
405,12 → 402,11
try {
documentFacade.decryptDocument(currentDocumentVo, userVo,pass);
shareSessionObjects.addMessage(messages.get("pages.index.message.success.decrypt"));
} catch (BusinessException e) {
shareSessionObjects.addError(String.format(messages.get("pages.index.message.failed.decrypt"),
(currentDocumentVo).getFileName()) );
logger.debug(e.toString());
}
}
}
}
633,7 → 629,7
Object onException(Throwable cause) {
shareSessionObjects.addError(messages.get("global.exception.message"));
Logger.error(cause.getMessage());
logger.error(cause.getMessage());
cause.printStackTrace();
return this;
}
/linshare/src/main/java/org/linagora/linshare/view/tapestry/pages/thread/ThreadContent.java
270,6 → 270,7
shareSessionObjects.addMessage(String.format(messages.get("pages.index.message.fileRemoved"), selectedVo.getFileName()));
} catch (BusinessException e) {
shareSessionObjects.addError(String.format(messages.get("pages.index.message.failRemovingFile"), selectedVo.getFileName()) );
logger.debug(e.toString());
}
}
 
/linshare/src/main/java/org/linagora/linshare/view/tapestry/utils/WelcomeMessageUtils.java
46,7 → 46,7
return Language.FRENCH;
}
/* java.util.Locale doesn't support dutch */
if (locale.getLanguage() == "nl_NL" || locale.getLanguage() == "nl") {
if (locale.getLanguage().equals("nl_NL") || locale.getLanguage().equals("nl")) {
return Language.DUTCH;
}
return Language.DEFAULT;
/linshare/src/main/java/org/linagora/linshare/view/tapestry/components/ListSharedDocument.java
429,6 → 429,7
} catch (BusinessException e) {
businessMessagesManagementService.notify(new BusinessUserMessage(BusinessUserMessageType.DECRYPTION_FAILED,
MessageSeverity.WARNING));
logger.debug(e.toString());
}
}
504,11 → 505,7
*
*/
public boolean isEmptyList(){
if(null==shareDocuments || shareDocuments.isEmpty()){
return true;
}else{
return false;
}
return (null == shareDocuments || shareDocuments.isEmpty());
}
/**
/linshare/src/main/java/org/linagora/linshare/view/tapestry/components/ConfirmSubmitPopup.java
81,11 → 81,9
}
 
public void onActionFromConfirmsubmitPopupYes() {
return;
}
public void onActionFromConfirmsubmitPopupNo() {
return;
}
public String getJSONId() {
/linshare/src/main/java/org/linagora/linshare/view/tapestry/components/SearchFile.java
307,6 → 307,7
}
}catch(NumberFormatException e){
advancedSearchForm.recordError(messages.get("components.searchfile.errors.size.notNumeric"));
logger.debug(e.toString());
}
}else{
try{
316,17 → 317,12
 
}catch(NumberFormatException e){
advancedSearchForm.recordError(messages.get("components.searchfile.errors.size.notNumeric"));
logger.debug(e.toString());
}
}
 
 
 
 
}
 
 
 
 
/**
* AutoCompletion for name field.
* @param value the value entered by the user
/linshare/src/main/java/org/linagora/linshare/view/tapestry/components/ActionsBarShare.java
27,7 → 27,6
import org.apache.tapestry5.annotations.SetupRender;
import org.apache.tapestry5.annotations.SupportsInformalParameters;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.ioc.annotations.Symbol;
import org.linagora.linshare.core.domain.vo.UserVo;
import org.linagora.linshare.core.exception.BusinessException;
import org.linagora.linshare.core.facade.AbstractDomainFacade;
/linshare/src/main/java/org/linagora/linshare/view/tapestry/components/ThreadEditForm.java
147,8 → 147,10
componentResources.triggerEvent("resetListFiles", null, null);
} catch (IllegalArgumentException e) {
onFailure();
logger.debug(e.toString());
} catch (BusinessException e) {
onFailure();
logger.debug(e.toString());
}
}
201,6 → 203,7
shareComment = share.getFileComment();
} catch (BusinessException e) {
logger.error("share not found : " + editShareWithUuid);
logger.debug(e.toString());
}
}
}
/linshare/src/main/java/org/linagora/linshare/view/tapestry/components/ListThreadDocument.java
264,6 → 264,7
try {
return null != threadEntryFacade.findById(user, threadVo, threadEntry.getIdentifier());
} catch(BusinessException e) {
logger.debug(e.toString());
return false;
}
}
/linshare/src/main/java/org/linagora/linshare/view/tapestry/components/UserEditForm.java
379,6 → 379,7
shareSessionObjects.addMessage(messages.get("components.userEditForm.action.update.confirm"));
} catch (BusinessException e) {
shareSessionObjects.addError(messages.get("components.guestEditForm.action.update.guestRestriction.badUser"));
logger.debug(e.toString());
}
}
 
/linshare/src/main/java/org/linagora/linshare/view/tapestry/components/ListDocument.java
725,11 → 725,7
*
*/
public boolean isEmptyList() {
if (null == documents || documents.isEmpty()) {
return true;
} else {
return false;
}
return (null == documents || documents.isEmpty());
}
 
public boolean isDocumentSignedByCurrentUser() {
/linshare/src/main/java/org/linagora/linshare/view/tapestry/components/GuestEditForm.java
327,6 → 327,7
}
shareSessionObjects.addMessage(messages.get("components.guestEditForm.action.add.confirm"));
} catch (BusinessException e) { //bad contact for contacts list
logger.debug(e.toString());
shareSessionObjects.addError(messages.get("components.guestEditForm.action.add.guestRestriction.badUser"));
List<String> contactMailList = new ArrayList<String>();
contactMailList.add(userLoggedIn.getMail());
/linshare/src/main/java/org/linagora/linshare/view/tapestry/components/Help.java
43,6 → 43,8
import org.linagora.linshare.view.tapestry.objects.HelpsASO;
import org.linagora.linshare.view.tapestry.objects.Subsection;
import org.linagora.linshare.view.tapestry.services.BusinessMessagesManagementService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
 
/**
* This component permits to display all help categories.
57,8 → 59,8
@Import(library = {"Help.js"})
public class Help {
 
private static Logger logger = LoggerFactory.getLogger(Help.class);
 
 
@SessionState
private HelpsASO helpsASO;
334,6 → 336,7
* We do nothing, just set the asset to null, for checking if the asset exist or not.
*/
imgAsset=null;
logger.debug(exception.toString());
}
String subsectionTitle=messagesComponent.get(subsection+i+"."+TITLE_PREFIX);
String imgTitle=(imgAsset!=null) ? messagesComponent.get(subsection+i+"."+IMAGE_TITLE):null;
353,6 → 356,7
* We do nothing, just set the asset to null, for checking if the asset exist or not.
*/
videoAsset=null;
logger.debug(exception.toString());
}
if(videoAsset==null){
videoUrl=null;
/linshare/src/main/java/org/linagora/linshare/view/tapestry/components/ShareEditForm.java
169,8 → 169,10
componentResources.triggerEvent("resetListFiles", null, null);
} catch (IllegalArgumentException e) {
onFailure();
logger.debug(e.toString());
} catch (BusinessException e) {
onFailure();
logger.debug(e.toString());
}
}
223,6 → 225,7
shareComment = share.getFileComment();
} catch (BusinessException e) {
logger.error("share not found : " + editShareWithUuid);
logger.debug(e.toString());
}
}
}