AnsweredAssumed Answered

File Upload Date in Java

Question asked by omkar on Dec 2, 2015
Hi,

   I want help to write a java code to retrieve the file uploaded date. Is there any provision to get this date in Java. Are there any Alfresco API available.
   The version used is Version: Community - v3.2.0 (2039). The code snippet used to retrieve is as below:


public GeneralVO getFile(Reference space)
{
String id = null;
GeneralVO generalVO = null;
try
{
createSession ();
try
{
Node[] nodes = getRepositoryService ().get (new Predicate (new Reference[]
{ space }, STORE, null));
Reference nodeRef = nodes[0].getReference ();
QueryResult rootChildren = getRepositoryService ().queryChildren (nodeRef);
ResultSet rootChildrenResults = rootChildren.getResultSet ();
ResultSetRow[] row = rootChildrenResults.getRows ();
if (row != null)
{
for (ResultSetRow rows : row)
{
generalVO = new GeneralVO ();
id = rows.getNode ().getId ();
// generalVO.setId(id);

NamedValue[] values = rows.getColumns ();
for (NamedValue col : values)
{
String strValue = col.getValue ();
if (col.getName ().endsWith (Constants.PROP_NAME) == true)
{

int fileTpe = strValue.indexOf (".");
if (fileTpe != -1)
{
generalVO.setId (id);
generalVO.setName (strValue);

}
}
}
}
}
}
catch(AxisFault af){
System.out.println(af.getFaultCode());
} catch (Exception ex)
{
ex.printStackTrace ();
}
} catch (Exception e)
{
System.err.println ("Can not initiate session with Alfresco server.");
e.printStackTrace ();
}
return generalVO;
}

   Thank you in advance.

Regards,
   Omkar.

Outcomes