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

View File

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

View File

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

View File

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

View File

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