mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Merged V2.2 to HEAD
8146: Interim checkin for Oracle upgrade scripts. 8150: AR-1905 8151: AR-1956 8152: Correct I18N when reporting patch description 8153: QName script for Oracle along with fixes for unique constraints on assoc tables 8155: Upgrade scripts for Oracle V2.2 - almost there 8164: AWC-1633: Unable to edit rule added via web service 8166: V2.2 upgrade scripts for MySQL and Oracle 8170: AWC-1515: E-mail doesn't reach user's mail box, if it was created with the help of templates 8174: Fix for AWC-798 8180: Fix for AWC-1843 8183: Fixes for different unique index names on alf_child_assoc 8189: AWC-1719: Need to alllow Rules to account for a space being deleted 8249: Fixed handling of empty namespaces on Oracle 8259: Fixes for null namespaces in QName 8360: Modified alf_audit_date columns and added patch 8404: Fix AR-2133: Fix handling of empty namespaces during upgrade git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8481 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -776,6 +776,11 @@ public class ActionServiceImpl implements ActionService, RuntimeActionService, A
|
||||
ActionModel.TYPE_ACTION,
|
||||
props).getChildRef();
|
||||
|
||||
// Update the created details and the node reference
|
||||
((ActionImpl)action).setCreator((String)this.nodeService.getProperty(actionNodeRef, ContentModel.PROP_CREATOR));
|
||||
((ActionImpl)action).setCreatedDate((Date)this.nodeService.getProperty(actionNodeRef, ContentModel.PROP_CREATED));
|
||||
((ActionImpl)action).setNodeRef(actionNodeRef);
|
||||
|
||||
saveActionImpl(actionNodeRef, action);
|
||||
}
|
||||
}
|
||||
|
@@ -274,7 +274,11 @@ public class PatchServiceImpl implements PatchService
|
||||
// perform actual execution
|
||||
try
|
||||
{
|
||||
logger.info(I18NUtil.getMessage(MSG_APPLYING_PATCH, patch.getId(), patch.getDescription()));
|
||||
String msg = I18NUtil.getMessage(
|
||||
MSG_APPLYING_PATCH,
|
||||
patch.getId(),
|
||||
I18NUtil.getMessage(patch.getDescription()));
|
||||
logger.info(msg);
|
||||
report = patch.apply();
|
||||
success = true;
|
||||
}
|
||||
|
@@ -75,8 +75,8 @@
|
||||
<property name="weekOfMonth" column="week_of_month" type="integer" index="idx_alf_adtd_wom" not-null="true"/>
|
||||
<property name="month" column="month" type="integer" index="idx_alf_adtd_m" not-null="true"/>
|
||||
<property name="quarter" column="quarter" type="integer" index="idx_alf_adtd_q" not-null="true"/>
|
||||
<property name="halfYear" column="halfYear" type="integer" index="idx_alf_adtd_hy" not-null="true"/>
|
||||
<property name="year" column="year" type="integer" index="idx_alf_adtd_y" not-null="true"/>
|
||||
<property name="halfYear" column="half_year" type="integer" index="idx_alf_adtd_hy" not-null="true"/>
|
||||
<property name="fullYear" column="full_year" type="integer" index="idx_alf_adtd_fy" not-null="true"/>
|
||||
|
||||
</class>
|
||||
|
||||
|
@@ -33,82 +33,59 @@ import java.util.Date;
|
||||
*/
|
||||
public interface AuditDate
|
||||
{
|
||||
|
||||
/**
|
||||
* Get the date
|
||||
*
|
||||
* @return
|
||||
* @return the date object
|
||||
*/
|
||||
public abstract Date getDate();
|
||||
|
||||
/**
|
||||
* Get the day of the year.
|
||||
*
|
||||
* @return
|
||||
* @return the day of the year
|
||||
*/
|
||||
public abstract int getDayOfYear();
|
||||
|
||||
/**
|
||||
* Get the day of the month.
|
||||
*
|
||||
* @return
|
||||
* @return the day of the month
|
||||
*/
|
||||
public abstract int getDayOfMonth();
|
||||
|
||||
/**
|
||||
* Get the day of the week
|
||||
*
|
||||
* @return
|
||||
* @return the day of the week
|
||||
*/
|
||||
public abstract int getDayOfWeek();
|
||||
|
||||
/**
|
||||
* Get the half year;
|
||||
*
|
||||
* @return
|
||||
* @return the half year
|
||||
*/
|
||||
public abstract int getHalfYear();
|
||||
|
||||
|
||||
/**
|
||||
* Get the surrogate key
|
||||
*
|
||||
* @return
|
||||
* @return the surrogate key
|
||||
*/
|
||||
public abstract long getId();
|
||||
|
||||
/**
|
||||
* Get the month
|
||||
*
|
||||
* @return
|
||||
* @return the month of the year
|
||||
*/
|
||||
public abstract int getMonth();
|
||||
|
||||
/**
|
||||
* Get the quarter
|
||||
*
|
||||
* @return
|
||||
* @return the quarter in the year
|
||||
*/
|
||||
public abstract int getQuarter();
|
||||
|
||||
/**
|
||||
* Get the week of the month.
|
||||
*
|
||||
* @return
|
||||
* @return the week of the month
|
||||
*/
|
||||
public abstract int getWeekOfMonth();
|
||||
|
||||
/**
|
||||
* Get the week of the year.
|
||||
*
|
||||
* @return
|
||||
* @return the week of the year
|
||||
*/
|
||||
public abstract int getWeekOfYear();
|
||||
|
||||
/**
|
||||
* Get the year.
|
||||
* @return
|
||||
* @return the full year
|
||||
*/
|
||||
public abstract int getYear();
|
||||
|
||||
public abstract int getFullYear();
|
||||
}
|
@@ -92,7 +92,7 @@ public class AuditDateImpl implements AuditDate
|
||||
/**
|
||||
* The year
|
||||
*/
|
||||
private int year;
|
||||
private int fullYear;
|
||||
|
||||
protected AuditDateImpl()
|
||||
{
|
||||
@@ -105,9 +105,6 @@ public class AuditDateImpl implements AuditDate
|
||||
setDate(date);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.audit.hibernate.AuditDate#getDate()
|
||||
*/
|
||||
public Date getDate()
|
||||
{
|
||||
return date;
|
||||
@@ -131,12 +128,9 @@ public class AuditDateImpl implements AuditDate
|
||||
this.setQuarter((getMonth()/3));
|
||||
this.setWeekOfMonth(cal.get(Calendar.WEEK_OF_MONTH));
|
||||
this.setWeekOfYear(cal.get(Calendar.WEEK_OF_YEAR));
|
||||
this.setYear(cal.get(Calendar.YEAR));
|
||||
this.setFullYear(cal.get(Calendar.YEAR));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.audit.hibernate.AuditDate#getDayOfYear()
|
||||
*/
|
||||
public int getDayOfYear()
|
||||
{
|
||||
return dayOfYear;
|
||||
@@ -147,9 +141,6 @@ public class AuditDateImpl implements AuditDate
|
||||
this.dayOfYear = dayOfYear;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.audit.hibernate.AuditDate#getDayOfMonth()
|
||||
*/
|
||||
public int getDayOfMonth()
|
||||
{
|
||||
return dayOfMonth;
|
||||
@@ -160,9 +151,6 @@ public class AuditDateImpl implements AuditDate
|
||||
this.dayOfMonth = dayOfMonth;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.audit.hibernate.AuditDate#getDayOfWeek()
|
||||
*/
|
||||
public int getDayOfWeek()
|
||||
{
|
||||
return dayOfWeek;
|
||||
@@ -173,9 +161,6 @@ public class AuditDateImpl implements AuditDate
|
||||
this.dayOfWeek = dayOfWeek;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.audit.hibernate.AuditDate#getHalfYear()
|
||||
*/
|
||||
public int getHalfYear()
|
||||
{
|
||||
return halfYear;
|
||||
@@ -186,9 +171,6 @@ public class AuditDateImpl implements AuditDate
|
||||
this.halfYear = halfYear;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.audit.hibernate.AuditDate#getId()
|
||||
*/
|
||||
public long getId()
|
||||
{
|
||||
return id;
|
||||
@@ -199,9 +181,6 @@ public class AuditDateImpl implements AuditDate
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.audit.hibernate.AuditDate#getMonth()
|
||||
*/
|
||||
public int getMonth()
|
||||
{
|
||||
return month;
|
||||
@@ -212,9 +191,6 @@ public class AuditDateImpl implements AuditDate
|
||||
this.month = month;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.audit.hibernate.AuditDate#getQuarter()
|
||||
*/
|
||||
public int getQuarter()
|
||||
{
|
||||
return quarter;
|
||||
@@ -225,9 +201,6 @@ public class AuditDateImpl implements AuditDate
|
||||
this.quarter = quarter;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.audit.hibernate.AuditDate#getWeekOfMonth()
|
||||
*/
|
||||
public int getWeekOfMonth()
|
||||
{
|
||||
return weekOfMonth;
|
||||
@@ -238,9 +211,6 @@ public class AuditDateImpl implements AuditDate
|
||||
this.weekOfMonth = weekOfMonth;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.audit.hibernate.AuditDate#getWeekOfYear()
|
||||
*/
|
||||
public int getWeekOfYear()
|
||||
{
|
||||
return weekOfYear;
|
||||
@@ -251,17 +221,14 @@ public class AuditDateImpl implements AuditDate
|
||||
this.weekOfYear = weekOfYear;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.audit.hibernate.AuditDate#getYear()
|
||||
*/
|
||||
public int getYear()
|
||||
public int getFullYear()
|
||||
{
|
||||
return year;
|
||||
return fullYear;
|
||||
}
|
||||
|
||||
protected void setYear(int year)
|
||||
protected void setFullYear(int year)
|
||||
{
|
||||
this.year = year;
|
||||
this.fullYear = year;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -130,7 +130,7 @@ class AVMStorePropertyDAOHibernate extends HibernateDaoSupport implements AVMSto
|
||||
"join name.namespace namespace " +
|
||||
"where " +
|
||||
"asp.store = :store and " +
|
||||
"namespace.uri like :uri and " +
|
||||
"namespace.safeUri like :uri and " +
|
||||
"name.localName like :localName");
|
||||
query.setEntity("store", store);
|
||||
query.setParameter("uri", uri);
|
||||
@@ -164,7 +164,7 @@ class AVMStorePropertyDAOHibernate extends HibernateDaoSupport implements AVMSto
|
||||
"join asp.name name " +
|
||||
"join name.namespace namespace " +
|
||||
"where " +
|
||||
"namespace.uri like :uri and " +
|
||||
"namespace.safeUri like :uri and " +
|
||||
"name.localName like :localName");
|
||||
query.setParameter("uri", uri);
|
||||
query.setParameter("localName", localName);
|
||||
|
@@ -79,9 +79,11 @@ public class HibernateQNameDAOImpl extends HibernateDaoSupport implements QNameD
|
||||
{
|
||||
public Object doInHibernate(Session session)
|
||||
{
|
||||
String oracleSafeUri = (namespaceUri.length() == 0) ? NamespaceEntityImpl.EMPTY_URI_SUBSTITUTE : namespaceUri;
|
||||
|
||||
Query query = session
|
||||
.getNamedQuery(HibernateQNameDAOImpl.QUERY_GET_NS_BY_URI)
|
||||
.setString("namespaceUri", namespaceUri);
|
||||
.setString("namespaceUri", oracleSafeUri);
|
||||
return query.uniqueResult();
|
||||
}
|
||||
};
|
||||
@@ -150,9 +152,12 @@ public class HibernateQNameDAOImpl extends HibernateDaoSupport implements QNameD
|
||||
{
|
||||
public Object doInHibernate(Session session)
|
||||
{
|
||||
String namespaceUri = qname.getNamespaceURI();
|
||||
String oracleSafeUri = (namespaceUri.length() == 0) ? NamespaceEntityImpl.EMPTY_URI_SUBSTITUTE : namespaceUri;
|
||||
|
||||
Query query = session
|
||||
.getNamedQuery(HibernateQNameDAOImpl.QUERY_GET_QNAME_BY_URI_AND_LOCALNAME)
|
||||
.setString("namespaceUri", qname.getNamespaceURI())
|
||||
.setString("namespaceUri", oracleSafeUri)
|
||||
.setString("localName", qname.getLocalName());
|
||||
return query.uniqueResult();
|
||||
}
|
||||
|
@@ -37,10 +37,12 @@ import org.alfresco.repo.domain.QNameEntity;
|
||||
public class NamespaceEntityImpl implements NamespaceEntity, Serializable
|
||||
{
|
||||
private static final long serialVersionUID = -6781559184013949845L;
|
||||
|
||||
protected static final String EMPTY_URI_SUBSTITUTE = ".empty";
|
||||
|
||||
private Long id;
|
||||
private Long version;
|
||||
private String uri;
|
||||
private String safeUri;
|
||||
|
||||
public NamespaceEntityImpl()
|
||||
{
|
||||
@@ -51,7 +53,7 @@ public class NamespaceEntityImpl implements NamespaceEntity, Serializable
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
return uri;
|
||||
return getUri();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,7 +82,7 @@ public class NamespaceEntityImpl implements NamespaceEntity, Serializable
|
||||
*/
|
||||
public int hashCode()
|
||||
{
|
||||
return uri.hashCode();
|
||||
return safeUri.hashCode();
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
@@ -102,22 +104,33 @@ public class NamespaceEntityImpl implements NamespaceEntity, Serializable
|
||||
return version;
|
||||
}
|
||||
|
||||
/**
|
||||
* For Hibernate use
|
||||
*/
|
||||
/** For Hibernate use */
|
||||
@SuppressWarnings("unused")
|
||||
private void setVersion(Long version)
|
||||
{
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
/** For Hibernate use */
|
||||
@SuppressWarnings("unused")
|
||||
private String getSafeUri()
|
||||
{
|
||||
return safeUri;
|
||||
}
|
||||
|
||||
/** For Hibernate use */
|
||||
private void setSafeUri(String safeUri)
|
||||
{
|
||||
this.safeUri = safeUri;
|
||||
}
|
||||
|
||||
public String getUri()
|
||||
{
|
||||
return uri;
|
||||
return safeUri.equals(EMPTY_URI_SUBSTITUTE) ? "" : safeUri;
|
||||
}
|
||||
|
||||
public void setUri(String uri)
|
||||
{
|
||||
this.uri = uri;
|
||||
setSafeUri(uri.length() == 0 ? EMPTY_URI_SUBSTITUTE : uri);
|
||||
}
|
||||
}
|
@@ -21,7 +21,7 @@
|
||||
</id>
|
||||
<!-- Namespace URL must be unique -->
|
||||
<natural-id mutable="true">
|
||||
<property name="uri" column="uri" type="string" length="100" not-null="true" />
|
||||
<property name="safeUri" column="uri" type="string" length="100" not-null="true" />
|
||||
</natural-id>
|
||||
<!-- Optimistic locking -->
|
||||
<version column="version" name="version" type="long" />
|
||||
@@ -65,7 +65,7 @@
|
||||
from
|
||||
org.alfresco.repo.domain.hibernate.NamespaceEntityImpl as namespace
|
||||
where
|
||||
namespace.uri = :namespaceUri
|
||||
namespace.safeUri = :namespaceUri
|
||||
</query>
|
||||
|
||||
<query name="qname.GetQNameByUriAndLocalName" cacheable="false">
|
||||
@@ -75,7 +75,7 @@
|
||||
org.alfresco.repo.domain.hibernate.QNameEntityImpl as qname
|
||||
join qname.namespace as namespace
|
||||
where
|
||||
namespace.uri = :namespaceUri and
|
||||
namespace.safeUri = :namespaceUri and
|
||||
qname.localName = :localName
|
||||
</query>
|
||||
|
||||
|
@@ -3879,6 +3879,22 @@ public class ADMLuceneTest extends TestCase
|
||||
results = searcher.query(sp);
|
||||
assertEquals(1, results.length());
|
||||
results.close();
|
||||
|
||||
sp = new SearchParameters();
|
||||
sp.addStore(rootNodeRef.getStoreRef());
|
||||
sp.setLanguage("lucene");
|
||||
sp.setQuery("ISNULL:\"" + QName.createQName(TEST_NAMESPACE, "aspectProperty").toString() + "\"");
|
||||
results = searcher.query(sp);
|
||||
assertEquals(1, results.length());
|
||||
results.close();
|
||||
|
||||
sp = new SearchParameters();
|
||||
sp.addStore(rootNodeRef.getStoreRef());
|
||||
sp.setLanguage("lucene");
|
||||
sp.setQuery("ISNOTNULL:\"" + QName.createQName(TEST_NAMESPACE, "aspectProperty").toString() + "\"");
|
||||
results = searcher.query(sp);
|
||||
assertEquals(0, results.length());
|
||||
results.close();
|
||||
|
||||
// Test non field queries
|
||||
|
||||
|
@@ -49,6 +49,7 @@ import org.alfresco.repo.search.impl.lucene.analysis.VerbatimAnalyser;
|
||||
import org.alfresco.repo.search.impl.lucene.query.PathQuery;
|
||||
import org.alfresco.repo.tenant.TenantService;
|
||||
import org.alfresco.service.cmr.dictionary.AspectDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.ClassDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
||||
@@ -507,9 +508,11 @@ public class LuceneQueryParser extends QueryParser
|
||||
PropertyDefinition pd = dictionaryService.getProperty(qname);
|
||||
if (pd != null)
|
||||
{
|
||||
QName container = pd.getContainerClass().getName();
|
||||
ClassDefinition containerClass = pd.getContainerClass();
|
||||
QName container = containerClass.getName();
|
||||
BooleanQuery query = new BooleanQuery();
|
||||
Query typeQuery = getFieldQuery("TYPE", container.toString());
|
||||
String classType = containerClass.isAspect() ? "ASPECT" : "TYPE";
|
||||
Query typeQuery = getFieldQuery(classType, container.toString());
|
||||
Query presenceQuery = getWildcardQuery("@" + qname.toString(), "*");
|
||||
if ((typeQuery != null) && (presenceQuery != null))
|
||||
{
|
||||
@@ -531,9 +534,11 @@ public class LuceneQueryParser extends QueryParser
|
||||
PropertyDefinition pd = dictionaryService.getProperty(qname);
|
||||
if (pd != null)
|
||||
{
|
||||
QName container = pd.getContainerClass().getName();
|
||||
ClassDefinition containerClass = pd.getContainerClass();
|
||||
QName container = containerClass.getName();
|
||||
BooleanQuery query = new BooleanQuery();
|
||||
Query typeQuery = getFieldQuery("TYPE", container.toString());
|
||||
String classType = containerClass.isAspect() ? "ASPECT" : "TYPE";
|
||||
Query typeQuery = getFieldQuery(classType, container.toString());
|
||||
Query presenceQuery = getWildcardQuery("@" + qname.toString(), "*");
|
||||
if ((typeQuery != null) && (presenceQuery != null))
|
||||
{
|
||||
|
@@ -10,9 +10,9 @@
|
||||
<import uri="http://www.alfresco.org/model/system/1.0" prefix="sys"/>
|
||||
</imports>
|
||||
|
||||
<namespaces>
|
||||
<namespace uri="http://www.alfresco.org/test/lucenetest" prefix="test"/>
|
||||
</namespaces>
|
||||
<namespaces>
|
||||
<namespace uri="http://www.alfresco.org/test/lucenetest" prefix="test"/>
|
||||
</namespaces>
|
||||
|
||||
<types>
|
||||
<type name="test:testSuperType">
|
||||
@@ -331,6 +331,18 @@
|
||||
<aspect name="test:testAspect">
|
||||
<title>Titled</title>
|
||||
<parent>test:testSuperAspect</parent>
|
||||
<properties>
|
||||
<property name="test:aspectProperty">
|
||||
<type>d:text</type>
|
||||
<mandatory>false</mandatory>
|
||||
<multiple>false</multiple>
|
||||
<index enabled="true">
|
||||
<atomic>true</atomic>
|
||||
<stored>true</stored>
|
||||
<tokenised>true</tokenised>
|
||||
</index>
|
||||
</property>
|
||||
</properties>
|
||||
</aspect>
|
||||
</aspects>
|
||||
|
||||
|
@@ -85,6 +85,8 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
||||
|
||||
private boolean errorOnMissingMembers = false;
|
||||
|
||||
private boolean errorOnDuplicateGID = false;
|
||||
|
||||
private QName viewRef;
|
||||
|
||||
private QName viewId;
|
||||
@@ -168,6 +170,11 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
||||
this.errorOnMissingUID = errorOnMissingUID;
|
||||
}
|
||||
|
||||
public void setErrorOnDuplicateGID(boolean errorOnDuplicateGID)
|
||||
{
|
||||
this.errorOnDuplicateGID = errorOnDuplicateGID;
|
||||
}
|
||||
|
||||
public void setAuthorityDAO(AuthorityDAO authorityDAO)
|
||||
{
|
||||
this.authorityDAO = authorityDAO;
|
||||
@@ -185,8 +192,7 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
||||
|
||||
}
|
||||
|
||||
private void buildXML(HashSet<Group> rootGroups, HashMap<String, Group> lookup,
|
||||
HashSet<SecondaryLink> secondaryLinks, XMLWriter writer)
|
||||
private void buildXML(HashSet<Group> rootGroups, HashMap<String, Group> lookup, HashSet<SecondaryLink> secondaryLinks, XMLWriter writer)
|
||||
{
|
||||
|
||||
Collection<String> prefixes = namespaceService.getPrefixes();
|
||||
@@ -195,8 +201,8 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
||||
try
|
||||
{
|
||||
AttributesImpl attrs = new AttributesImpl();
|
||||
attrs.addAttribute(NamespaceService.REPOSITORY_VIEW_1_0_URI, childQName.getLocalName(), childQName
|
||||
.toPrefixString(), null, ContentModel.TYPE_PERSON.toPrefixString(namespaceService));
|
||||
attrs.addAttribute(NamespaceService.REPOSITORY_VIEW_1_0_URI, childQName.getLocalName(), childQName.toPrefixString(), null, ContentModel.TYPE_PERSON
|
||||
.toPrefixString(namespaceService));
|
||||
|
||||
writer.startDocument();
|
||||
|
||||
@@ -209,8 +215,7 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
||||
}
|
||||
}
|
||||
|
||||
writer.startElement(NamespaceService.REPOSITORY_VIEW_PREFIX, "view",
|
||||
NamespaceService.REPOSITORY_VIEW_PREFIX + ":" + "view", new AttributesImpl());
|
||||
writer.startElement(NamespaceService.REPOSITORY_VIEW_PREFIX, "view", NamespaceService.REPOSITORY_VIEW_PREFIX + ":" + "view", new AttributesImpl());
|
||||
|
||||
// Create group structure
|
||||
|
||||
@@ -234,8 +239,7 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
||||
}
|
||||
}
|
||||
|
||||
writer.endElement(NamespaceService.REPOSITORY_VIEW_PREFIX, "view", NamespaceService.REPOSITORY_VIEW_PREFIX
|
||||
+ ":" + "view");
|
||||
writer.endElement(NamespaceService.REPOSITORY_VIEW_PREFIX, "view", NamespaceService.REPOSITORY_VIEW_PREFIX + ":" + "view");
|
||||
|
||||
writer.endDocument();
|
||||
}
|
||||
@@ -246,42 +250,34 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
||||
|
||||
}
|
||||
|
||||
private void addSecondarylink(HashMap<String, Group> lookup, SecondaryLink sl, XMLWriter writer)
|
||||
throws SAXException
|
||||
private void addSecondarylink(HashMap<String, Group> lookup, SecondaryLink sl, XMLWriter writer) throws SAXException
|
||||
{
|
||||
|
||||
String fromId = lookup.get(sl.from).guid;
|
||||
String toId = lookup.get(sl.to).guid;
|
||||
|
||||
AttributesImpl attrs = new AttributesImpl();
|
||||
attrs.addAttribute(viewIdRef.getNamespaceURI(), viewIdRef.getLocalName(), viewIdRef.toPrefixString(), null,
|
||||
fromId);
|
||||
attrs.addAttribute(viewIdRef.getNamespaceURI(), viewIdRef.getLocalName(), viewIdRef.toPrefixString(), null, fromId);
|
||||
|
||||
writer.startElement(viewRef.getNamespaceURI(), viewRef.getLocalName(),
|
||||
viewRef.toPrefixString(namespaceService), attrs);
|
||||
writer.startElement(viewRef.getNamespaceURI(), viewRef.getLocalName(), viewRef.toPrefixString(namespaceService), attrs);
|
||||
|
||||
writer.startElement(viewAssociations.getNamespaceURI(), viewAssociations.getLocalName(), viewAssociations
|
||||
.toPrefixString(namespaceService), new AttributesImpl());
|
||||
writer.startElement(viewAssociations.getNamespaceURI(), viewAssociations.getLocalName(), viewAssociations.toPrefixString(namespaceService), new AttributesImpl());
|
||||
|
||||
writer.startElement(ContentModel.ASSOC_MEMBER.getNamespaceURI(), ContentModel.ASSOC_MEMBER.getLocalName(),
|
||||
ContentModel.ASSOC_MEMBER.toPrefixString(namespaceService), new AttributesImpl());
|
||||
writer.startElement(ContentModel.ASSOC_MEMBER.getNamespaceURI(), ContentModel.ASSOC_MEMBER.getLocalName(), ContentModel.ASSOC_MEMBER.toPrefixString(namespaceService),
|
||||
new AttributesImpl());
|
||||
|
||||
AttributesImpl attrsRef = new AttributesImpl();
|
||||
attrsRef.addAttribute(viewIdRef.getNamespaceURI(), viewIdRef.getLocalName(), viewIdRef.toPrefixString(), null,
|
||||
toId);
|
||||
attrsRef.addAttribute(childQName.getNamespaceURI(), childQName.getLocalName(), childQName.toPrefixString(),
|
||||
null, QName.createQName(ContentModel.USER_MODEL_URI, sl.to).toPrefixString(namespaceService));
|
||||
attrsRef.addAttribute(viewIdRef.getNamespaceURI(), viewIdRef.getLocalName(), viewIdRef.toPrefixString(), null, toId);
|
||||
attrsRef.addAttribute(childQName.getNamespaceURI(), childQName.getLocalName(), childQName.toPrefixString(), null, QName.createQName(ContentModel.USER_MODEL_URI, sl.to)
|
||||
.toPrefixString(namespaceService));
|
||||
|
||||
writer.startElement(viewRef.getNamespaceURI(), viewRef.getLocalName(),
|
||||
viewRef.toPrefixString(namespaceService), attrsRef);
|
||||
writer.startElement(viewRef.getNamespaceURI(), viewRef.getLocalName(), viewRef.toPrefixString(namespaceService), attrsRef);
|
||||
|
||||
writer.endElement(viewRef.getNamespaceURI(), viewRef.getLocalName(), viewRef.toPrefixString(namespaceService));
|
||||
|
||||
writer.endElement(ContentModel.ASSOC_MEMBER.getNamespaceURI(), ContentModel.ASSOC_MEMBER.getLocalName(),
|
||||
ContentModel.ASSOC_MEMBER.toPrefixString(namespaceService));
|
||||
writer.endElement(ContentModel.ASSOC_MEMBER.getNamespaceURI(), ContentModel.ASSOC_MEMBER.getLocalName(), ContentModel.ASSOC_MEMBER.toPrefixString(namespaceService));
|
||||
|
||||
writer.endElement(viewAssociations.getNamespaceURI(), viewAssociations.getLocalName(), viewAssociations
|
||||
.toPrefixString(namespaceService));
|
||||
writer.endElement(viewAssociations.getNamespaceURI(), viewAssociations.getLocalName(), viewAssociations.toPrefixString(namespaceService));
|
||||
|
||||
writer.endElement(viewRef.getNamespaceURI(), viewRef.getLocalName(), viewRef.toPrefixString(namespaceService));
|
||||
|
||||
@@ -292,14 +288,12 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
||||
QName nodeUUID = QName.createQName("sys:node-uuid", namespaceService);
|
||||
|
||||
AttributesImpl attrs = new AttributesImpl();
|
||||
attrs.addAttribute(NamespaceService.REPOSITORY_VIEW_1_0_URI, childQName.getLocalName(), childQName
|
||||
.toPrefixString(), null, QName.createQName(ContentModel.USER_MODEL_URI, group.gid).toPrefixString(
|
||||
namespaceService));
|
||||
attrs.addAttribute(NamespaceService.REPOSITORY_VIEW_1_0_URI, childQName.getLocalName(), childQName.toPrefixString(), null, QName.createQName(ContentModel.USER_MODEL_URI,
|
||||
group.gid).toPrefixString(namespaceService));
|
||||
attrs.addAttribute(viewId.getNamespaceURI(), viewId.getLocalName(), viewId.toPrefixString(), null, group.guid);
|
||||
|
||||
writer.startElement(ContentModel.TYPE_AUTHORITY_CONTAINER.getNamespaceURI(),
|
||||
ContentModel.TYPE_AUTHORITY_CONTAINER.getLocalName(), ContentModel.TYPE_AUTHORITY_CONTAINER
|
||||
.toPrefixString(namespaceService), attrs);
|
||||
writer.startElement(ContentModel.TYPE_AUTHORITY_CONTAINER.getNamespaceURI(), ContentModel.TYPE_AUTHORITY_CONTAINER.getLocalName(), ContentModel.TYPE_AUTHORITY_CONTAINER
|
||||
.toPrefixString(namespaceService), attrs);
|
||||
|
||||
if ((authorityDAO != null) && authorityDAO.authorityExists(group.gid))
|
||||
{
|
||||
@@ -308,43 +302,37 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
||||
{
|
||||
String uguid = authorityDAO.getAuthorityNodeRefOrNull(group.gid).getId();
|
||||
|
||||
writer.startElement(nodeUUID.getNamespaceURI(), nodeUUID.getLocalName(), nodeUUID
|
||||
.toPrefixString(namespaceService), new AttributesImpl());
|
||||
writer.startElement(nodeUUID.getNamespaceURI(), nodeUUID.getLocalName(), nodeUUID.toPrefixString(namespaceService), new AttributesImpl());
|
||||
|
||||
writer.characters(uguid.toCharArray(), 0, uguid.length());
|
||||
|
||||
writer.endElement(nodeUUID.getNamespaceURI(), nodeUUID.getLocalName(), nodeUUID
|
||||
.toPrefixString(namespaceService));
|
||||
writer.endElement(nodeUUID.getNamespaceURI(), nodeUUID.getLocalName(), nodeUUID.toPrefixString(namespaceService));
|
||||
}
|
||||
}
|
||||
|
||||
writer.startElement(ContentModel.PROP_AUTHORITY_NAME.getNamespaceURI(), ContentModel.PROP_AUTHORITY_NAME
|
||||
.getLocalName(), ContentModel.PROP_AUTHORITY_NAME.toPrefixString(namespaceService),
|
||||
new AttributesImpl());
|
||||
writer.startElement(ContentModel.PROP_AUTHORITY_NAME.getNamespaceURI(), ContentModel.PROP_AUTHORITY_NAME.getLocalName(), ContentModel.PROP_AUTHORITY_NAME
|
||||
.toPrefixString(namespaceService), new AttributesImpl());
|
||||
|
||||
writer.characters(group.gid.toCharArray(), 0, group.gid.length());
|
||||
|
||||
writer.endElement(ContentModel.PROP_AUTHORITY_NAME.getNamespaceURI(), ContentModel.PROP_AUTHORITY_NAME
|
||||
.getLocalName(), ContentModel.PROP_AUTHORITY_NAME.toPrefixString(namespaceService));
|
||||
writer.endElement(ContentModel.PROP_AUTHORITY_NAME.getNamespaceURI(), ContentModel.PROP_AUTHORITY_NAME.getLocalName(), ContentModel.PROP_AUTHORITY_NAME
|
||||
.toPrefixString(namespaceService));
|
||||
|
||||
if (group.members.size() > 0)
|
||||
{
|
||||
writer.startElement(ContentModel.PROP_MEMBERS.getNamespaceURI(), ContentModel.PROP_MEMBERS.getLocalName(),
|
||||
ContentModel.PROP_MEMBERS.toPrefixString(namespaceService), new AttributesImpl());
|
||||
writer.startElement(ContentModel.PROP_MEMBERS.getNamespaceURI(), ContentModel.PROP_MEMBERS.getLocalName(), ContentModel.PROP_MEMBERS.toPrefixString(namespaceService),
|
||||
new AttributesImpl());
|
||||
|
||||
for (String member : group.members)
|
||||
{
|
||||
writer.startElement(viewValueQName.getNamespaceURI(), viewValueQName.getLocalName(), viewValueQName
|
||||
.toPrefixString(namespaceService), new AttributesImpl());
|
||||
writer.startElement(viewValueQName.getNamespaceURI(), viewValueQName.getLocalName(), viewValueQName.toPrefixString(namespaceService), new AttributesImpl());
|
||||
|
||||
writer.characters(member.toCharArray(), 0, member.length());
|
||||
|
||||
writer.endElement(viewValueQName.getNamespaceURI(), viewValueQName.getLocalName(), viewValueQName
|
||||
.toPrefixString(namespaceService));
|
||||
writer.endElement(viewValueQName.getNamespaceURI(), viewValueQName.getLocalName(), viewValueQName.toPrefixString(namespaceService));
|
||||
}
|
||||
|
||||
writer.endElement(ContentModel.PROP_MEMBERS.getNamespaceURI(), ContentModel.PROP_MEMBERS.getLocalName(),
|
||||
ContentModel.PROP_MEMBERS.toPrefixString(namespaceService));
|
||||
writer.endElement(ContentModel.PROP_MEMBERS.getNamespaceURI(), ContentModel.PROP_MEMBERS.getLocalName(), ContentModel.PROP_MEMBERS.toPrefixString(namespaceService));
|
||||
}
|
||||
|
||||
for (Group child : group.children)
|
||||
@@ -352,9 +340,8 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
||||
addgroup(lookup, child, writer);
|
||||
}
|
||||
|
||||
writer.endElement(ContentModel.TYPE_AUTHORITY_CONTAINER.getNamespaceURI(),
|
||||
ContentModel.TYPE_AUTHORITY_CONTAINER.getLocalName(), ContentModel.TYPE_AUTHORITY_CONTAINER
|
||||
.toPrefixString(namespaceService));
|
||||
writer.endElement(ContentModel.TYPE_AUTHORITY_CONTAINER.getNamespaceURI(), ContentModel.TYPE_AUTHORITY_CONTAINER.getLocalName(), ContentModel.TYPE_AUTHORITY_CONTAINER
|
||||
.toPrefixString(namespaceService));
|
||||
|
||||
}
|
||||
|
||||
@@ -362,17 +349,15 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
||||
{
|
||||
AttributesImpl attrs = new AttributesImpl();
|
||||
|
||||
writer.startElement(ContentModel.ASSOC_MEMBER.getNamespaceURI(), ContentModel.ASSOC_MEMBER.getLocalName(),
|
||||
ContentModel.ASSOC_MEMBER.toPrefixString(namespaceService), attrs);
|
||||
writer.startElement(ContentModel.ASSOC_MEMBER.getNamespaceURI(), ContentModel.ASSOC_MEMBER.getLocalName(), ContentModel.ASSOC_MEMBER.toPrefixString(namespaceService),
|
||||
attrs);
|
||||
|
||||
addRootGroup(lookup, group, writer);
|
||||
|
||||
writer.endElement(ContentModel.ASSOC_MEMBER.getNamespaceURI(), ContentModel.ASSOC_MEMBER.getLocalName(),
|
||||
ContentModel.ASSOC_MEMBER.toPrefixString(namespaceService));
|
||||
writer.endElement(ContentModel.ASSOC_MEMBER.getNamespaceURI(), ContentModel.ASSOC_MEMBER.getLocalName(), ContentModel.ASSOC_MEMBER.toPrefixString(namespaceService));
|
||||
}
|
||||
|
||||
private void buildGroupsAndRoots(HashSet<Group> rootGroups, HashMap<String, Group> lookup,
|
||||
HashSet<SecondaryLink> secondaryLinks)
|
||||
private void buildGroupsAndRoots(HashSet<Group> rootGroups, HashMap<String, Group> lookup, HashSet<SecondaryLink> secondaryLinks)
|
||||
{
|
||||
InitialDirContext ctx = null;
|
||||
try
|
||||
@@ -392,9 +377,7 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
||||
{
|
||||
if (errorOnMissingGID)
|
||||
{
|
||||
throw new ExportSourceImporterException(
|
||||
"Group returned by group search does not have mandatory group id attribute "
|
||||
+ attributes);
|
||||
throw new ExportSourceImporterException("Group returned by group search does not have mandatory group id attribute " + attributes);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -404,13 +387,25 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
||||
}
|
||||
String gid = (String) gidAttribute.get(0);
|
||||
|
||||
Group group = lookup.get(gid);
|
||||
Group group = lookup.get("GROUP_" + gid);
|
||||
if (group == null)
|
||||
{
|
||||
group = new Group(gid);
|
||||
lookup.put(group.gid, group);
|
||||
rootGroups.add(group);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (errorOnDuplicateGID)
|
||||
{
|
||||
throw new ExportSourceImporterException("Duplicate group id found for " + gid);
|
||||
}
|
||||
else
|
||||
{
|
||||
s_logger.warn("Duplicate gid found for " + gid + " -> merging definitions");
|
||||
// Currently we will merge the two definitions together we do not support duplciate GIDs
|
||||
}
|
||||
}
|
||||
Attribute memAttribute = attributes.get(memberAttribute);
|
||||
// check for null
|
||||
if (memAttribute != null)
|
||||
@@ -486,8 +481,7 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
||||
{
|
||||
if (errorOnMissingMembers)
|
||||
{
|
||||
throw new ExportSourceImporterException("Failed to find attribute objectclass for DN "
|
||||
+ dn);
|
||||
throw new ExportSourceImporterException("Failed to find attribute objectclass for DN " + dn);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -520,14 +514,11 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
||||
{
|
||||
if (errorOnMissingGID)
|
||||
{
|
||||
throw new ExportSourceImporterException(
|
||||
"Group missing group id attribute DN ="
|
||||
+ dn + " att = " + groupIdAttributeName);
|
||||
throw new ExportSourceImporterException("Group missing group id attribute DN =" + dn + " att = " + groupIdAttributeName);
|
||||
}
|
||||
else
|
||||
{
|
||||
s_logger.warn("Group missing group id attribute DN ="
|
||||
+ dn + " att = " + groupIdAttributeName);
|
||||
s_logger.warn("Group missing group id attribute DN =" + dn + " att = " + groupIdAttributeName);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -539,8 +530,7 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
s_logger.warn("Failed to resolve group identifier "
|
||||
+ groupIdAttributeName + " for distinguished name: " + dn);
|
||||
s_logger.warn("Failed to resolve group identifier " + groupIdAttributeName + " for distinguished name: " + dn);
|
||||
id = "Unknown sub group";
|
||||
}
|
||||
break;
|
||||
@@ -555,14 +545,11 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
||||
{
|
||||
if (errorOnMissingUID)
|
||||
{
|
||||
throw new ExportSourceImporterException(
|
||||
"User missing user id attribute DN ="
|
||||
+ dn + " att = " + userIdAttributeName);
|
||||
throw new ExportSourceImporterException("User missing user id attribute DN =" + dn + " att = " + userIdAttributeName);
|
||||
}
|
||||
else
|
||||
{
|
||||
s_logger.warn("User missing user id attribute DN ="
|
||||
+ dn + " att = " + userIdAttributeName);
|
||||
s_logger.warn("User missing user id attribute DN =" + dn + " att = " + userIdAttributeName);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -574,8 +561,7 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
s_logger.warn("Failed to resolve group identifier "
|
||||
+ userIdAttributeName + " for distinguished name: " + dn);
|
||||
s_logger.warn("Failed to resolve group identifier " + userIdAttributeName + " for distinguished name: " + dn);
|
||||
id = "Unknown member";
|
||||
}
|
||||
break;
|
||||
@@ -606,7 +592,7 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
||||
{
|
||||
if (errorOnMissingMembers)
|
||||
{
|
||||
throw new ExportSourceImporterException("Failed to find child group " + id);
|
||||
throw new ExportSourceImporterException("Failed to find child group " + id);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -617,8 +603,7 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
||||
{
|
||||
if (s_logger.isDebugEnabled())
|
||||
{
|
||||
s_logger.debug("... Primary created from "
|
||||
+ group.gid + " to " + child.gid);
|
||||
s_logger.debug("... Primary created from " + group.gid + " to " + child.gid);
|
||||
}
|
||||
group.children.add(child);
|
||||
rootGroups.remove(child);
|
||||
@@ -627,8 +612,7 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
||||
{
|
||||
if (s_logger.isDebugEnabled())
|
||||
{
|
||||
s_logger.debug("... Secondary created from "
|
||||
+ group.gid + " to " + child.gid);
|
||||
s_logger.debug("... Secondary created from " + group.gid + " to " + child.gid);
|
||||
}
|
||||
secondaryLinks.add(new SecondaryLink(group.gid, child.gid));
|
||||
}
|
||||
|
Reference in New Issue
Block a user