return nodeTypeData != null;
}
public NodeData initNodetypesRoot(NodeData nsSystem, boolean addACL) throws RepositoryException
{
PlainChangesLog changesLog = new PlainChangesLogImpl();
TransientNodeData jcrNodetypes;
long start = System.currentTimeMillis();
if (addACL)
{
InternalQName[] mixins = new InternalQName[]{Constants.EXO_OWNEABLE, Constants.EXO_PRIVILEGEABLE};
jcrNodetypes =
TransientNodeData.createNodeData(nsSystem, Constants.JCR_NODETYPES, Constants.NT_UNSTRUCTURED, mixins,
Constants.NODETYPESROOT_UUID);
AccessControlList acl = jcrNodetypes.getACL();
TransientPropertyData primaryType =
TransientPropertyData.createPropertyData(jcrNodetypes, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
new TransientValueData(jcrNodetypes.getPrimaryTypeName()));
changesLog.add(ItemState.createAddedState(jcrNodetypes)).add(ItemState.createAddedState(primaryType));
// jcr:mixinTypes
List<ValueData> mixValues = new ArrayList<ValueData>();
for (InternalQName mixin : mixins)
{
mixValues.add(new TransientValueData(mixin));
}
TransientPropertyData exoMixinTypes =
TransientPropertyData.createPropertyData(jcrNodetypes, Constants.JCR_MIXINTYPES, PropertyType.NAME, true,
mixValues);
TransientPropertyData exoOwner =
TransientPropertyData.createPropertyData(jcrNodetypes, Constants.EXO_OWNER, PropertyType.STRING, false,
new TransientValueData(acl.getOwner()));
List<ValueData> permsValues = new ArrayList<ValueData>();
for (int i = 0; i < acl.getPermissionEntries().size(); i++)
{
AccessControlEntry entry = acl.getPermissionEntries().get(i);
permsValues.add(new TransientValueData(entry));
}
TransientPropertyData exoPerms =
TransientPropertyData.createPropertyData(jcrNodetypes, Constants.EXO_PERMISSIONS,
ExtendedPropertyType.PERMISSION, true, permsValues);
changesLog.add(ItemState.createAddedState(exoMixinTypes)).add(ItemState.createAddedState(exoOwner)).add(
ItemState.createAddedState(exoPerms));
changesLog.add(new ItemState(jcrNodetypes, ItemState.MIXIN_CHANGED, false, null));
}
else
{
jcrNodetypes =
TransientNodeData.createNodeData(nsSystem, Constants.JCR_NODETYPES, Constants.NT_UNSTRUCTURED,
Constants.NODETYPESROOT_UUID);
TransientPropertyData primaryType =
TransientPropertyData.createPropertyData(jcrNodetypes, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
new TransientValueData(jcrNodetypes.getPrimaryTypeName()));
changesLog.add(ItemState.createAddedState(jcrNodetypes)).add(ItemState.createAddedState(primaryType));
}
if (log.isDebugEnabled())
{
log.debug("/jcr:system/jcr:nodetypes is created, creation time: " + (System.currentTimeMillis() - start)