Search in sources :

Example 91 with ChildAssociationRef

use of org.alfresco.service.cmr.repository.ChildAssociationRef in project records-management by Alfresco.

the class RecordableVersionServiceImpl method createRecordFromLatestVersion.

/**
 * @see org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService#createRecordFromLatestVersion(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef)
 */
@Override
public NodeRef createRecordFromLatestVersion(final NodeRef filePlan, final NodeRef nodeRef) {
    ParameterCheck.mandatory("filePlan", filePlan);
    ParameterCheck.mandatory("nodeRef", nodeRef);
    NodeRef record = null;
    // check for versionable aspect
    if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE)) {
        createSnapshotVersion(nodeRef);
        // get the latest version
        final Version currentVersion = getCurrentVersion(nodeRef);
        if (currentVersion != null && !isRecordedVersion(currentVersion)) {
            // create the record from the current frozen state
            record = authenticationUtil.runAsSystem(new RunAsWork<NodeRef>() {

                public NodeRef doWork() throws Exception {
                    // get the documents readers and writers
                    Pair<Set<String>, Set<String>> readersAndWriters = extendedPermissionService.getReadersAndWriters(nodeRef);
                    // grab the frozen state
                    NodeRef currentFrozenState = currentVersion.getFrozenStateNodeRef();
                    // determine the type of the object
                    QName type = nodeService.getType(currentFrozenState);
                    // grab all the properties
                    Map<QName, Serializable> properties = nodeService.getProperties(currentFrozenState);
                    // grab all the aspects
                    Set<QName> aspects = nodeService.getAspects(currentFrozenState);
                    // create the record
                    NodeRef record = recordService.createRecordFromContent(filePlan, (String) properties.get(ContentModel.PROP_NAME), type, properties, null);
                    // apply aspects to record
                    for (QName aspect : aspects) {
                        // add the aspect, properties have already been set
                        nodeService.addAspect(record, aspect, null);
                    }
                    // apply version record aspect to record
                    PropertyMap versionRecordProps = new PropertyMap(3);
                    versionRecordProps.put(PROP_VERSIONED_NODEREF, nodeRef);
                    versionRecordProps.put(RecordableVersionModel.PROP_VERSION_LABEL, currentVersion.getVersionLabel());
                    versionRecordProps.put(RecordableVersionModel.PROP_VERSION_DESCRIPTION, currentVersion.getDescription());
                    versionRecordProps.put(ContentModel.PROP_VERSION_TYPE, currentVersion.getVersionType());
                    nodeService.addAspect(record, ASPECT_VERSION_RECORD, versionRecordProps);
                    // wire record up to previous record
                    linkToPreviousVersionRecord(nodeRef, record);
                    // set the extended security
                    extendedSecurityService.set(record, readersAndWriters);
                    return record;
                }
            });
            // get the version history
            NodeRef versionHistoryRef = getVersionHistoryNodeRef(nodeRef);
            // get details from the version before we remove it
            int versionNumber = getVersionNumber(currentVersion);
            Map<QName, Serializable> versionProperties = getVersionAspectProperties(currentVersion);
            QName sourceTypeRef = getVersionType(currentVersion);
            // patch-up owner information, which needs to be frozen for recorded versions
            String owner = (String) nodeService.getProperty(currentVersion.getFrozenStateNodeRef(), ContentModel.PROP_OWNER);
            if (owner != null) {
                versionProperties.put(PROP_FROZEN_OWNER, owner);
            }
            // delete the current version
            this.dbNodeService.deleteNode(convertNodeRef(currentVersion.getFrozenStateNodeRef()));
            // create a new version history if we need to
            if (!nodeService.exists(versionHistoryRef)) {
                versionHistoryRef = createVersionHistory(nodeRef);
            }
            // create recorded version nodeRef
            ChildAssociationRef childAssocRef = dbNodeService.createNode(versionHistoryRef, Version2Model.CHILD_QNAME_VERSIONS, QName.createQName(Version2Model.NAMESPACE_URI, Version2Model.CHILD_VERSIONS + "-" + versionNumber), sourceTypeRef, null);
            NodeRef versionNodeRef = childAssocRef.getChildRef();
            // add aspect with the standard version properties to the 'version' node
            nodeService.addAspect(versionNodeRef, Version2Model.ASPECT_VERSION, versionProperties);
            // add the recordedVersion aspect with link to record
            nodeService.addAspect(versionNodeRef, ASPECT_RECORDED_VERSION, Collections.singletonMap(PROP_RECORD_NODE_REF, (Serializable) record));
        }
    }
    return record;
}
Also used : Serializable(java.io.Serializable) Set(java.util.Set) RunAsWork(org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork) QName(org.alfresco.service.namespace.QName) ChildAssociationRef(org.alfresco.service.cmr.repository.ChildAssociationRef) NodeRef(org.alfresco.service.cmr.repository.NodeRef) PropertyMap(org.alfresco.util.PropertyMap) Version(org.alfresco.service.cmr.version.Version)

