Made hard coded attributes of AVMStore into Properties.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3377 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park 2006-07-21 23:03:19 +00:00
parent 24e1b31567
commit a6fc3aef83
5 changed files with 11 additions and 78 deletions

View File

@ -464,6 +464,7 @@ class AVMRepository
{ {
AVMContext.fgInstance.fNewInAVMStoreDAO.delete(newGuy); AVMContext.fgInstance.fNewInAVMStoreDAO.delete(newGuy);
} }
AVMContext.fgInstance.fAVMStorePropertyDAO.delete(store);
AVMContext.fgInstance.fAVMStoreDAO.delete(store); AVMContext.fgInstance.fAVMStoreDAO.delete(store);
} }

View File

@ -2093,13 +2093,13 @@ public class AVMServiceTest extends AVMServiceTestBase
props.put(n3, p3); props.put(n3, p3);
fService.setStoreProperties("main", props); fService.setStoreProperties("main", props);
props = fService.getStoreProperties("main"); props = fService.getStoreProperties("main");
assertEquals(4, props.size()); assertEquals(6, props.size());
assertEquals(p1.toString(), props.get(n1).toString()); assertEquals(p1.toString(), props.get(n1).toString());
assertEquals(p2.toString(), props.get(n2).toString()); assertEquals(p2.toString(), props.get(n2).toString());
assertEquals(p3.toString(), props.get(n3).toString()); assertEquals(p3.toString(), props.get(n3).toString());
fService.deleteStoreProperty("main", name); fService.deleteStoreProperty("main", name);
props = fService.getStoreProperties("main"); props = fService.getStoreProperties("main");
assertEquals(3, props.size()); assertEquals(5, props.size());
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -230,30 +230,6 @@ public interface AVMStore
*/ */
public void purgeVersion(int version); public void purgeVersion(int version);
/**
* Set the creator.
* @param creator
*/
public void setCreator(String creator);
/**
* Get the creator.
* @return The creator.
*/
public String getCreator();
/**
* Set the create date.
* @param date
*/
public void setCreateDate(long date);
/**
* Get the create date.
* @return The create date.
*/
public long getCreateDate();
/** /**
* Get the descriptor for this. * Get the descriptor for this.
* @return The descriptor. * @return The descriptor.

View File

@ -30,7 +30,9 @@ import java.util.Map;
import java.util.SortedMap; import java.util.SortedMap;
import java.util.TreeMap; import java.util.TreeMap;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.domain.PropertyValue; import org.alfresco.repo.domain.PropertyValue;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
/** /**
@ -68,16 +70,6 @@ public class AVMStoreImpl implements AVMStore, Serializable
*/ */
transient private AVMRepository fAVMRepository; transient private AVMRepository fAVMRepository;
/**
* The creator.
*/
private String fCreator;
/**
* The create date.
*/
private long fCreateDate;
/** /**
* Default constructor. * Default constructor.
*/ */
@ -98,9 +90,9 @@ public class AVMStoreImpl implements AVMStore, Serializable
fName = name; fName = name;
fNextVersionID = 0; fNextVersionID = 0;
fRoot = null; fRoot = null;
fCreator = "britt";
fCreateDate = System.currentTimeMillis();
AVMContext.fgInstance.fAVMStoreDAO.save(this); AVMContext.fgInstance.fAVMStoreDAO.save(this);
setProperty(ContentModel.PROP_CREATOR, new PropertyValue(null, "britt"));
setProperty(ContentModel.PROP_CREATED, new PropertyValue(null, new Date(System.currentTimeMillis())));
// Make up the initial version record and save. // Make up the initial version record and save.
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
fRoot = new PlainDirectoryNodeImpl(this); fRoot = new PlainDirectoryNodeImpl(this);
@ -765,49 +757,15 @@ public class AVMStoreImpl implements AVMStore, Serializable
} }
} }
/**
* Get the create date.
* @return The create date.
*/
public long getCreateDate()
{
return fCreateDate;
}
/**
* Get the creator.
* @return The creator.
*/
public String getCreator()
{
return fCreator;
}
/**
* Set the create date.
* @param date
*/
public void setCreateDate(long date)
{
fCreateDate = date;
}
/**
* Set the creator.
* @param creator
*/
public void setCreator(String creator)
{
fCreator = creator;
}
/** /**
* Get the descriptor for this. * Get the descriptor for this.
* @return An AVMStoreDescriptor * @return An AVMStoreDescriptor
*/ */
public AVMStoreDescriptor getDescriptor() public AVMStoreDescriptor getDescriptor()
{ {
return new AVMStoreDescriptor(fName, fCreator, fCreateDate); return new AVMStoreDescriptor(fName,
getProperty(ContentModel.PROP_CREATOR).getStringValue(),
((Date)getProperty(ContentModel.PROP_CREATED).getValue(DataTypeDefinition.DATE)).getTime());
} }
/** /**

View File

@ -106,15 +106,13 @@
Each store has it's own branch ids and layer ids but shares node ids Each store has it's own branch ids and layer ids but shares node ids
with other repositories. The physical repository is structured this way with other repositories. The physical repository is structured this way
for better scaling. --> for better scaling. -->
<class table="avm_repositories" name="AVMStoreImpl" <class table="avm_stores" name="AVMStoreImpl"
proxy="AVMStore" optimistic-lock="version"> proxy="AVMStore" optimistic-lock="version">
<cache usage="read-write"/> <cache usage="read-write"/>
<id name="name" column="name" type="string"/> <id name="name" column="name" type="string"/>
<version name="vers" column="vers" type="long"/> <version name="vers" column="vers" type="long"/>
<property type="int" name="nextVersionID" <property type="int" name="nextVersionID"
column="next_version_id" not-null="true"/> column="next_version_id" not-null="true"/>
<property type="string" name="creator" column="creator" not-null="true"/>
<property type="long" name="createDate" column="create_date" not-null="true"/>
<!-- Every AVMStore has a root directory that is the current root directory. --> <!-- Every AVMStore has a root directory that is the current root directory. -->
<!-- This should be not-null but hibernate (or my own idiocy) makes that difficult. --> <!-- This should be not-null but hibernate (or my own idiocy) makes that difficult. -->
<many-to-one name="root" class="DirectoryNodeImpl" <many-to-one name="root" class="DirectoryNodeImpl"