Skip to main content
1-Visitor
March 7, 2012
Question

IE Search Based on thePersistInfo.modifyStamp

  • March 7, 2012
  • 3 replies
  • 1413 views

Hello everyone,


I have a webject that I'm searching for files based onthePersistInfo.modifyStamp. I'm looking for objects that have been modified since a certain date in time. My webject line looks like this..


<ie:param name="WHERE" data="thePersistInfo.modifyStamp">'$(@FORM[]moddate[])"/>


As you can see, I am searching for a date/time greater than what is provided by the form.


The problem that I'm having is getting it to search down to the hh:mm:ss. This was working before, but we have changed our WC configurationa and now it is only searching down the date.


Ex.


Assume this modify date on a object: 2012-03-06 02:33:19 GMT


If I pass this argument to the webject:2012-03-05 02:01:01, I get the correct files.


Now assume I pass2012-03-06 02:40:19 to the webject. I shoud not get the object with the modify date above and yet, I am.


I cannot explain how this was working before and not now. Is there a setting somewhere in IE that dictates the sensitivity?



**EDITED**


I tested the webject on another instance that has an architecture more similar to our old machine and the webject searches down to the minute just fine. I'm hoping this is just sensitivity setting somewhere.

3 replies

1-Visitor
March 22, 2012

This is just an update...


Now our other instance is also not testing down to the minute. It is testing modifyStamp to the date. If anyone has any idea on this, it is much appreciated!

1-Visitor
March 23, 2012

For those of you who may be following along at home, here is what I think the problem is.


My first webject that I was using had Query-Objects as the webject type. I had to change it to Search-Objects so I could ensure the latest revision/iteration of a file. On a whim, we changed it back to Query-Objects and it is searching down to the minute/second again on the modifiyStamp attribute.


However, this means that I'm not able to get the latest version/iteration of an object since Query-Objects doesn't support these parameters. I'm going to see if I can couple these 2 webjects and get what I want, but does anyone know if this is a bug on Search-Objects where it will not search a date attribute entirely? There is nothing in the docs about limitations on use a WHERE clause in one webject type or another. The assumption is that it should work the same in both Search and Query.

1-Visitor
March 30, 2012
I sent this to Jeff earlier this week to help him out. The
attached/included helps get around the limitations of Info*Engine when you
are without custom webjects. For those of you interested in Info*Engine ,
this is basically the guts of a custom webject I wrote that helps explain
how to bridge the two worlds together. You could in theory insert this in
a task in-between other webjects depending on how you tweak the code. Take
note of the query included and that it is equivalent to a nested subselect
in SQL (selecting values from a previous selection) AND a timestamp based
date range search.



The information on how to install and configure the delegate and adapters
for webjects (Version 9.1) is available at the very end of this PDF
document...

lastmodified_attrs = (String [])webject.objectParamValue (
"LAST_MODIFIED" );

if (lastmodified_attrs != null)
{
if (log.isDebugEnabled())
{
log.debug("lastmodified_attrs length is: " +
lastmodified_attrs.length);
}
}

}
catch ( IEException ieexception )
{
// absolutely anything wrong with the parameters would show up
here
// parameter validation throws an IEException so for an adapter
webject
// we simply translate this into a WTException
throw new WTException ( ieexception.getLocalizedMessage () );
}

Vector objects = getTargetTypeInstances ();



Group output = new Group( groupOutName );
output.setClassName ( groupOutClass );



//
// first put all the base objects in the output group
//
for ( int i = 0; i < objects.size(); i++ ) addTypeInstance ( output,
(TypeInstance)objects.get ( i ) );
//
// Once we've fetched the base objects remove the cached requested
attributes so that child
// parts can be requested using, possibly a different set of
attributes, per PART_ATTRIBUTES
//
setRequestedAttributeNames ( getTypeIdentifier ( targetType ), null
);
//



// sub select the CADName attribute on EPMDocumentMaster
// use this result set to then get all last modified
// once you have these results, ensure that you have the latest
version
QuerySpec cadNameQS = new QuerySpec( EPMDocumentMaster.class );



try {
cadNameQS.setDistinct( true );
}
catch (WTPropertyVetoException error)
{
error.printStackTrace();
}



