Hello,
I know that this post will be better placed in the devel part but it is also
the answer of my previous question. That's why I publish here my code
source.
I have implemented a simple workflow using the code source of the release
2.1.
I do it because i wish to simplify the control of the metadata change :
That permit to know who is the owner,who is the last updater and also the
date of creation and update of the the metadata using the Geonetwork web
interface.
The creation date and update date are displayed for all on the main search
page and on the last result page.
http://www.nabble.com/file/p14834966/1.jpg
And when you are logged in administrator or reviewer profile the
supplemental informations of owner name and updater name are displayed like
below
http://www.nabble.com/file/p14834966/2.jpg
And it is possible to contact the author clicking on his name.
The limit of the solution is when the user who make the last update is
deleted,
I do not add constraint between metadata table and user table for the last
updater.
So if a user is deleted the link will be breaked and the information can't
be displayed, so i display a “-”.
I do not display the group of the owner or the group of the updater because
user can be member of many groups.
(
The SQL Select is not optimised in order that the metadata will not
disappear when user who make the last update was deleted and to display a
“-” in front of a null field for the author
i use :
SELECT schemaId, createDate, changeDate, owner, lastupdater, source,
isTemplate, title, uuid, isHarvested,
Coalesce ((select name || ' ' ||surname from users where users.id =
Metadata.owner),'-') as userowner,
Coalesce ((select email from users where users.id = Metadata.owner ),'') as
owneremail,
Coalesce ((select name || ' ' ||surname from users where users.id =
Metadata.lastupdater),'-') as userupdater,
Coalesce ((select email from users where users.id = Metadata.lastupdater
),'') as updateremail
FROM Metadata WHERE Metadata.id = ?
)
1)
In the database i have added a field in the table Metadata to manage the Id
of the last updater
The owner id, the create date and the update date are already present on the
database.
ALTER TABLE metadata ADD lastupdater integer NOT NULL;
The default value can be '1' if you want as example that the lastupdater
point to the administrator for the existing metadata, you can also delete
the not null constraint and the “-” will be displayed.
2 )
in /geonetwork/branches/2.1.x/src/org/fao/geonet/constants/Edit.java
i add the fallowing constant.
public static final String OWNER = "owner";
public static final String UPDATER = "updater";
public static final String OWNER_NAME_SURNAME = "ownernamesurname";
public static final String UPDATE_NAME_SURNAME = "updaternamesurname";
public static final String OWNER_EMAIL = "owneremail";
public static final String UPDATE_EMAIL = "updateremail";
See the code source below :
http://www.nabble.com/file/p14834966/Edit.java Edit.java
3 )
in /geonetwork/branches/2.1.x/src/org/fao/geonet/kernel/DataManager.java
I have update the function updateMetadata to manage the the metadata updater
id.
Some overload have been created ...
I have update the function builInfoElem to manage the element present on the
xml sent to the xsl for the main search and last result page.
It update the select function to get and make directly the link between user
id and first and last name and their email.
See the code source below :
http://www.nabble.com/file/p14834966/DataManager.java DataManager.java
4)
/geonetwork/branches/2.1.x/src/org/fao/geonet/kernel/XmlSerializer.java
I have update the insert function to manage the new field lastupdater as a
copy of the owner at the create phases.
And also the update function to save the identifiant of the updater.
See the code source below :
http://www.nabble.com/file/p14834966/XmlSerializer.java XmlSerializer.java
5)
/geonetwork/branches/2.1.x/src/org/fao/geonet/services/metadata/EditUtils.java
I just update the call to updateMetadata to add the id of the current user
connected
See the code source below :
http://www.nabble.com/file/p14834966/EditUtils.java EditUtils.java
6)
/geonetwork/branches/2.1.x/web/geonetwork/xsl/search-results-xhtml.xsl
/geonetwork/branches/2.1.x/web/geonetwork/xsl/search-results.xsl
Add part to display the new fields
<!-- createDate & owner-->
<xsl:if test="$metadata/geonet:info/createDate">
<tr>
<th class="padded" valign="top"><xsl:value-of
select="/root/gui/strings/created"/></th>
<td class="padded" valign="top" colspan="2">
<xsl:for-each select="$metadata/geonet:info/createDate">
<xsl:value-of select="."/>
</xsl:for-each>
<xsl:if test="$metadata/geonet:info/ownernamesurname">
  <xsl:value-of select="/root/gui/strings/author"/> 
mailto:{$metadata/geonet:info/owneremail} <xsl:value-of
select="$metadata/geonet:info/ownernamesurname"/>
</xsl:if>
</td>
</tr>
</xsl:if>
<!-- changeDate & updater -->
<xsl:if test="$metadata/geonet:info/changeDate">
<tr>
<th class="padded" valign="top"><xsl:value-of
select="/root/gui/strings/updated"/></th>
<td class="padded" valign="top" colspan="2">
<xsl:for-each select="$metadata/geonet:info/changeDate">
<xsl:value-of select="."/>
</xsl:for-each>
<xsl:if test="$metadata/geonet:info/updaternamesurname">
  <xsl:value-of select="/root/gui/strings/author"/> 
mailto:{$metadata/geonet:info/updateremail} <xsl:value-of
select="$metadata/geonet:info/updaternamesurname"/>
</xsl:if>
</td>
</tr>
</xsl:if>
http://www.nabble.com/file/p14834966/search-results.xsl search-results.xsl
http://www.nabble.com/file/p14834966/search-results-xhtml.xsl
search-results-xhtml.xsl
7)
/geonetwork/branches/2.1.x/web/geonetwork/loc/en/xml/strings.xml
I update the strings.xml file for english and french to add the field bellow
<author>Author</author>
<created>Created</created>
<updated>Updated</updated>
Expecting that can be interesting for someone.
Fabien Bachraty, INRA Avignon
FBachraty wrote:
Dear All,
I would like to propose the idea of an improvement to the actual
Geonetwork 2.1.
The Geonetwork tool is oriented for an internet use, So for the
administrators it will be very interesting to know who create the
metadatas, and who do the last update on them for the geonetwork local
node. ( For controlling publication content as example )
So a simple Workflow functionality, witch just save the user id of the
metadata creator and metadata updater, will permit to display for the
administrators and users administrators, complementary and very
interesting information about the metadata like :
- Creation Date : User Groups - User <with email link>
- Update Date : User Groups - User <with email link>
Maybe a more complex development phase for validation content, metadata
versioning and other workflow's functionalities can be envisaged in a
second time?
What are you (Users, Administrators , Developers ) thinking about ?
Cordially Fabien BACHRATY
INRA Avignon France
--
View this message in context: http://www.nabble.com/Functionality-improvement-%3A-Metadata-Workflow-tp12975916s18419p14834966.html
Sent from the geonetwork-users mailing list archive at Nabble.com.