@Override public boolean handle(Pair<Long, ChildAssociationRef> childAssocPair, Pair<Long, NodeRef> parentNodePair, Pair<Long, NodeRef> childNodePair) { bindFixAssocAndCollectLostAndFound(childNodePair, "deletedChildWithParents", childAssocPair.getFirst(), false); return true; }
@Override public boolean handle(Pair<Long, ChildAssociationRef> childAssocPair, Pair<Long, NodeRef> parentNodePair, Pair<Long, NodeRef> childNodePair) { parentIds.add(parentNodePair.getFirst()); return false; }
@Override public int updatePersonSizeCurrentType() { Map<String, Object> params = new HashMap<String, Object>(2); Long sizeCurrentPropQNameId = qnameDAO.getOrCreateQName(ContentModel.PROP_SIZE_CURRENT).getFirst(); params.put("sizeCurrentQNameId", sizeCurrentPropQNameId); return template.update(UPDATE_PERSON_SIZECURRENT_TYPE, params); }
@Override public boolean handle(Pair<Long, ChildAssociationRef> childAssocPair, Pair<Long, NodeRef> parentNodePair, Pair<Long, NodeRef> childNodePair) { bindFixAssocAndCollectLostAndFound(childNodePair, "childNodeWithDeletedParent", childAssocPair.getFirst(), childAssocPair.getSecond().isPrimary() && exists(childAssocPair.getFirst())); return true; }
@SuppressWarnings({ "unchecked"}) protected List<AuthorityInfo> applyPostQuerySorting(List<AuthorityInfo> results, CannedQuerySortDetails sortDetails) { @SuppressWarnings("rawtypes") final List<Pair<Object, SortOrder>> sortPairs = (List)sortDetails.getSortPairs(); if (sortPairs.size() > 0) { // single sort option - authority display name (else authority name if former is null) Collections.sort(results, new AuthComparator((String) sortPairs.get(0).getFirst(), sortPairs.get(0).getSecond())); } return results; }
public void setJavaClass(Class<?> javaClass) { this.javaClass = javaClass; this.javaClassName = javaClass.getName(); Pair<String, Long> crcPair = CrcHelper.getStringCrcPair(javaClassName, 32, true, true); this.javaClassNameShort = crcPair.getFirst(); this.javaClassNameCrc = crcPair.getSecond(); }
private CannedQueryResults<NodeRef> listImpl(NodeRef contextNodeRef, boolean files, boolean folders) { Set<QName> searchTypeQNames = buildSearchTypesAndIgnoreAspects(files, folders, null).getFirst(); return listImpl(contextNodeRef, searchTypeQNames); }
/** * Public constructor, but not generally useful */ public NodeParametersEntity(QNameDAO qnameDAO) { Pair<Long, QName> qnamePair = qnameDAO.getQName(ContentModel.PROP_ORIGINAL_ID); this.setOriginalIdPropQNameId(qnamePair == null ? -1 : qnamePair.getFirst()); }
public PropertyStringQueryEntity(Short persistedType, Long actualTypeId, String value) { this.persistedType = persistedType; this.actualTypeId = actualTypeId; stringValue = value; // Calculate the crc value from the original value Pair<String, Long> crcPair = CrcHelper.getStringCrcPair(value, 16, false, true); stringEndLower = crcPair.getFirst(); stringCrc = crcPair.getSecond(); }
private CompiledModel getModelByUri(String uri) { for (CompiledModel model : getAllCustomM2Models(false)) { if (uri.equals(getModelNamespaceUriPrefix(model.getM2Model()).getFirst())) { return model; } } return null; }
private CompiledModel getModelByUri(String uri) { for (CompiledModel model : getAllCustomM2Models(false)) { if (uri.equals(getModelNamespaceUriPrefix(model.getM2Model()).getFirst())) { return model; } } return null; }
protected Long getNodeId(NodeRef nodeRef) { Pair<Long, NodeRef> nodePair = nodeDAO.getNodePair(tenantService.getName(nodeRef)); if (nodePair == null) { throw new InvalidNodeRefException("Node ref does not exist: " + nodeRef, nodeRef); } return nodePair.getFirst(); }
private long getNodeIdNotNull(NodeRef nodeRef) { ParameterCheck.mandatory("nodeRef", nodeRef); Pair<Long, NodeRef> nodePair = nodeDAO.getNodePair(nodeRef); if (nodePair == null) { throw new InvalidNodeRefException("Node does not exist: " + nodeRef, nodeRef); } return nodePair.getFirst(); }
public void removeNode(NodeRef base, String path) { NodeRef toRemove = lookup(base, path).getFirst(); if (toRemove == null) { throw new AlfrescoRuntimeException("Not Found: " + path); } fNodeService.deleteNode(toRemove); }
@Override public CustomModelDefinition getCustomModel(String modelName) { ParameterCheck.mandatoryString("modelName", modelName); Pair<CompiledModel, Boolean> compiledModelPair = getCustomCompiledModel(modelName); CustomModelDefinition result = (compiledModelPair == null) ? null : new CustomModelDefinitionImpl( compiledModelPair.getFirst(), compiledModelPair.getSecond(), dictionaryService); return result; }
public void testGetNodeIdsIntervalForType() throws Exception { // Different calls with equivalent parameters should return the same values Pair<Long, Long> interval1 = getNodeIdsInterval(0L, System.currentTimeMillis()); Pair<Long, Long> interval2 = getNodeIdsInterval(null, System.currentTimeMillis()); Pair<Long, Long> interval3 = getNodeIdsInterval(null, null); assertEquals(interval1.getFirst(), interval2.getFirst()); assertEquals(interval2.getFirst(), interval3.getFirst()); assertEquals(interval1.getSecond(), interval2.getSecond()); assertEquals(interval2.getSecond(), interval3.getSecond()); }
public Pair<Long, QName> createValue(QName qname) { String uri = qname.getNamespaceURI(); String localName = qname.getLocalName(); // Create namespace Pair<Long, String> namespaceEntity = getOrCreateNamespace(uri); Long nsId = namespaceEntity.getFirst(); // Create QName QNameEntity entity = createQNameEntity(nsId, localName); return new Pair<Long, QName>(entity.getId(), qname); }
public void testBasicBytes_WithKey() { byte[] bytes = new byte[] {11, 12, 13}; Pair<byte[], AlgorithmParameters> encryptedPair = encryptor.encrypt("mykey1", null, bytes); byte[] decrypted = encryptor.decrypt( "mykey1", encryptedPair.getSecond(), encryptedPair.getFirst()); assertTrue("Encryption round trip failed. ", Arrays.equals(bytes, decrypted)); }
/** * Check that the <code>ContentData</code> is decoded and persisted correctly. */ public void testCreateContentDataNulls() throws Exception { ContentData contentData = new ContentData(null, null, 0L, null, null); Pair<Long, ContentData> resultPair = create(contentData); getAndCheck(resultPair.getFirst(), contentData); }
@Test // Test the initial alfresco startup when the transformer is not there yet. public void noConnectionCheckTest() throws Exception { // Mock a connection failure doThrow(IOException.class).when(remoteTransformerClient).execute(any(), any(HttpGet.class)); Pair<Boolean, String> available = remoteTransformerClient.check(mockLogger); assertFalse("Any failure should result in false", available.getFirst()); assertEquals("Remote TRANSFORMER check failed to connect or to read the response", getMessage(available.getSecond())); assertTransformerBecomesAvailableAgainAfterFailure(); }