cadNameQS.appendWhere(new SearchCondition( EPMDocumentMaster.class,
EPMDocumentMaster.CADNAME, SearchCondition.LIKE,
"%.xml"), new int[] {});




QuerySpec docLastModifiedSpec = new QuerySpec( EPMDocument.class );

// append the where in (select epmdocumentmstr where cadname =
*.xml)
docLastModifiedSpec.appendWhere( new SearchCondition(

new ClassAttribute(EPMDocumentMaster.class,
Persistable.PERSIST_INFO +
"." + PersistInfo.OBJECT_IDENTIFIER +
"." + ObjectIdentifier.ID),

SearchCondition.IN,

new SubSelectExpression( cadNameQS )),

new int[] {}
);


// *** AND *** \\
docLastModifiedSpec.appendAnd();

Date systemTimeNowDate = new Date(System.currentTimeMillis());

// now append the last modified condition

TimestampRangeSearch trs = new
TimestampRangeSearch(EPMDocument.MODIFY_TIMESTAMP);

if (SIX_MONTHS_PRIOR_MS_TTL > systemTimeNowDate.getTime())
{
throw new WTException("The current system time was earlier then
the provided time." +
" This is not possible for events that occurred in the
past." +
" Check your system clock or input and try again.");
}

Date lastModifiedSinceStartDate = new
Date(systemTimeNowDate.getTime() - SIX_MONTHS_PRIOR_MS_TTL);

Timestamp beginSearchTS = new Timestamp(
lastModifiedSinceStartDate.getTime() );
Timestamp endSearchTS = new Timestamp( systemTimeNowDate.getTime()
);

try {

trs.setValue(beginSearchTS, endSearchTS);

} catch (WTPropertyVetoException error) {

error.printStackTrace();
throw new WTException(error);
}

// append where last modified between now and past time in
milliseconds to query

docLastModifiedSpec.appendWhere(trs.getSearchCondition(EPMDocument.class),
new int[] {});


QueryResult qrEPMDocs = PersistenceHelper.manager.find(
(StatementSpec)docLastModifiedSpec );

Object nextResult = null;
EPMDocument anEPMDoc = null;

while ( qrEPMDocs.hasMoreElements() )
{
nextResult = qrEPMDocs.nextElement();

if (nextResult instanceof EPMDocument)
{
anEPMDoc = (EPMDocument)nextResult;

// you could in theory combine this into the query spec to
eliminate this trip back to server
// more advanced...(not supported API)
// @see new
wt.vc.LatestVersionsHelper().getLatestVersionQuerySpec(
// TypeViewVariationsMasterKey,
WTCollection, boolean);
if (anEPMDoc.getIterationInfo().isLatest())
{
// should this be optional - depends on if you allow
modifying old revisions if not released.
listToGetLatestRevs.add( anEPMDoc );
}
else
{
if (log.isDebugEnabled())
{
log.debug("Result was not the latest iteration: " +
anEPMDoc.getCADName() +
" ID: " +
anEPMDoc.getPersistInfo().getObjectIdentifier().getStringValue());

}
}

} // end if

} // end while


// go use the control branch branch identifier to
// make sure you do indeed have the latest iteration of the latest
version
WTValuedMap map = VersionControlHelper.service.getLatestRevisions(
listToGetLatestRevs );


// now go create elements from the valued map and add them to output
VDB return group
Iterator theFinalCollectionIter = map.values().iterator();

while ( theFinalCollectionIter.hasNext() )
{
EPMDocument nextLatestDocument =
(EPMDocument)theFinalCollectionIter.next();

Element ieElementResult = new Element();

ieElementResult.addAtt(new Att("obid",
nextLatestDocument.getPersistInfo().getObjectIdentifier().getStringValue()))
;
ieElementResult.addAtt(new Att("name",
nextLatestDocument.getName()));
ieElementResult.addAtt(new Att("number",
nextLatestDocument.getNumber()));
ieElementResult.addAtt(new Att("state.state",
nextLatestDocument.getState().getState().getDisplay()));
ieElementResult.addAtt(new Att("CADName",
nextLatestDocument.getCADName()));

// keep adding more attributes or use the arguments passed into
ATTRIBUTE to process...

output.addElement( ieElementResult );

} // end while


Task response = new Task ();
response.addVdb ( output );
return response;
}

}