mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
ALF-4106 AuditService REST API: Added 'dataTrigger' to 'RecordValue'
- Prevents RecordValue elements from activating unnecessarily - Without any entries, everything behaves as before i.e. 'RecordValue' triggers on data entries at the current path git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@22197 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -87,6 +87,7 @@
|
||||
<xs:extension base="a:KeyedAuditDefinition">
|
||||
<xs:attribute name="dataExtractor" type="a:NameAttribute" use="required" />
|
||||
<xs:attribute name="dataSource" type="a:PathAttribute" use="optional" />
|
||||
<xs:attribute name="dataTrigger" type="a:PathAttribute" use="optional" />
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
|
@@ -15,6 +15,7 @@
|
||||
|
||||
<DataGenerators>
|
||||
<DataGenerator name="personFullName" registeredName="auditModel.generator.personFullName"/>
|
||||
<DataGenerator name="authenticatedUser" registeredName="auditModel.generator.user"/>
|
||||
</DataGenerators>
|
||||
|
||||
<PathMappings>
|
||||
@@ -23,11 +24,9 @@
|
||||
|
||||
<Application name="AlfrescoRepository" key="repository">
|
||||
<AuditPath key="login">
|
||||
<!--
|
||||
<AuditPath key="no-error">
|
||||
<RecordValue key="user" dataExtractor="simpleValue" dataSource="/repository/login/args/userName"/>
|
||||
</AuditPath>
|
||||
-->
|
||||
<AuditPath key="error">
|
||||
<RecordValue key="user" dataExtractor="simpleValue" dataSource="/repository/login/args/userName"/>
|
||||
</AuditPath>
|
||||
|
@@ -651,9 +651,16 @@ public class AuditComponentImpl implements AuditComponent
|
||||
for (DataExtractorDefinition extractorDef : extractors)
|
||||
{
|
||||
DataExtractor extractor = extractorDef.getDataExtractor();
|
||||
String triggerPath = extractorDef.getDataTrigger();
|
||||
String sourcePath = extractorDef.getDataSource();
|
||||
String targetPath = extractorDef.getDataTarget();
|
||||
|
||||
// Check if it is triggered
|
||||
if (!values.containsKey(triggerPath))
|
||||
{
|
||||
continue; // It is not triggered
|
||||
}
|
||||
|
||||
// We observe the key, not the actual value
|
||||
if (!values.containsKey(sourcePath))
|
||||
{
|
||||
|
@@ -290,22 +290,33 @@ public class AuditApplication
|
||||
*/
|
||||
public static class DataExtractorDefinition
|
||||
{
|
||||
private final String dataTrigger;
|
||||
private final String dataSource;
|
||||
private final String dataTarget;
|
||||
private final DataExtractor dataExtractor;
|
||||
|
||||
/**
|
||||
* @param dataTrigger the data path that must exist for this extractor to be triggered
|
||||
* @param dataSource the path to get data from
|
||||
* @param dataTarget the path to write data to
|
||||
* @param dataExtractor the implementation to use
|
||||
*/
|
||||
public DataExtractorDefinition(String dataSource, String dataTarget, DataExtractor dataExtractor)
|
||||
public DataExtractorDefinition(String dataTrigger, String dataSource, String dataTarget, DataExtractor dataExtractor)
|
||||
{
|
||||
this.dataTrigger = dataTrigger;
|
||||
this.dataSource = dataSource;
|
||||
this.dataTarget = dataTarget;
|
||||
this.dataExtractor = dataExtractor;
|
||||
}
|
||||
|
||||
/**
|
||||
* The data path that must exist for the extractor to be triggered.
|
||||
*/
|
||||
public String getDataTrigger()
|
||||
{
|
||||
return dataTrigger;
|
||||
}
|
||||
|
||||
public String getDataSource()
|
||||
{
|
||||
return dataSource;
|
||||
@@ -442,8 +453,14 @@ public class AuditApplication
|
||||
{
|
||||
sourcePath = currentPath;
|
||||
}
|
||||
// The extractor may be triggered by data from elsewhere
|
||||
String dataTrigger = element.getDataTrigger();
|
||||
if (dataTrigger == null)
|
||||
{
|
||||
dataTrigger = currentPath;
|
||||
}
|
||||
// Store the extractor definition
|
||||
DataExtractorDefinition extractorDef = new DataExtractorDefinition(sourcePath, extractorPath, extractor);
|
||||
DataExtractorDefinition extractorDef = new DataExtractorDefinition(dataTrigger, sourcePath, extractorPath, extractor);
|
||||
dataExtractors.add(extractorDef);
|
||||
}
|
||||
|
||||
|
@@ -1,21 +1,4 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.alfresco.repo.audit.model._3;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@@ -1,21 +1,4 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.alfresco.repo.audit.model._3;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@@ -1,21 +1,4 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.alfresco.repo.audit.model._3;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@@ -1,21 +1,4 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.alfresco.repo.audit.model._3;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
|
@@ -1,21 +1,4 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.alfresco.repo.audit.model._3;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@@ -1,21 +1,4 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.alfresco.repo.audit.model._3;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
|
@@ -1,21 +1,4 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.alfresco.repo.audit.model._3;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@@ -1,21 +1,4 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.alfresco.repo.audit.model._3;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
|
@@ -1,21 +1,4 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.alfresco.repo.audit.model._3;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
|
@@ -1,21 +1,4 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.alfresco.repo.audit.model._3;
|
||||
|
||||
import javax.xml.bind.JAXBElement;
|
||||
|
@@ -1,21 +1,4 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.alfresco.repo.audit.model._3;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
|
@@ -1,21 +1,4 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.alfresco.repo.audit.model._3;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@@ -1,21 +1,4 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.alfresco.repo.audit.model._3;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
@@ -35,6 +18,7 @@ import javax.xml.bind.annotation.XmlType;
|
||||
* <extension base="{http://www.alfresco.org/repo/audit/model/3.2}KeyedAuditDefinition">
|
||||
* <attribute name="dataExtractor" use="required" type="{http://www.alfresco.org/repo/audit/model/3.2}NameAttribute" />
|
||||
* <attribute name="dataSource" type="{http://www.alfresco.org/repo/audit/model/3.2}PathAttribute" />
|
||||
* <attribute name="dataTrigger" type="{http://www.alfresco.org/repo/audit/model/3.2}PathAttribute" />
|
||||
* </extension>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
@@ -52,6 +36,8 @@ public class RecordValue
|
||||
protected String dataExtractor;
|
||||
@XmlAttribute
|
||||
protected String dataSource;
|
||||
@XmlAttribute
|
||||
protected String dataTrigger;
|
||||
|
||||
/**
|
||||
* Gets the value of the dataExtractor property.
|
||||
@@ -101,4 +87,28 @@ public class RecordValue
|
||||
this.dataSource = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the dataTrigger property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getDataTrigger() {
|
||||
return dataTrigger;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the dataTrigger property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setDataTrigger(String value) {
|
||||
this.dataTrigger = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user