Remove tabs after code check for ACE-3118

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@88149 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2014-10-15 13:18:46 +00:00
parent b9c9f3adba
commit 5da1fe3385
6 changed files with 248 additions and 248 deletions

View File

@@ -191,16 +191,16 @@ public abstract class AbstractContentDataDAOImpl implements ContentDataDAO
{
throw new IllegalArgumentException("Cannot look up ContentData by null ID.");
}
Pair<Long, ContentUrlEntity> pair = contentUrlCache.getByValue(contentUrl);
if(pair != null)
{
contentUrlCache.updateValue(pair.getFirst(), contentUrl);
}
else
{
pair = contentUrlCache.getOrCreateByValue(contentUrl);
contentUrlCache.updateValue(pair.getFirst(), contentUrl);
}
Pair<Long, ContentUrlEntity> pair = contentUrlCache.getByValue(contentUrl);
if(pair != null)
{
contentUrlCache.updateValue(pair.getFirst(), contentUrl);
}
else
{
pair = contentUrlCache.getOrCreateByValue(contentUrl);
contentUrlCache.updateValue(pair.getFirst(), contentUrl);
}
}
@Override
@@ -212,8 +212,8 @@ public abstract class AbstractContentDataDAOImpl implements ContentDataDAO
}
ContentUrlEntity entity = new ContentUrlEntity();
entity.setContentUrl(contentUrl);
Pair<Long, ContentUrlEntity> pair = contentUrlCache.getByValue(entity);
return (pair == null ? null : pair.getSecond());
Pair<Long, ContentUrlEntity> pair = contentUrlCache.getByValue(entity);
return (pair == null ? null : pair.getSecond());
}
@Override
@@ -223,8 +223,8 @@ public abstract class AbstractContentDataDAOImpl implements ContentDataDAO
{
throw new IllegalArgumentException("Cannot look up ContentData by null ID.");
}
Pair<Long, ContentUrlEntity> pair = contentUrlCache.getByKey(contentUrlId);
return (pair == null ? null : pair.getSecond());
Pair<Long, ContentUrlEntity> pair = contentUrlCache.getByKey(contentUrlId);
return (pair == null ? null : pair.getSecond());
}
public void cacheContentDataForNodes(Set<Long> nodeIds)
@@ -334,21 +334,21 @@ public abstract class AbstractContentDataDAOImpl implements ContentDataDAO
@Override
public Pair<Long, ContentUrlEntity> findByValue(ContentUrlEntity entity)
{
String contentUrl = entity.getContentUrl();
ContentUrlEntity ret = getContentUrlEntity(contentUrl);
return (ret != null ? new Pair<Long, ContentUrlEntity>(ret.getId(), ret) : null);
String contentUrl = entity.getContentUrl();
ContentUrlEntity ret = getContentUrlEntity(contentUrl);
return (ret != null ? new Pair<Long, ContentUrlEntity>(ret.getId(), ret) : null);
}
public Pair<Long, ContentUrlEntity> createValue(ContentUrlEntity value)
{
ContentUrlEntity contentUrlEntity = createContentUrlEntity(value.getContentUrl(), value.getSize(), value.getContentUrlKey());
ContentUrlEntity contentUrlEntity = createContentUrlEntity(value.getContentUrl(), value.getSize(), value.getContentUrlKey());
// Done
return new Pair<Long, ContentUrlEntity>(contentUrlEntity.getId(), contentUrlEntity);
}
public Pair<Long, ContentUrlEntity> findByKey(Long id)
{
ContentUrlEntity contentUrlEntity = getContentUrlEntity(id);
ContentUrlEntity contentUrlEntity = getContentUrlEntity(id);
if (contentUrlEntity == null)
{
return null;
@@ -371,7 +371,7 @@ public abstract class AbstractContentDataDAOImpl implements ContentDataDAO
@Override
public int deleteByKey(Long id)
{
return deleteContentUrlEntity(id);
return deleteContentUrlEntity(id);
}
}
@@ -381,18 +381,18 @@ public abstract class AbstractContentDataDAOImpl implements ContentDataDAO
private ContentData makeContentData(ContentDataEntity contentDataEntity)
{
// Decode content URL
Long contentUrlId = contentDataEntity.getContentUrlId();
String contentUrl = null;
if(contentUrlId != null)
{
Pair<Long, ContentUrlEntity> entityPair = contentUrlCache.getByKey(contentUrlId);
if (entityPair == null)
{
throw new DataIntegrityViolationException("No ContentUrl value exists for ID " + contentUrlId);
}
ContentUrlEntity contentUrlEntity = entityPair.getSecond();
contentUrl = contentUrlEntity.getContentUrl();
}
Long contentUrlId = contentDataEntity.getContentUrlId();
String contentUrl = null;
if(contentUrlId != null)
{
Pair<Long, ContentUrlEntity> entityPair = contentUrlCache.getByKey(contentUrlId);
if (entityPair == null)
{
throw new DataIntegrityViolationException("No ContentUrl value exists for ID " + contentUrlId);
}
ContentUrlEntity contentUrlEntity = entityPair.getSecond();
contentUrl = contentUrlEntity.getContentUrl();
}
long size = contentDataEntity.getSize() == null ? 0L : contentDataEntity.getSize().longValue();
@@ -437,11 +437,11 @@ public abstract class AbstractContentDataDAOImpl implements ContentDataDAO
long size = contentData.getSize();
if (contentUrl != null)
{
ContentUrlEntity contentUrlEntity = new ContentUrlEntity();
contentUrlEntity.setContentUrl(contentUrl);
contentUrlEntity.setSize(size);
Pair<Long, ContentUrlEntity> pair = contentUrlCache.getOrCreateByValue(contentUrlEntity);
contentUrlId = pair.getFirst();
ContentUrlEntity contentUrlEntity = new ContentUrlEntity();
contentUrlEntity.setContentUrl(contentUrl);
contentUrlEntity.setSize(size);
Pair<Long, ContentUrlEntity> pair = contentUrlCache.getOrCreateByValue(contentUrlEntity);
contentUrlId = pair.getFirst();
}
// Resolve the mimetype
@@ -482,12 +482,12 @@ public abstract class AbstractContentDataDAOImpl implements ContentDataDAO
ContentUrlEntity contentUrlEntity = null;
if(oldContentUrlId != null)
{
Pair<Long, ContentUrlEntity> entityPair = contentUrlCache.getByKey(oldContentUrlId);
if (entityPair == null)
{
throw new DataIntegrityViolationException("No ContentUrl value exists for ID " + oldContentUrlId);
}
contentUrlEntity = entityPair.getSecond();
Pair<Long, ContentUrlEntity> entityPair = contentUrlCache.getByKey(oldContentUrlId);
if (entityPair == null)
{
throw new DataIntegrityViolationException("No ContentUrl value exists for ID " + oldContentUrlId);
}
contentUrlEntity = entityPair.getSecond();
}
String oldContentUrl = (contentUrlEntity != null ? contentUrlEntity.getContentUrl() : null);
@@ -501,15 +501,15 @@ public abstract class AbstractContentDataDAOImpl implements ContentDataDAO
}
if (newContentUrl != null)
{
if(contentUrlEntity == null)
{
contentUrlEntity = new ContentUrlEntity();
contentUrlEntity.setContentUrl(newContentUrl);
}
Pair<Long, ContentUrlEntity> pair = contentUrlCache.getOrCreateByValue(contentUrlEntity);
Long newContentUrlId = pair.getFirst();
contentUrlEntity.setId(newContentUrlId);
contentDataEntity.setContentUrlId(newContentUrlId);
if(contentUrlEntity == null)
{
contentUrlEntity = new ContentUrlEntity();
contentUrlEntity.setContentUrl(newContentUrl);
}
Pair<Long, ContentUrlEntity> pair = contentUrlCache.getOrCreateByValue(contentUrlEntity);
Long newContentUrlId = pair.getFirst();
contentUrlEntity.setId(newContentUrlId);
contentDataEntity.setContentUrlId(newContentUrlId);
}
else
{

View File

@@ -45,7 +45,7 @@ public class ContentDataEntity
{
}
@Override
@Override
public int hashCode()
{
return (id == null ? 0 : id.hashCode());
@@ -69,7 +69,7 @@ public class ContentDataEntity
}
}
@Override
@Override
public String toString()
{
StringBuilder sb = new StringBuilder(512);

View File

@@ -36,10 +36,10 @@ import org.alfresco.util.Pair;
public class ContentUrlEntity implements Serializable
{
/**
*
*/
private static final long serialVersionUID = -7697859151521433536L;
public static final Long CONST_LONG_ZERO = new Long(0L);
*
*/
private static final long serialVersionUID = -7697859151521433536L;
public static final Long CONST_LONG_ZERO = new Long(0L);
public static final String EMPTY_URL = "empty";
private Long id;
@@ -124,29 +124,29 @@ public class ContentUrlEntity implements Serializable
public ContentUrlKeyEntity getContentUrlKey()
{
return contentUrlKey;
}
return contentUrlKey;
}
public static ContentUrlEntity setContentUrlKey(ContentUrlEntity existing, ContentUrlKeyEntity contentUrlKey)
{
ContentUrlEntity ret = new ContentUrlEntity();
ret.setContentUrl(existing == null ? null : existing.getContentUrl());
ret.setContentUrlShort(existing == null ? null : existing.getContentUrlShort());
ret.setContentUrlCrc(existing == null ? null : existing.getContentUrlCrc());
ret.setContentUrlKey(contentUrlKey);
ret.setOrphanTime(existing == null ? null : existing.getOrphanTime());
ret.setSize(existing == null ? null : existing.getSize());
ret.setId(existing == null ? null : existing.getId());
public static ContentUrlEntity setContentUrlKey(ContentUrlEntity existing, ContentUrlKeyEntity contentUrlKey)
{
ContentUrlEntity ret = new ContentUrlEntity();
ret.setContentUrl(existing == null ? null : existing.getContentUrl());
ret.setContentUrlShort(existing == null ? null : existing.getContentUrlShort());
ret.setContentUrlCrc(existing == null ? null : existing.getContentUrlCrc());
ret.setContentUrlKey(contentUrlKey);
ret.setOrphanTime(existing == null ? null : existing.getOrphanTime());
ret.setSize(existing == null ? null : existing.getSize());
ret.setId(existing == null ? null : existing.getId());
// done
return ret;
}
}
public void setContentUrlKey(ContentUrlKeyEntity contentUrlKey)
{
this.contentUrlKey = contentUrlKey;
}
public void setContentUrlKey(ContentUrlKeyEntity contentUrlKey)
{
this.contentUrlKey = contentUrlKey;
}
public Long getId()
public Long getId()
{
return id;
}

View File

@@ -32,11 +32,11 @@ import org.apache.commons.codec.DecoderException;
*/
public class ContentUrlKeyEntity implements Serializable
{
private static final long serialVersionUID = -6594309522849585169L;
private static final long serialVersionUID = -6594309522849585169L;
private Long id;
private Long contentUrlId;
private byte[] encryptedKeyAsBytes;
private Long id;
private Long contentUrlId;
private byte[] encryptedKeyAsBytes;
private Integer keySize;
private String algorithm;
private String masterKeystoreId;
@@ -49,121 +49,121 @@ public class ContentUrlKeyEntity implements Serializable
public ContentUrlKey getContentUrlKey() throws DecoderException
{
ContentUrlKey contentUrlKey = new ContentUrlKey();
contentUrlKey.setAlgorithm(algorithm);
contentUrlKey.setKeySize(keySize);
contentUrlKey.setEncryptedKeyBytes(ByteBuffer.wrap(encryptedKeyAsBytes));
contentUrlKey.setMasterKeyAlias(masterKeyAlias);
contentUrlKey.setMasterKeystoreId(masterKeystoreId);
contentUrlKey.setUnencryptedFileSize(unencryptedFileSize);
return contentUrlKey;
ContentUrlKey contentUrlKey = new ContentUrlKey();
contentUrlKey.setAlgorithm(algorithm);
contentUrlKey.setKeySize(keySize);
contentUrlKey.setEncryptedKeyBytes(ByteBuffer.wrap(encryptedKeyAsBytes));
contentUrlKey.setMasterKeyAlias(masterKeyAlias);
contentUrlKey.setMasterKeystoreId(masterKeystoreId);
contentUrlKey.setUnencryptedFileSize(unencryptedFileSize);
return contentUrlKey;
}
public Long getContentUrlId()
public Long getContentUrlId()
{
return contentUrlId;
}
public void setContentUrlId(Long contentUrlId)
{
this.contentUrlId = contentUrlId;
}
public void setEncryptedKeyAsBytes(byte[] encryptedKeyAsBytes)
{
this.encryptedKeyAsBytes = encryptedKeyAsBytes;
}
public byte[] getEncryptedKeyAsBytes()
{
return encryptedKeyAsBytes;
}
public void updateEncryptedKey(EncryptedKey encryptedKey)
{
byte[] encryptedKeyAsBytes = new byte[encryptedKey.getByteBuffer().remaining()];
encryptedKey.getByteBuffer().get(encryptedKeyAsBytes);
this.encryptedKeyAsBytes = encryptedKeyAsBytes;
setKeySize(encryptedKeyAsBytes.length*8);
setAlgorithm(encryptedKey.getAlgorithm());
setMasterKeyAlias(encryptedKey.getMasterKeyAlias());
setMasterKeystoreId(encryptedKey.getMasterKeystoreId());
return contentUrlId;
}
public Long getId()
{
return id;
}
public void setContentUrlId(Long contentUrlId)
{
this.contentUrlId = contentUrlId;
}
public void setId(Long id)
{
this.id = id;
}
public EncryptedKey getEncryptedKey() throws DecoderException
{
EncryptedKey encryptedKey = new EncryptedKey(getMasterKeystoreId(), getMasterKeyAlias(),
getAlgorithm(), ByteBuffer.wrap(this.encryptedKeyAsBytes));
return encryptedKey;
}
public void setEncryptedKeyAsBytes(byte[] encryptedKeyAsBytes)
{
this.encryptedKeyAsBytes = encryptedKeyAsBytes;
}
public Long getUnencryptedFileSize()
{
return unencryptedFileSize;
}
public byte[] getEncryptedKeyAsBytes()
{
return encryptedKeyAsBytes;
}
public void setUnencryptedFileSize(Long unencryptedFileSize)
{
this.unencryptedFileSize = unencryptedFileSize;
}
public void updateEncryptedKey(EncryptedKey encryptedKey)
{
byte[] encryptedKeyAsBytes = new byte[encryptedKey.getByteBuffer().remaining()];
encryptedKey.getByteBuffer().get(encryptedKeyAsBytes);
this.encryptedKeyAsBytes = encryptedKeyAsBytes;
setKeySize(encryptedKeyAsBytes.length*8);
setAlgorithm(encryptedKey.getAlgorithm());
setMasterKeyAlias(encryptedKey.getMasterKeyAlias());
setMasterKeystoreId(encryptedKey.getMasterKeystoreId());
}
public void setKeySize(Integer keySize)
{
this.keySize = keySize;
}
public Long getId()
{
return id;
}
public Integer getKeySize()
{
return keySize;
}
public void setId(Long id)
{
this.id = id;
}
public EncryptedKey getEncryptedKey() throws DecoderException
{
EncryptedKey encryptedKey = new EncryptedKey(getMasterKeystoreId(), getMasterKeyAlias(),
getAlgorithm(), ByteBuffer.wrap(this.encryptedKeyAsBytes));
return encryptedKey;
}
public String getAlgorithm()
{
return algorithm;
}
public Long getUnencryptedFileSize()
{
return unencryptedFileSize;
}
public void setAlgorithm(String algorithm)
{
this.algorithm = algorithm;
}
public void setUnencryptedFileSize(Long unencryptedFileSize)
{
this.unencryptedFileSize = unencryptedFileSize;
}
public String getMasterKeystoreId()
{
return masterKeystoreId;
}
public void setKeySize(Integer keySize)
{
this.keySize = keySize;
}
public void setMasterKeystoreId(String masterKeystoreId)
{
this.masterKeystoreId = masterKeystoreId;
}
public Integer getKeySize()
{
return keySize;
}
public String getMasterKeyAlias()
{
return masterKeyAlias;
}
public String getAlgorithm()
{
return algorithm;
}
public void setMasterKeyAlias(String masterKeyAlias)
{
this.masterKeyAlias = masterKeyAlias;
}
public void setAlgorithm(String algorithm)
{
this.algorithm = algorithm;
}
@Override
public String toString()
{
return "ContentUrlKeyEntity [id=" + id + ", encryptedKeyAsBytes="
+ encryptedKeyAsBytes+ ", keySize=" + keySize + ", algorithm="
+ algorithm + ", masterKeystoreId=" + masterKeystoreId
+ ", masterKeyAlias=" + masterKeyAlias
+ ", unencryptedFileSize=" + unencryptedFileSize + "]";
}
public String getMasterKeystoreId()
{
return masterKeystoreId;
}
public void setMasterKeystoreId(String masterKeystoreId)
{
this.masterKeystoreId = masterKeystoreId;
}
public String getMasterKeyAlias()
{
return masterKeyAlias;
}
public void setMasterKeyAlias(String masterKeyAlias)
{
this.masterKeyAlias = masterKeyAlias;
}
@Override
public String toString()
{
return "ContentUrlKeyEntity [id=" + id + ", encryptedKeyAsBytes="
+ encryptedKeyAsBytes+ ", keySize=" + keySize + ", algorithm="
+ algorithm + ", masterKeystoreId=" + masterKeystoreId
+ ", masterKeyAlias=" + masterKeyAlias
+ ", unencryptedFileSize=" + unencryptedFileSize + "]";
}
}

View File

@@ -5,51 +5,51 @@ import java.nio.ByteBuffer;
public class EncryptedKey implements Serializable
{
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
private String masterKeystoreId;
private String masterKeyAlias;
private final String algorithm;
private final ByteBuffer encryptedKeyBytes;
public EncryptedKey(String masterKeystoreId, String masterKeyAlias, String algorithm, ByteBuffer encryptedKeyBytes)
{
this.masterKeyAlias = masterKeyAlias;
this.masterKeystoreId = masterKeystoreId;
this.algorithm = algorithm;
this.encryptedKeyBytes = encryptedKeyBytes.asReadOnlyBuffer();
}
private String masterKeystoreId;
private String masterKeyAlias;
private final String algorithm;
private final ByteBuffer encryptedKeyBytes;
public EncryptedKey(String masterKeystoreId, String masterKeyAlias, String algorithm, ByteBuffer encryptedKeyBytes)
{
this.masterKeyAlias = masterKeyAlias;
this.masterKeystoreId = masterKeystoreId;
this.algorithm = algorithm;
this.encryptedKeyBytes = encryptedKeyBytes.asReadOnlyBuffer();
}
public String getMasterKeystoreId()
{
return masterKeystoreId;
}
public String getMasterKeystoreId()
{
return masterKeystoreId;
}
public String getMasterKeyAlias()
{
return masterKeyAlias;
}
public String getMasterKeyAlias()
{
return masterKeyAlias;
}
public ByteBuffer getEncryptedKeyBytes()
{
return encryptedKeyBytes;
}
public ByteBuffer getEncryptedKeyBytes()
{
return encryptedKeyBytes;
}
public String getAlgorithm()
{
return this.algorithm;
}
public ByteBuffer getByteBuffer()
{
return this.encryptedKeyBytes.asReadOnlyBuffer();
}
public String getAlgorithm()
{
return this.algorithm;
}
public ByteBuffer getByteBuffer()
{
return this.encryptedKeyBytes.asReadOnlyBuffer();
}
public int keySize()
{
byte[] eKey = new byte[getByteBuffer().remaining()];
getByteBuffer().get(eKey);
return eKey.length * 8;
}
public int keySize()
{
byte[] eKey = new byte[getByteBuffer().remaining()];
getByteBuffer().get(eKey);
return eKey.length * 8;
}
}

View File

@@ -16,39 +16,39 @@ import java.io.Serializable;
*/
public class SymmetricKeyCount implements Serializable
{
private static final long serialVersionUID = -7823962733045613866L;
private static final long serialVersionUID = -7823962733045613866L;
private String masterKeyAlias;
private int count;
private String masterKeyAlias;
private int count;
public SymmetricKeyCount()
{
}
public SymmetricKeyCount()
{
}
public String getMasterKeyAlias()
{
return masterKeyAlias;
}
public String getMasterKeyAlias()
{
return masterKeyAlias;
}
public void setMasterKeyAlias(String masterKeyAlias)
{
this.masterKeyAlias = masterKeyAlias;
}
public void setMasterKeyAlias(String masterKeyAlias)
{
this.masterKeyAlias = masterKeyAlias;
}
public int getCount()
{
return count;
}
public int getCount()
{
return count;
}
public void setCount(int count)
{
this.count = count;
}
public void setCount(int count)
{
this.count = count;
}
@Override
public String toString()
{
return "SymmetricKeyCount [masterKeyAlias=" + masterKeyAlias
+ ", count=" + count + "]";
}
@Override
public String toString()
{
return "SymmetricKeyCount [masterKeyAlias=" + masterKeyAlias
+ ", count=" + count + "]";
}
}