Example 92 with ChildAssociationRef

use of org.alfresco.service.cmr.repository.ChildAssociationRef in project records-management by Alfresco.

the class BroadcastVitalRecordDefinitionAction method propagateChangeToChildrenOf.

/**
 * Propagates the changes to the children of the node specified.
 *
 * @param actionedUponNodeRef   actioned upon node reference
 */
private void propagateChangeToChildrenOf(NodeRef actionedUponNodeRef) {
    Map<QName, Serializable> parentProps = getNodeService().getProperties(actionedUponNodeRef);
    // parent vital record indicator, default to null if not set
    boolean parentVri = false;
    Boolean parentVriValue = (Boolean) parentProps.get(PROP_VITAL_RECORD_INDICATOR);
    if (parentVriValue != null) {
        parentVri = parentVriValue.booleanValue();
    }
    Period parentReviewPeriod = (Period) parentProps.get(PROP_REVIEW_PERIOD);
    List<ChildAssociationRef> assocs = this.getNodeService().getChildAssocs(actionedUponNodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
    for (ChildAssociationRef nextAssoc : assocs) {
        NodeRef nextChild = nextAssoc.getChildRef();
        if (filePlanService.isFilePlanComponent(nextChild) && !getFreezeService().isFrozen(nextChild)) {
            // If the child is a record, then the VitalRecord aspect needs to be applied or updated
            if (getRecordService().isRecord(nextChild)) {
                if (parentVri) {
                    VitalRecordDefinition vrDefn = getVitalRecordService().getVitalRecordDefinition(nextChild);
                    Map<QName, Serializable> aspectProps = new HashMap<QName, Serializable>();
                    aspectProps.put(PROP_REVIEW_AS_OF, vrDefn.getNextReviewDate());
                    getNodeService().addAspect(nextChild, RecordsManagementModel.ASPECT_VITAL_RECORD, aspectProps);
                } else {
                    getNodeService().removeAspect(nextChild, RecordsManagementModel.ASPECT_VITAL_RECORD);
                }
            } else // copy the vitalRecordDefinition properties from the parent to the child
            {
                Map<QName, Serializable> childProps = getNodeService().getProperties(nextChild);
                childProps.put(PROP_REVIEW_PERIOD, parentReviewPeriod);
                childProps.put(PROP_VITAL_RECORD_INDICATOR, parentVri);
                getNodeService().setProperties(nextChild, childProps);
            }
            // Recurse down the containment hierarchy to all containers
            if (!getRecordService().isRecord(nextChild)) {
                this.propagateChangeToChildrenOf(nextChild);
            }
        }
    }
}
Also used : NodeRef(org.alfresco.service.cmr.repository.NodeRef) Serializable(java.io.Serializable) HashMap(java.util.HashMap) QName(org.alfresco.service.namespace.QName) Period(org.alfresco.service.cmr.repository.Period) ChildAssociationRef(org.alfresco.service.cmr.repository.ChildAssociationRef)

Example 93 with ChildAssociationRef

use of org.alfresco.service.cmr.repository.ChildAssociationRef in project records-management by Alfresco.

the class FilePlanComponentsApiUtils method lookupPathInfo.

protected PathInfo lookupPathInfo(NodeRef nodeRefIn) {
    List<ElementInfo> pathElements = new ArrayList<>();
    Boolean isComplete = Boolean.TRUE;
    final Path nodePath = nodeService.getPath(nodeRefIn);
    ;
    final int pathIndex = 2;
    for (int i = nodePath.size() - pathIndex; i >= 0; i--) {
        Element element = nodePath.get(i);
        if (element instanceof Path.ChildAssocElement) {
            ChildAssociationRef elementRef = ((Path.ChildAssocElement) element).getRef();
            if (elementRef.getParentRef() != null) {
                NodeRef childNodeRef = elementRef.getChildRef();
                if (permissionService.hasPermission(childNodeRef, PermissionService.READ) == AccessStatus.ALLOWED) {
                    Serializable nameProp = nodeService.getProperty(childNodeRef, ContentModel.PROP_NAME);
                    pathElements.add(0, new ElementInfo(childNodeRef.getId(), nameProp.toString()));
                } else {
                    // Just return the pathInfo up to the location where the user has access
                    isComplete = Boolean.FALSE;
                    break;
                }
            }
        }
    }
    String pathStr = null;
    if (!pathElements.isEmpty()) {
        StringBuilder sb = new StringBuilder(120);
        for (PathInfo.ElementInfo e : pathElements) {
            sb.append("/").append(e.getName());
        }
        pathStr = sb.toString();
    } else {
        // There is no path element, so set it to null in order to be
        // ignored by Jackson during serialisation
        isComplete = null;
    }
    return new PathInfo(pathStr, isComplete, pathElements);
}
Also used : Path(org.alfresco.service.cmr.repository.Path) Serializable(java.io.Serializable) ElementInfo(org.alfresco.rest.api.model.PathInfo.ElementInfo) Element(org.alfresco.service.cmr.repository.Path.Element) ElementInfo(org.alfresco.rest.api.model.PathInfo.ElementInfo) ArrayList(java.util.ArrayList) ChildAssociationRef(org.alfresco.service.cmr.repository.ChildAssociationRef) NodeRef(org.alfresco.service.cmr.repository.NodeRef) PathInfo(org.alfresco.rest.api.model.PathInfo) FilterPropBoolean(org.alfresco.repo.node.getchildren.FilterPropBoolean)

Example 94 with ChildAssociationRef

use of org.alfresco.service.cmr.repository.ChildAssociationRef in project SearchServices by Alfresco.

the class LoadAFTSTestData method loadMntTestData.

public static void loadMntTestData() throws Exception {
    SolrCore core = h.getCore();
    properties19 = new HashMap<QName, PropertyValue>();
    properties19.put(ContentModel.PROP_NAME, new StringPropertyValue("Test.hello.txt"));
    n19NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
    n19QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "nineteen");
    n19CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, rootNodeRef, n19QName, n19NodeRef, true, 0);
    addNode(core, dataModel, 1, 19, 1, ContentModel.TYPE_CONTENT, null, properties19, null, "system", new ChildAssociationRef[] { n19CAR }, new NodeRef[] { rootNodeRef }, new String[] { "/" + n19QName.toString() }, n19NodeRef, true);
    properties20 = new HashMap<QName, PropertyValue>();
    properties20.put(ContentModel.PROP_NAME, new StringPropertyValue("Test1.hello.txt"));
    n20NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
    n20QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "twenty");
    n20CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, rootNodeRef, n20QName, n20NodeRef, true, 0);
    addNode(core, dataModel, 1, 20, 1, ContentModel.TYPE_CONTENT, null, properties20, null, "system", new ChildAssociationRef[] { n20CAR }, new NodeRef[] { rootNodeRef }, new String[] { "/" + n20QName.toString() }, n20NodeRef, true);
    properties21 = new HashMap<QName, PropertyValue>();
    properties21.put(ContentModel.PROP_NAME, new StringPropertyValue("one_two_three.txt"));
    n21NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
    n21QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "twentyone");
    n21CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, rootNodeRef, n21QName, n21NodeRef, true, 0);
    addNode(core, dataModel, 1, 21, 1, ContentModel.TYPE_CONTENT, null, properties21, null, "system", new ChildAssociationRef[] { n21CAR }, new NodeRef[] { rootNodeRef }, new String[] { "/" + n21QName.toString() }, n21NodeRef, true);
    properties22 = new HashMap<QName, PropertyValue>();
    properties22.put(ContentModel.PROP_NAME, new StringPropertyValue("one_two_four.txt"));
    n22NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
    n22QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "twnetytwo");
    n22CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, rootNodeRef, n22QName, n22NodeRef, true, 0);
    addNode(core, dataModel, 1, 22, 1, ContentModel.TYPE_CONTENT, null, properties22, null, "system", new ChildAssociationRef[] { n22CAR }, new NodeRef[] { rootNodeRef }, new String[] { "/" + n22QName.toString() }, n22NodeRef, true);
    properties23 = new HashMap<QName, PropertyValue>();
    properties23.put(ContentModel.PROP_NAME, new StringPropertyValue("one_two.txt"));
    n23NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
    n23QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "twentythree");
    n23CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, rootNodeRef, n23QName, n23NodeRef, true, 0);
    addNode(core, dataModel, 1, 23, 1, ContentModel.TYPE_CONTENT, null, properties23, null, "system", new ChildAssociationRef[] { n23CAR }, new NodeRef[] { rootNodeRef }, new String[] { "/" + n23QName.toString() }, n23NodeRef, true);
    properties24 = new HashMap<QName, PropertyValue>();
    properties24.put(ContentModel.PROP_NAME, new StringPropertyValue("Print-Toolkit-3204-The-Print-Toolkit-has-a-new-look-565022.html"));
    n24NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
    n24QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "twentyfour");
    n24CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, rootNodeRef, n24QName, n24NodeRef, true, 0);
    addNode(core, dataModel, 1, 24, 1, ContentModel.TYPE_CONTENT, null, properties24, null, "system", new ChildAssociationRef[] { n24CAR }, new NodeRef[] { rootNodeRef }, new String[] { "/" + n24QName.toString() }, n24NodeRef, true);
    properties25 = new HashMap<QName, PropertyValue>();
    properties25.put(ContentModel.PROP_NAME, new StringPropertyValue("Print-Toolkitf-3204-The-Print-Toolkit-has-a-new-look-565022.html"));
    n25NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
    n25QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "twentyfive");
    n25CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, rootNodeRef, n25QName, n25NodeRef, true, 0);
    addNode(core, dataModel, 1, 25, 1, ContentModel.TYPE_CONTENT, null, properties25, null, "system", new ChildAssociationRef[] { n25CAR }, new NodeRef[] { rootNodeRef }, new String[] { "/" + n25QName.toString() }, n25NodeRef, true);
    properties26 = new HashMap<QName, PropertyValue>();
    properties26.put(ContentModel.PROP_NAME, new StringPropertyValue("apple pear peach 20150911100000.txt"));
    n26NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
    n26QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "twentysix");
    n26CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, rootNodeRef, n26QName, n26NodeRef, true, 0);
    addNode(core, dataModel, 1, 26, 1, ContentModel.TYPE_CONTENT, null, properties26, null, "system", new ChildAssociationRef[] { n26CAR }, new NodeRef[] { rootNodeRef }, new String[] { "/" + n26QName.toString() }, n26NodeRef, true);
    properties27 = new HashMap<QName, PropertyValue>();
    properties27.put(ContentModel.PROP_NAME, new StringPropertyValue("Craig.txt"));
    properties27.put(ContentModel.PROP_CONTENT, new ContentPropertyValue(Locale.UK, 0l, "UTF-8", "text/plain", null));
    content27 = new HashMap<QName, String>();
    content27.put(ContentModel.PROP_CONTENT, "AnalystName Craig");
    n27NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
    n27QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "twentyseven");
    n27CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, rootNodeRef, n27QName, n27NodeRef, true, 0);
    addNode(core, dataModel, 1, 27, 1, ContentModel.TYPE_CONTENT, null, properties27, content27, "system", new ChildAssociationRef[] { n27CAR }, new NodeRef[] { rootNodeRef }, new String[] { "/" + n27QName.toString() }, n27NodeRef, true);
    properties28 = new HashMap<QName, PropertyValue>();
    properties28.put(ContentModel.PROP_NAME, new StringPropertyValue("Scott.txt"));
    properties28.put(ContentModel.PROP_CONTENT, new ContentPropertyValue(Locale.UK, 0l, "UTF-8", "text/plain", null));
    content28 = new HashMap<QName, String>();
    content28.put(ContentModel.PROP_CONTENT, "AnalystName Scott \n Craig");
    n28NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
    n28QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "twentyeight");
    n28CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, rootNodeRef, n28QName, n28NodeRef, true, 0);
    addNode(core, dataModel, 1, 28, 1, ContentModel.TYPE_CONTENT, null, properties28, content28, "system", new ChildAssociationRef[] { n28CAR }, new NodeRef[] { rootNodeRef }, new String[] { "/" + n28QName.toString() }, n28NodeRef, true);
    properties29 = new HashMap<QName, PropertyValue>();
    properties29.put(ContentModel.PROP_NAME, new StringPropertyValue("BASF_2016.txt"));
    n29NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
    n29QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "twentynine");
    n29CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, rootNodeRef, n29QName, n29NodeRef, true, 0);
    addNode(core, dataModel, 1, 29, 1, ContentModel.TYPE_CONTENT, null, properties29, null, "system", new ChildAssociationRef[] { n29CAR }, new NodeRef[] { rootNodeRef }, new String[] { "/" + n29QName.toString() }, n29NodeRef, true);
    properties30 = new HashMap<QName, PropertyValue>();
    properties30.put(ContentModel.PROP_NAME, new StringPropertyValue("BASF_2016(GMT0800).txt"));
    n30NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
    n30QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "thirty");
    n30CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, rootNodeRef, n30QName, n30NodeRef, true, 0);
    addNode(core, dataModel, 1, 30, 1, ContentModel.TYPE_CONTENT, null, properties30, null, "system", new ChildAssociationRef[] { n30CAR }, new NodeRef[] { rootNodeRef }, new String[] { "/" + n30QName.toString() }, n30NodeRef, true);
    properties31 = new HashMap<QName, PropertyValue>();
    properties31.put(ContentModel.PROP_NAME, new StringPropertyValue("BASF_2016-03-08-10-42-19.txt"));
    n31NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
    n31QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "thirtyone");
    n31CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, rootNodeRef, n31QName, n31NodeRef, true, 0);
    addNode(core, dataModel, 1, 31, 1, ContentModel.TYPE_CONTENT, null, properties31, null, "system", new ChildAssociationRef[] { n31CAR }, new NodeRef[] { rootNodeRef }, new String[] { "/" + n31QName.toString() }, n31NodeRef, true);
    properties32 = new HashMap<QName, PropertyValue>();
    properties32.put(ContentModel.PROP_NAME, new StringPropertyValue("BASF_2016 GMT 0800.txt"));
    n32NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
    n32QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "thirtytwo");
    n32CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, rootNodeRef, n32QName, n32NodeRef, true, 0);
    addNode(core, dataModel, 1, 32, 1, ContentModel.TYPE_CONTENT, null, properties32, null, "system", new ChildAssociationRef[] { n32CAR }, new NodeRef[] { rootNodeRef }, new String[] { "/" + n32QName.toString() }, n32NodeRef, true);
}
Also used : StringPropertyValue(org.alfresco.solr.client.StringPropertyValue) NodeRef(org.alfresco.service.cmr.repository.NodeRef) StoreRef(org.alfresco.service.cmr.repository.StoreRef) SolrCore(org.apache.solr.core.SolrCore) QName(org.alfresco.service.namespace.QName) MLTextPropertyValue(org.alfresco.solr.client.MLTextPropertyValue) MultiPropertyValue(org.alfresco.solr.client.MultiPropertyValue) PropertyValue(org.alfresco.solr.client.PropertyValue) StringPropertyValue(org.alfresco.solr.client.StringPropertyValue) ContentPropertyValue(org.alfresco.solr.client.ContentPropertyValue) ChildAssociationRef(org.alfresco.service.cmr.repository.ChildAssociationRef) ContentPropertyValue(org.alfresco.solr.client.ContentPropertyValue)

