i'm using this code to define a property:

  InternalValue[] defaultValues1 = {
      InternalValue.create(Calendar.getInstance())
  };

  PropDefImpl createdDef = new PropDefImpl();
  createdDef.setName(new QName(URI_TICKET, "created"));
  createdDef.setRequiredType(PropertyType.DATE);
  createdDef.setAutoCreated(true);
  createdDef.setDefaultValues(defaultValues1);
  createdDef.setMandatory(true);
  createdDef.setOnParentVersion(OnParentVersionAction.INITIALIZE);
  createdDef.setProtected(true);
  createdDef.setMultiple(false);
  createdDef.setDeclaringNodeType(ticketDef.getName());

with this code, the declaring node type definition successfully registers.

however, looking at custom_nodetypes.xml, the default value is being set to the moment in time that i execute the above code to register the node type ("<defaultValue>2005-06-20T17:43:47.364-07:00</defaultValue>"). this makes a kind of sense, but it's not what i want.

how can i define the property such that the property's value is set to the time when the node is created, not when the node type is registered? this is exactly how jcr:created behaves, isn't it?

Reply via email to