if (propertyContainer != null) {
if (!TransactionCommand.inTransaction()) {
logger.log(Level.SEVERE, "setProperty outside of transaction");
throw new FrameworkException(500, "setProperty outside of transaction.");
}
// notify only non-system properties
if (!unvalidated) {
// collect modified properties
if (obj instanceof AbstractNode) {
TransactionCommand.nodeModified(
(AbstractNode)obj,
AbstractPrimitiveProperty.this,
propertyContainer.hasProperty(dbName()) ? propertyContainer.getProperty(dbName()) : null,
value
);
} else if (obj instanceof AbstractRelationship) {
TransactionCommand.relationshipModified(
(AbstractRelationship)obj,
AbstractPrimitiveProperty.this,
propertyContainer.hasProperty(dbName()) ? propertyContainer.getProperty(dbName()) : null,
value
);
}
}
// catch all sorts of errors and wrap them in a FrameworkException
try {
// save space
if (convertedValue == null) {
propertyContainer.removeProperty(dbName());
} else {
// Setting last modified date explicetely is not allowed
if (!AbstractPrimitiveProperty.this.equals(AbstractNode.lastModifiedDate)) {
propertyContainer.setProperty(dbName(), convertedValue);
// set last modified date if not already happened
propertyContainer.setProperty(AbstractNode.lastModifiedDate.dbName(), System.currentTimeMillis());
} else {
logger.log(Level.FINE, "Tried to set lastModifiedDate explicitly (action was denied)");
}
}
} catch (Throwable t) {
t.printStackTrace();
// throw FrameworkException with the given cause
throw new FrameworkException(500, t);
}
if (isIndexed()) {
// do indexing, needs to be done after