Example 95 with ChildAssociationRef

use of org.alfresco.service.cmr.repository.ChildAssociationRef in project SearchServices by Alfresco.

the class LoadAFTSTestData method loadEscapingTestData.

public static void loadEscapingTestData() throws Exception {
    SolrCore core = h.getCore();
    NodeRef childNameEscapingNodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
    QName childNameEscapingQName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, COMPLEX_LOCAL_NAME);
    QName pathChildNameEscapingQName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, ISO9075.encode(COMPLEX_LOCAL_NAME));
    ChildAssociationRef complexCAR = new ChildAssociationRef(ContentModel.ASSOC_CHILDREN, rootNodeRef, childNameEscapingQName, childNameEscapingNodeRef, true, 0);
    addNode(core, dataModel, 1, 17, 1, testSuperType, null, null, null, "system", new ChildAssociationRef[] { complexCAR }, new NodeRef[] { rootNodeRef }, new String[] { "/" + pathChildNameEscapingQName.toString() }, childNameEscapingNodeRef, true);
    NodeRef numericNameEscapingNodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
    QName numericNameEscapingQName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, NUMERIC_LOCAL_NAME);
    QName pathNumericNameEscapingQName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, ISO9075.encode(NUMERIC_LOCAL_NAME));
    ChildAssociationRef numericCAR = new ChildAssociationRef(ContentModel.ASSOC_CHILDREN, rootNodeRef, numericNameEscapingQName, numericNameEscapingNodeRef, true, 0);
    addNode(core, dataModel, 1, 18, 1, testSuperType, null, null, null, "system", new ChildAssociationRef[] { numericCAR }, new NodeRef[] { rootNodeRef }, new String[] { "/" + pathNumericNameEscapingQName.toString() }, numericNameEscapingNodeRef, true);
}
Also used : NodeRef(org.alfresco.service.cmr.repository.NodeRef) StoreRef(org.alfresco.service.cmr.repository.StoreRef) SolrCore(org.apache.solr.core.SolrCore) QName(org.alfresco.service.namespace.QName) ChildAssociationRef(org.alfresco.service.cmr.repository.ChildAssociationRef)

Aggregations

ChildAssociationRef (org.alfresco.service.cmr.repository.ChildAssociationRef)260 NodeRef (org.alfresco.service.cmr.repository.NodeRef)204 QName (org.alfresco.service.namespace.QName)110 Test (org.junit.Test)57 HashMap (java.util.HashMap)54 BaseUnitTest (org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest)53 ArrayList (java.util.ArrayList)52 Serializable (java.io.Serializable)42 AlfrescoRuntimeException (org.alfresco.error.AlfrescoRuntimeException)25 FacesContext (javax.faces.context.FacesContext)22 Map (java.util.Map)19 UserTransaction (javax.transaction.UserTransaction)18 Node (org.alfresco.web.bean.repository.Node)17 Date (java.util.Date)15 StoreRef (org.alfresco.service.cmr.repository.StoreRef)13 NodeService (org.alfresco.service.cmr.repository.NodeService)12 SiteInfo (org.alfresco.service.cmr.site.SiteInfo)12 List (java.util.List)11 StringPropertyValue (org.alfresco.solr.client.StringPropertyValue)11 IOException (java.io.IOException)10