mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V3.0 to HEAD
12083: Fix for ETHREEOH-790 - when using external auth such as NTLM the Change Password and Logout features are no longer available in the Share UI. 12085: ETHREEOH-565: Failure to generate flash preview for PPT file 12086: ETHREEOH-903 Sites drop-down Favorites UI improvements ETHREEOH-904 My Sites dashlet Favorites UI improvements ETHREEOH-547 User who is not a site manager can delete sites: my sites dashlet and sites page 12093: ETHREEOH-861, ETHREEOH-928 12094: Remove __MACOSX folder that has appeared in Share webapp 12096: Removed spurious files from YUI 2.6.0 distribution 12100: ETHREEOH-929 Tightening up transport adapters field (should never be shown for ASR) 12104: Fix for ETHREEOH-944. Admin now able to reset user home location again ((regression). 12105: Fixed: ETHREEOH-934 Multi-clicking Site favoriate icons can cause multiple requests before others finish and effectively cause a browser lock-up until page refresh 12106: Exception needs to be rethrown after releasing packet to the memory pool on a Winsock NetBIOS receive. ETHREEOH-628. 12110: An i18n message didn't work for failures. Related to ETHREEOH-934 Multi-clicking Site favoriate icons can cause multiple requests before others finish and effectively cause a browser lock-up until page refresh 12115: Added unit test to check for cm:folder-derived type support 12116: Removed unused, old patch-related query 12117: Merged V2.2 to V3.0 11454: Fixed ASH-7: QName fetching is inefficient when run without L2 cache 12118: Fixed compilation error after merge 12119: DM User Usages - 2nd pass (fix ETHREEOH-677) 12122: UserUsage does nothing if system is READ-ONLY. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12500 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -2335,6 +2335,7 @@ public class AVMRepository
|
||||
* The sql 'like' pattern, inserted into a QName.
|
||||
* @return A Map of the matching key value pairs.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Map<QName, PropertyValue> queryStorePropertyKey(String store, QName keyPattern)
|
||||
{
|
||||
AVMStore st = getAVMStoreByName(store);
|
||||
@@ -2342,15 +2343,14 @@ public class AVMRepository
|
||||
{
|
||||
throw new AVMNotFoundException("Store not found.");
|
||||
}
|
||||
List<AVMStoreProperty> matches =
|
||||
fAVMStorePropertyDAO.queryByKeyPattern(st,
|
||||
keyPattern);
|
||||
Map<QName, PropertyValue> results = new HashMap<QName, PropertyValue>();
|
||||
List<AVMStoreProperty> matches = fAVMStorePropertyDAO.queryByKeyPattern(st, keyPattern);
|
||||
Map<Long, PropertyValue> matchesMap = new HashMap<Long, PropertyValue>();
|
||||
for (AVMStoreProperty prop : matches)
|
||||
{
|
||||
results.put(prop.getName().getQName(), prop.getValue());
|
||||
matchesMap.put(prop.getQnameId(), prop.getValue());
|
||||
}
|
||||
return results;
|
||||
Map<QName, PropertyValue> propertyMap = (Map<QName, PropertyValue>) qnameDAO.convertIdMapToQNameMap(matchesMap);
|
||||
return propertyMap;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2363,20 +2363,19 @@ public class AVMRepository
|
||||
public Map<String, Map<QName, PropertyValue>>
|
||||
queryStoresPropertyKeys(QName keyPattern)
|
||||
{
|
||||
List<AVMStoreProperty> matches =
|
||||
fAVMStorePropertyDAO.queryByKeyPattern(keyPattern);
|
||||
Map<String, Map<QName, PropertyValue>> results =
|
||||
new HashMap<String, Map<QName, PropertyValue>>();
|
||||
List<AVMStoreProperty> matches = fAVMStorePropertyDAO.queryByKeyPattern(keyPattern);
|
||||
Map<String, Map<QName, PropertyValue>> results = new HashMap<String, Map<QName, PropertyValue>>();
|
||||
for (AVMStoreProperty prop : matches)
|
||||
{
|
||||
String storeName = prop.getStore().getName();
|
||||
QName propQName = qnameDAO.getQName(prop.getQnameId()).getSecond();
|
||||
Map<QName, PropertyValue> pairs = null;
|
||||
if ((pairs = results.get(storeName)) == null)
|
||||
{
|
||||
pairs = new HashMap<QName, PropertyValue>();
|
||||
results.put(storeName, pairs);
|
||||
}
|
||||
pairs.put(prop.getName().getQName(), prop.getValue());
|
||||
pairs.put(propQName, prop.getValue());
|
||||
}
|
||||
return results;
|
||||
}
|
||||
@@ -3203,20 +3202,16 @@ public class AVMRepository
|
||||
context.addDynamicAuthorityAssignment(AVMNodeUnwrapper.Unwrap(node).getBasicAttributes().getOwner(), PermissionService.OWNER_AUTHORITY);
|
||||
|
||||
// Pass in node aspects
|
||||
Set<Long> nodeAspectQNameIds = node.getAspects();
|
||||
Set<QName> nodeAspectQNames = qnameDAO.convertIdsToQNames(node.getAspects());
|
||||
Set<QName> contextQNames = context.getAspects();
|
||||
for (Long nodeAspectQNameId : nodeAspectQNameIds)
|
||||
{
|
||||
QName qname = qnameDAO.getQName(nodeAspectQNameId);
|
||||
contextQNames.add(qname);
|
||||
}
|
||||
contextQNames.addAll(nodeAspectQNames);
|
||||
// Pass in node properties
|
||||
Map<Long, PropertyValue> nodeProperties = node.getProperties();
|
||||
Map<QName, Serializable> contextProperties = new HashMap<QName, Serializable>(5);
|
||||
QNameDAO qnameDAO = AVMDAOs.Instance().fQNameDAO;
|
||||
for (Map.Entry<Long, PropertyValue> entry : nodeProperties.entrySet())
|
||||
{
|
||||
QName qname = qnameDAO.getQName(entry.getKey());
|
||||
QName qname = qnameDAO.getQName(entry.getKey()).getSecond();
|
||||
PropertyDefinition def = fDictionaryService.getProperty(qname);
|
||||
if (def == null)
|
||||
{
|
||||
|
@@ -42,9 +42,8 @@ import org.alfresco.repo.avm.util.RawServices;
|
||||
import org.alfresco.repo.avm.util.SimplePath;
|
||||
import org.alfresco.repo.domain.DbAccessControlList;
|
||||
import org.alfresco.repo.domain.PropertyValue;
|
||||
import org.alfresco.repo.security.permissions.ACLCopyMode;
|
||||
import org.alfresco.repo.domain.QNameDAO;
|
||||
import org.alfresco.repo.domain.QNameEntity;
|
||||
import org.alfresco.repo.security.permissions.ACLCopyMode;
|
||||
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
||||
import org.alfresco.service.cmr.avm.AVMBadArgumentException;
|
||||
import org.alfresco.service.cmr.avm.AVMException;
|
||||
@@ -373,7 +372,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
||||
Set<Long> aspectQNameEntityIds = newDir.getAspects();
|
||||
for (QName aspectQName : aspects)
|
||||
{
|
||||
Long qnameEntityId = qnameDAO.getOrCreateQNameEntity(aspectQName).getId();
|
||||
Long qnameEntityId = qnameDAO.getOrCreateQName(aspectQName).getFirst();
|
||||
aspectQNameEntityIds.add(qnameEntityId);
|
||||
}
|
||||
}
|
||||
@@ -384,7 +383,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
||||
Map<Long, PropertyValue> propertiesByQNameEntityId = new HashMap<Long, PropertyValue>(properties.size() * 2 + 1);
|
||||
for (Map.Entry<QName, PropertyValue> entry : properties.entrySet())
|
||||
{
|
||||
Long qnameEntityId = qnameDAO.getOrCreateQNameEntity(entry.getKey()).getId();
|
||||
Long qnameEntityId = qnameDAO.getOrCreateQName(entry.getKey()).getFirst();
|
||||
propertiesByQNameEntityId.put(qnameEntityId, entry.getValue());
|
||||
}
|
||||
newDir.getProperties().putAll(propertiesByQNameEntityId);
|
||||
@@ -524,7 +523,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
||||
Set<Long> aspectQNameEntityIds = file.getAspects();
|
||||
for (QName aspectQName : aspects)
|
||||
{
|
||||
Long qnameEntityId = qnameDAO.getOrCreateQNameEntity(aspectQName).getId();
|
||||
Long qnameEntityId = qnameDAO.getOrCreateQName(aspectQName).getFirst();
|
||||
aspectQNameEntityIds.add(qnameEntityId);
|
||||
}
|
||||
}
|
||||
@@ -535,7 +534,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
||||
Map<Long, PropertyValue> propertiesByQNameEntityId = new HashMap<Long, PropertyValue>(properties.size() * 2 + 1);
|
||||
for (Map.Entry<QName, PropertyValue> entry : properties.entrySet())
|
||||
{
|
||||
Long qnameEntityId = qnameDAO.getOrCreateQNameEntity(entry.getKey()).getId();
|
||||
Long qnameEntityId = qnameDAO.getOrCreateQName(entry.getKey()).getFirst();
|
||||
propertiesByQNameEntityId.put(qnameEntityId, entry.getValue());
|
||||
}
|
||||
file.getProperties().putAll(propertiesByQNameEntityId);
|
||||
@@ -1217,9 +1216,9 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
||||
{
|
||||
throw new AccessDeniedException("Not allowed to write: " + path);
|
||||
}
|
||||
QNameEntity qnameEntity = AVMDAOs.Instance().fQNameDAO.getOrCreateQNameEntity(name);
|
||||
Long qnameEntityId = AVMDAOs.Instance().fQNameDAO.getOrCreateQName(name).getFirst();
|
||||
|
||||
node.setProperty(qnameEntity.getId(), value);
|
||||
node.setProperty(qnameEntityId, value);
|
||||
node.setGuid(GUID.generate());
|
||||
}
|
||||
|
||||
@@ -1247,7 +1246,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
||||
Map<Long, PropertyValue> propertiesByQNameEntityId = new HashMap<Long, PropertyValue>(properties.size() * 2 + 1);
|
||||
for (Map.Entry<QName, PropertyValue> entry : properties.entrySet())
|
||||
{
|
||||
Long qnameEntityId = qnameDAO.getOrCreateQNameEntity(entry.getKey()).getId();
|
||||
Long qnameEntityId = qnameDAO.getOrCreateQName(entry.getKey()).getFirst();
|
||||
propertiesByQNameEntityId.put(qnameEntityId, entry.getValue());
|
||||
}
|
||||
node.addProperties(propertiesByQNameEntityId);
|
||||
@@ -1276,15 +1275,15 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
||||
}
|
||||
// Convert the QName
|
||||
QNameDAO qnameDAO = AVMDAOs.Instance().fQNameDAO;
|
||||
QNameEntity qnameEntity = qnameDAO.getOrCreateQNameEntity(name);
|
||||
if (qnameEntity == null)
|
||||
Pair<Long, QName> qnamePair = qnameDAO.getQName(name);
|
||||
if (qnamePair == null)
|
||||
{
|
||||
// No such QName
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
PropertyValue prop = node.getProperty(qnameEntity.getId());
|
||||
PropertyValue prop = node.getProperty(qnamePair.getFirst());
|
||||
return prop;
|
||||
}
|
||||
}
|
||||
@@ -1335,14 +1334,15 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
||||
node.setGuid(GUID.generate());
|
||||
|
||||
// convert the QName
|
||||
QNameEntity qnameEntity = AVMDAOs.Instance().fQNameDAO.getQNameEntity(name);
|
||||
if (qnameEntity == null)
|
||||
QNameDAO qnameDAO = AVMDAOs.Instance().fQNameDAO;
|
||||
Pair<Long, QName> qnamePair = qnameDAO.getQName(name);
|
||||
if (qnamePair == null)
|
||||
{
|
||||
// No such property
|
||||
}
|
||||
else
|
||||
{
|
||||
node.deleteProperty(qnameEntity.getId());
|
||||
node.deleteProperty(qnamePair.getFirst());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1373,10 +1373,10 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
||||
*/
|
||||
public void setProperty(QName name, PropertyValue value)
|
||||
{
|
||||
QNameEntity qnameEntity = AVMDAOs.Instance().fQNameDAO.getOrCreateQNameEntity(name);
|
||||
Long qnameEntityId = AVMDAOs.Instance().fQNameDAO.getOrCreateQName(name).getFirst();
|
||||
AVMStoreProperty prop = new AVMStorePropertyImpl();
|
||||
prop.setStore(this);
|
||||
prop.setName(qnameEntity);
|
||||
prop.setQnameId(qnameEntityId);
|
||||
prop.setValue(value);
|
||||
AVMDAOs.Instance().fAVMStorePropertyDAO.save(prop);
|
||||
}
|
||||
@@ -1412,16 +1412,21 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
||||
* Get all the properties associated with this node.
|
||||
* @return A Map of the properties.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Map<QName, PropertyValue> getProperties()
|
||||
{
|
||||
List<AVMStoreProperty> props =
|
||||
AVMDAOs.Instance().fAVMStorePropertyDAO.get(this);
|
||||
Map<QName, PropertyValue> retVal = new HashMap<QName, PropertyValue>();
|
||||
List<AVMStoreProperty> props = AVMDAOs.Instance().fAVMStorePropertyDAO.get(this);
|
||||
|
||||
Map<Long, PropertyValue> propsIdMap = new HashMap<Long, PropertyValue>(props.size() + 7);
|
||||
for (AVMStoreProperty prop : props)
|
||||
{
|
||||
retVal.put(prop.getName().getQName(), prop.getValue());
|
||||
propsIdMap.put(prop.getQnameId(), prop.getValue());
|
||||
}
|
||||
return retVal;
|
||||
// Mass-convert
|
||||
QNameDAO qnameDAO = AVMDAOs.Instance().fQNameDAO;
|
||||
Map<QName, PropertyValue> propsQNameMap = (Map<QName, PropertyValue>) qnameDAO.convertIdMapToQNameMap(propsIdMap);
|
||||
|
||||
return propsQNameMap;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1553,7 +1558,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
||||
}
|
||||
// Convert the aspect QNames to entities
|
||||
QNameDAO qnameDAO = AVMDAOs.Instance().fQNameDAO;
|
||||
Long qnameEntityId = qnameDAO.getOrCreateQNameEntity(aspectName).getId();
|
||||
Long qnameEntityId = qnameDAO.getOrCreateQName(aspectName).getFirst();
|
||||
// Convert the
|
||||
node.getAspects().add(qnameEntityId);
|
||||
node.setGuid(GUID.generate());
|
||||
@@ -1602,18 +1607,19 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
||||
}
|
||||
QNameDAO qnameDAO = AVMDAOs.Instance().fQNameDAO;
|
||||
// Get the persistent ID for the QName and remove from the set
|
||||
QNameEntity qnameEntity = qnameDAO.getQNameEntity(aspectName);
|
||||
if (qnameEntity != null)
|
||||
Pair<Long, QName> qnamePair = qnameDAO.getQName(aspectName);
|
||||
if (qnamePair != null)
|
||||
{
|
||||
node.getAspects().remove(qnameEntity.getId());
|
||||
node.getAspects().remove(qnamePair.getFirst());
|
||||
}
|
||||
AspectDefinition def = RawServices.Instance().getDictionaryService().getAspect(aspectName);
|
||||
Map<QName, PropertyDefinition> properties =
|
||||
def.getProperties();
|
||||
for (QName name : properties.keySet())
|
||||
Map<QName, PropertyDefinition> properties = def.getProperties();
|
||||
Set<Long> propertyQNameIds = qnameDAO.convertQNamesToIds(properties.keySet(), false);
|
||||
|
||||
Map<Long, PropertyValue> nodeProperties = node.getProperties();
|
||||
for (Long propertyQNameId : propertyQNameIds)
|
||||
{
|
||||
QNameEntity propertyQNameEntity = qnameDAO.getQNameEntity(name);
|
||||
node.getProperties().remove(propertyQNameEntity.getId());
|
||||
nodeProperties.remove(propertyQNameId);
|
||||
}
|
||||
node.setGuid(GUID.generate());
|
||||
}
|
||||
@@ -1639,10 +1645,10 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
||||
}
|
||||
QNameDAO qnameDAO = AVMDAOs.Instance().fQNameDAO;
|
||||
// Get the persistent ID for the QName and remove from the set
|
||||
QNameEntity qnameEntity = qnameDAO.getQNameEntity(aspectName);
|
||||
if (qnameEntity != null)
|
||||
Pair<Long, QName> qnamePair = qnameDAO.getQName(aspectName);
|
||||
if (qnamePair != null)
|
||||
{
|
||||
return node.getAspects().contains(qnameEntity.getId());
|
||||
return node.getAspects().contains(qnamePair.getFirst());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1750,12 +1756,12 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
||||
toLink.setVersionID(child.getVersionID() + 1);
|
||||
// TODO This really shouldn't be here. Leaking layers.
|
||||
QNameDAO qnameDAO = AVMDAOs.Instance().fQNameDAO;
|
||||
QNameEntity revertedQNameEntity = qnameDAO.getOrCreateQNameEntity(WCMModel.ASPECT_REVERTED);
|
||||
toLink.getAspects().add(revertedQNameEntity.getId());
|
||||
Pair<Long, QName> revertedQNamePair = qnameDAO.getOrCreateQName(WCMModel.ASPECT_REVERTED);
|
||||
toLink.getAspects().add(revertedQNamePair.getFirst());
|
||||
PropertyValue value = new PropertyValue(null, toRevertTo.getId());
|
||||
|
||||
QNameEntity qnameEntity = AVMDAOs.Instance().fQNameDAO.getOrCreateQNameEntity(WCMModel.PROP_REVERTED_ID);
|
||||
toLink.setProperty(qnameEntity.getId(), value);
|
||||
Pair<Long, QName> qnamePair = AVMDAOs.Instance().fQNameDAO.getOrCreateQName(WCMModel.PROP_REVERTED_ID);
|
||||
toLink.setProperty(qnamePair.getFirst(), value);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@@ -24,7 +24,6 @@
|
||||
package org.alfresco.repo.avm;
|
||||
|
||||
import org.alfresco.repo.domain.PropertyValue;
|
||||
import org.alfresco.repo.domain.QNameEntity;
|
||||
|
||||
/**
|
||||
* Arbitrary properties associated with AVMStores.
|
||||
@@ -45,16 +44,18 @@ public interface AVMStoreProperty
|
||||
public AVMStore getStore();
|
||||
|
||||
/**
|
||||
* Set the name of the property.
|
||||
* @param qnameEntity The QNameEntity for the property.
|
||||
* Set the property type.
|
||||
*
|
||||
* @param qnameId the ID of the property QName
|
||||
*/
|
||||
public void setName(QNameEntity qnameEntity);
|
||||
public void setQnameId(Long qnameId);
|
||||
|
||||
/**
|
||||
* Get the name of this property.
|
||||
* @return The QNameEntity of this property.
|
||||
* Get the property type.
|
||||
*
|
||||
* @return returns the ID of the property QName
|
||||
*/
|
||||
public QNameEntity getName();
|
||||
public Long getQnameId();
|
||||
|
||||
/**
|
||||
* Set the actual property value.
|
||||
|
@@ -26,7 +26,6 @@ package org.alfresco.repo.avm;
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.repo.domain.PropertyValue;
|
||||
import org.alfresco.repo.domain.QNameEntity;
|
||||
|
||||
/**
|
||||
* Simple bean to hold properties attached to AVMStores.
|
||||
@@ -49,7 +48,7 @@ class AVMStorePropertyImpl implements AVMStoreProperty, Serializable
|
||||
/**
|
||||
* The name of the property.
|
||||
*/
|
||||
private QNameEntity name;
|
||||
private Long qnameId;
|
||||
|
||||
/**
|
||||
* The actual PropertyValue.
|
||||
@@ -63,17 +62,17 @@ class AVMStorePropertyImpl implements AVMStoreProperty, Serializable
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public QNameEntity getName()
|
||||
public Long getQnameId()
|
||||
{
|
||||
return name;
|
||||
return qnameId;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void setName(QNameEntity name)
|
||||
public void setQnameId(Long qnameId)
|
||||
{
|
||||
this.name = name;
|
||||
this.qnameId = qnameId;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -142,13 +141,13 @@ class AVMStorePropertyImpl implements AVMStoreProperty, Serializable
|
||||
return false;
|
||||
}
|
||||
AVMStoreProperty o = (AVMStoreProperty)other;
|
||||
return fStore.equals(o.getStore()) && name.equals(o.getName());
|
||||
return fStore.equals(o.getStore()) && qnameId.equals(o.getQnameId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return fStore.hashCode() + name.hashCode();
|
||||
return fStore.hashCode() + qnameId.hashCode();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -49,12 +49,12 @@
|
||||
<set name="aspects" fetch="join" lazy="false" table="avm_aspects" cascade="all" optimistic-lock="true">
|
||||
<cache usage="read-write"/>
|
||||
<key column="node_id" not-null="true" foreign-key="fk_avm_nasp_n"/>
|
||||
<element column="qname_id" type="long" not-null="true"/>
|
||||
<element column="qname_id" type="long" not-null="true"/> <!-- fk_avm_nasp_qn -->
|
||||
</set>
|
||||
<map name="properties" fetch="join" lazy="false" table="avm_node_properties" cascade="all" optimistic-lock="true">
|
||||
<cache usage="read-write"/>
|
||||
<key column="node_id" not-null="true" foreign-key="fk_avm_nprop_n"/>
|
||||
<map-key column="qname_id" type="long" />
|
||||
<map-key column="qname_id" type="long" /> <!-- fk_avm_nprop_qn -->
|
||||
<composite-element class="org.alfresco.repo.domain.PropertyValue">
|
||||
<property name="actualType" column="actual_type_n" type="integer" not-null="true" />
|
||||
<property name="persistedType" column="persisted_type_n" type="integer" not-null="true" />
|
||||
@@ -151,16 +151,7 @@
|
||||
<generator class="native"/>
|
||||
</id>
|
||||
<many-to-one name="store" class="AVMStoreImpl" column="avm_store_id" foreign-key="fk_avm_sprop_store"/>
|
||||
<many-to-one
|
||||
name="name"
|
||||
class="org.alfresco.repo.domain.hibernate.QNameEntityImpl"
|
||||
column="qname_id"
|
||||
foreign-key="fk_avm_sprop_qname"
|
||||
lazy="proxy"
|
||||
fetch="select"
|
||||
unique="false"
|
||||
not-null="true"
|
||||
cascade="none" />
|
||||
<property name="qnameId" column="qname_id" type="long" not-null="true" /> <!-- fk_avm_sprop_qname -->
|
||||
<component class="org.alfresco.repo.domain.PropertyValue" name="value">
|
||||
<property name="actualType" column="actual_type_n" type="integer" not-null="true" />
|
||||
<property name="persistedType" column="persisted_type_n" type="integer" not-null="true" />
|
||||
@@ -342,4 +333,48 @@
|
||||
]]>
|
||||
</query>
|
||||
|
||||
<sql-query name="avm.GetStorePropertiesByKeyPattern">
|
||||
<return alias="asp" class="AVMStorePropertyImpl"/>
|
||||
SELECT
|
||||
{asp.*}
|
||||
FROM
|
||||
avm_store_properties asp
|
||||
JOIN alf_qname qn ON (qn.id = asp.qname_id)
|
||||
JOIN alf_namespace ns ON (ns.id = qn.ns_id)
|
||||
WHERE
|
||||
ns.uri LIKE :uri AND
|
||||
qn.local_name LIKE :localName
|
||||
</sql-query>
|
||||
|
||||
<sql-query name="avm.GetStorePropertiesByStoreAndKeyPattern">
|
||||
<return alias="asp" class="AVMStorePropertyImpl"/>
|
||||
SELECT
|
||||
{asp.*}
|
||||
FROM
|
||||
avm_store_properties asp
|
||||
JOIN alf_qname qn ON (qn.id = asp.qname_id)
|
||||
JOIN alf_namespace ns ON (ns.id = qn.ns_id)
|
||||
WHERE
|
||||
asp.avm_store_id = :storeId AND
|
||||
ns.uri LIKE :uri AND
|
||||
qn.local_name LIKE :localName
|
||||
</sql-query>
|
||||
|
||||
<sql-query name="avm.DeleteStorePropertiesByType">
|
||||
DELETE
|
||||
FROM
|
||||
avm_store_properties asp
|
||||
WHERE
|
||||
asp.avm_store_id = :storeId AND
|
||||
asp.qname_id = :qnameId
|
||||
</sql-query>
|
||||
|
||||
<sql-query name="avm.DeleteStoreProperties">
|
||||
DELETE
|
||||
FROM
|
||||
avm_store_properties asp
|
||||
WHERE
|
||||
asp.avm_store_id = :storeId
|
||||
</sql-query>
|
||||
|
||||
</hibernate-mapping>
|
||||
|
@@ -29,8 +29,8 @@ import org.alfresco.repo.avm.AVMStore;
|
||||
import org.alfresco.repo.avm.AVMStoreProperty;
|
||||
import org.alfresco.repo.avm.AVMStorePropertyDAO;
|
||||
import org.alfresco.repo.domain.QNameDAO;
|
||||
import org.alfresco.repo.domain.QNameEntity;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.Pair;
|
||||
import org.hibernate.Query;
|
||||
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
||||
|
||||
@@ -67,8 +67,8 @@ class AVMStorePropertyDAOHibernate extends HibernateDaoSupport implements AVMSto
|
||||
*/
|
||||
public AVMStoreProperty get(AVMStore store, QName name)
|
||||
{
|
||||
QNameEntity qnameEntity = qnameDAO.getQNameEntity(name);
|
||||
if (qnameEntity == null)
|
||||
Pair<Long, QName> qnamePair = qnameDAO.getQName(name);
|
||||
if (qnamePair == null)
|
||||
{
|
||||
// No such QName
|
||||
return null;
|
||||
@@ -81,9 +81,9 @@ class AVMStorePropertyDAOHibernate extends HibernateDaoSupport implements AVMSto
|
||||
"from AVMStorePropertyImpl asp " +
|
||||
"where " +
|
||||
"asp.store = :store and " +
|
||||
"asp.name = :name");
|
||||
"asp.qnameId = :qnameId");
|
||||
query.setEntity("store", store);
|
||||
query.setEntity("name", qnameEntity);
|
||||
query.setLong("qnameId", qnamePair.getFirst());
|
||||
return (AVMStoreProperty)query.uniqueResult();
|
||||
}
|
||||
}
|
||||
@@ -122,19 +122,20 @@ class AVMStorePropertyDAOHibernate extends HibernateDaoSupport implements AVMSto
|
||||
{
|
||||
localName = "%";
|
||||
}
|
||||
Query query =
|
||||
getSession().createQuery(
|
||||
"select asp " +
|
||||
"from AVMStorePropertyImpl asp " +
|
||||
"join asp.name name " +
|
||||
"join name.namespace namespace " +
|
||||
"where " +
|
||||
"asp.store = :store and " +
|
||||
"namespace.safeUri like :uri and " +
|
||||
"name.localName like :localName");
|
||||
query.setEntity("store", store);
|
||||
Query query = getSession().getNamedQuery("avm.GetStorePropertiesByStoreAndKeyPattern");
|
||||
query.setLong("storeId", store.getId());
|
||||
query.setParameter("uri", uri);
|
||||
query.setParameter("localName", localName);
|
||||
// Query query =
|
||||
// getSession().createQuery(
|
||||
// "select asp " +
|
||||
// "from AVMStorePropertyImpl asp " +
|
||||
// "join asp.name name " +
|
||||
// "join name.namespace namespace " +
|
||||
// "where " +
|
||||
// "asp.store = :store and " +
|
||||
// "namespace.safeUri like :uri and " +
|
||||
// "name.localName like :localName");
|
||||
return (List<AVMStoreProperty>)query.list();
|
||||
}
|
||||
|
||||
@@ -157,17 +158,20 @@ class AVMStorePropertyDAOHibernate extends HibernateDaoSupport implements AVMSto
|
||||
{
|
||||
localName = "%";
|
||||
}
|
||||
Query query =
|
||||
getSession().createQuery(
|
||||
"select asp " +
|
||||
"from AVMStorePropertyImpl asp " +
|
||||
"join asp.name name " +
|
||||
"join name.namespace namespace " +
|
||||
"where " +
|
||||
"namespace.safeUri like :uri and " +
|
||||
"name.localName like :localName");
|
||||
query.setParameter("uri", uri);
|
||||
query.setParameter("localName", localName);
|
||||
Query query = getSession().getNamedQuery("avm.GetStorePropertiesByKeyPattern");
|
||||
query.setParameter("uri", uri);
|
||||
query.setParameter("localName", localName);
|
||||
// Query query =
|
||||
// getSession().createQuery(
|
||||
// "select asp " +
|
||||
// "from AVMStorePropertyImpl asp " +
|
||||
// "join asp.name name " +
|
||||
// "join name.namespace namespace " +
|
||||
// "where " +
|
||||
// "namespace.safeUri like :uri and " +
|
||||
// "name.localName like :localName");
|
||||
// query.setParameter("uri", uri);
|
||||
// query.setParameter("localName", localName);
|
||||
return (List<AVMStoreProperty>)query.list();
|
||||
}
|
||||
|
||||
@@ -187,14 +191,12 @@ class AVMStorePropertyDAOHibernate extends HibernateDaoSupport implements AVMSto
|
||||
*/
|
||||
public void delete(AVMStore store, QName name)
|
||||
{
|
||||
QNameEntity qnameEntity = qnameDAO.getQNameEntity(name);
|
||||
if (qnameEntity != null)
|
||||
Pair<Long, QName> qnamePair = qnameDAO.getQName(name);
|
||||
if (qnamePair != null)
|
||||
{
|
||||
Query delete =
|
||||
getSession().createQuery("delete from AVMStorePropertyImpl asp " +
|
||||
"where asp.store = :store and asp.name = :name");
|
||||
delete.setEntity("store", store);
|
||||
delete.setParameter("name", qnameEntity);
|
||||
Query delete = getSession().getNamedQuery("avm.DeleteStorePropertiesByType");
|
||||
delete.setParameter("storeId", store.getId());
|
||||
delete.setParameter("qnameId", qnamePair.getFirst());
|
||||
delete.executeUpdate();
|
||||
}
|
||||
}
|
||||
@@ -205,9 +207,8 @@ class AVMStorePropertyDAOHibernate extends HibernateDaoSupport implements AVMSto
|
||||
*/
|
||||
public void delete(AVMStore store)
|
||||
{
|
||||
Query delete =
|
||||
getSession().createQuery("delete from AVMStorePropertyImpl asp where asp.store = :store");
|
||||
delete.setEntity("store", store);
|
||||
Query delete = getSession().getNamedQuery("avm.DeleteStoreProperties");
|
||||
delete.setParameter("storeId", store.getId());
|
||||
delete.executeUpdate();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user