Send out requests to all relations to publish

@param oid
The object identifier to publish
@throws TransactionException
978741
private void publishRelations(JsonSimple response, String oid) throws TransactionException {
		log.debug("Publishing Children of '{}'", oid);

		JsonSimple data = getDataFromStorage(oid);
		if (data == null) {
			log.error("Error accessing item data! '{}'", oid);
			emailObjectLink(response, oid,
					"An error occured publishing the related objects for this"
							+ " record. Please check the system logs.");
			return;
		}

		JSONArray relations = data.writeArray("relationships");
		for (Object relation : relations) {
			JsonSimple json = new JsonSimple((JsonObject) relation);
			String broker = json.getString(null, "broker");
			boolean localRecord = broker.equals(brokerUrl);
			String relatedId = json.getString(null, "identifier");

			// We need to find OIDs to match IDs (only for local records)
			String relatedOid = json.getString(null, "oid");
			if (relatedOid == null && localRecord) {
				String identifier = json.getString(null, "identifier");
				if (identifier == null) {
					log.error("NULL identifer provided!");
				}
				relatedOid = idToOid(identifier);
				if (relatedOid == null) {
					log.error("Cannot resolve identifer: '{}'", identifier);
				}
			}

			// We only publish downstream relations (ie. we are their authority)
			boolean authority = json.getBoolean(false, "authority");
			boolean relationPublishRequested = json.getBoolean(false, "relationPublishedRequested");
			if (authority && !relationPublishRequested) {
				// Is this relationship using a curated ID?
				boolean isCurated = json.getBoolean(false, "isCurated");
				if (isCurated) {
					log.debug(" * Publishing '{}'", relatedId);
					// It is a local object
					if (localRecord) {
						createTask(response, relatedOid, "publish");

						// Or remote
					} else {
						JsonObject task = createTask(response, broker,
								relatedOid, "publish");
						// We won't know OIDs for remote systems
						task.remove("oid");
						task.put("identifier", relatedId);
					}
					log.debug(" * Writing relationPublishedRequested for '{}'", relatedId);
					json.getJsonObject().put("relationPublishedRequested",true);
					saveObjectData(data, oid);
				} else {
					log.debug(" * Ignoring non-curated relationship '{}'",
							relatedId);
				}
			}
		}
	}
45445
public void commit(DBTransaction transaction) {
        try {
            applyUpdates(transaction);
        } catch (Exception e) {
            m_logger.error("Updates failed", e);
            throw e;
        } finally {
            transaction.clear();
        }
    }
1301640
public BranchEvent setTransactionID(String transactionID) {
        return addStandardProperty(Defines.Jsonkey.TransactionID.getKey(), transactionID);
    }
1070963
public void fireRelationReadEvent(Relation relation)
   {
      if (m_projectListeners != null)
      {
         for (ProjectListener listener : m_projectListeners)
         {
            listener.relationRead(relation);
         }
      }
   }
920661
public List<ProcessorResult> handleWrite() throws ODataException {
        LOG.info("Handling transactional operations per each odata request.");
        List<ProcessorResult> resultList = new ArrayList<>();

        try {
            for (ChangeSetEntity changeSetEntity : changeSetEntities) {
                ODataRequestContext odataRequestContext = changeSetEntity.getRequestContext();
                ODataUri requestUri = odataRequestContext.getUri();
                ODataRequest.Method method = odataRequestContext.getRequest().getMethod();

                ProcessorResult result = null;
                if (method == ODataRequest.Method.POST) {
                    result = handlePOST(odataRequestContext, requestUri, changeSetEntity);
                } else if (method == ODataRequest.Method.PUT || method == ODataRequest.Method.PATCH) {
                    result = handlePutAndPatch(odataRequestContext, requestUri, changeSetEntity);
                } else if (method == ODataRequest.Method.DELETE) {
                    result = handleDelete(odataRequestContext, requestUri, changeSetEntity);
                }
                resultList.add(result);
            }

            commitTransactions();
        } catch (ODataException e) {
            LOG.error("Transaction could not be processed, rolling back", e);
            rollbackTransactions();
            throw e;
        }
        return resultList;
    }
238320
Ab.BroadcastResponse sendTransaction(Common.Envelope transaction) throws Exception {
        if (shutdown) {
            throw new TransactionException(format("Orderer %s was shutdown.", name));
        }

        logger.debug(format("Orderer.sendTransaction %s", toString()));

        OrdererClient localOrdererClient = getOrdererClient();

        try {
            return localOrdererClient.sendTransaction(transaction);
        } catch (Throwable t) {
            removeOrdererClient(true);
            throw t;

        }

    }
1195889
private void writeObject(ObjectOutputStream out) throws IOException {
        out.defaultWriteObject();
        out.writeUTF(params.getId());
    }
1348942
@Override
    public ProcessorResult handleWrite(Object entity) throws ODataException {
        if (ODataUriUtil.isRefPathUri(getoDataUri())) {
            return processLink((ODataLink) entity);
        } else {
            if (entity != null) {
                throw new ODataBadRequestException("The body of a DELETE request must be empty.");
            }

            return processEntity();
        }
    }
20957
public Collection<ProposalResponse> sendTransactionProposal(TransactionProposalRequest transactionProposalRequest, Collection<Peer> peers) throws ProposalException, InvalidArgumentException {

        return sendProposal(transactionProposalRequest, peers);
    }
386516
protected function copyNodes($oids) {
    $this->requireTransaction();
    $persistenceFacade = $this->getPersistenceFacade();
    $session = $this->getSession();

    // restore the request from session
    $nodeOID = ObjectId::parse($this->getRequestValue('oid'));

    // check for iterator in session
    $iterator = PersistentIterator::load(self::ITERATOR_ID_VAR, $persistenceFacade, $session);

    // no iterator, finish
    if ($iterator == null || !$iterator->valid()) {
      // set the result and finish
      $this->endProcess($this->getCopyOID($nodeOID));
    }

    // process nodes
    $counter = 0;
    while ($iterator->valid() && $counter < $this->getRequestValue('nodesPerCall')) {
      $currentOID = $iterator->current();
      $this->copyNode($currentOID);

      $iterator->next();
      $counter++;
    }

    // decide what to do next
    if ($iterator->valid()) {
      // proceed with current iterator
      $iterator->save();

      $name = $this->getMessage()->getText('Copying tree: continue with %0%', [$iterator->current()]);
      $this->addWorkPackage($name, 1, [null], 'copyNodes');
    }
    else {
      // set the result and finish
      $this->endProcess($this->getCopyOID($nodeOID));
    }
  }
605353
public void sendRequest(ClientTransaction ct) throws TransactionDoesNotExistException, SipException {
		final Request request = ct.getRequest();
		ensureCorrectDialogLocalTag(request);
		if (tracer.isInfoEnabled()) {
			tracer.info(String.valueOf(ct)+" sending request:\n"+request);
		}
		wrappedDialog.sendRequest(((ClientTransactionWrapper)ct).getWrappedClientTransaction());		
	}
79389
public static void putTransactionId(final String transactionId) {
		if ((transactionId != null) && (0 < transactionId.length())) {
			MDC.put(TRANSACTION_ID, transactionId);
		}
	}
1347303
protected function copyNode(ObjectId $oid) {
    $logger = $this->getLogger();
    if ($logger->isDebugEnabled()) {
      $logger->debug("Copying node ".$oid);
    }
    $persistenceFacade = $this->getPersistenceFacade();

    // load the original node
    $node = $persistenceFacade->load($oid);
    if ($node == null) {
      throw new PersistenceException("Can't load node '".$oid."'");
    }

    // check if we already have a copy of the node
    $nodeCopy = $this->getCopy($node->getOID());
    if ($nodeCopy == null) {
      // if not, create it
      $nodeCopy = $persistenceFacade->create($node->getType());
      $node->copyValues($nodeCopy, false);
    }

    // save copy
    $this->registerCopy($node, $nodeCopy);

    if ($logger->isInfoEnabled()) {
      $logger->info("Copied: ".$node->getOID()." to ".$nodeCopy->getOID());
    }
    if ($logger->isDebugEnabled()) {
      $logger->debug($nodeCopy->__toString());
    }

    // create the connections to already copied relatives
    // this must be done after saving the node in order to have a correct oid
    $mapper = $node->getMapper();
    $relations = $mapper->getRelations();
    foreach ($relations as $relation) {
      if ($relation->getOtherNavigability()) {
        $otherRole = $relation->getOtherRole();
        $relativeValue = $node->getValue($otherRole);
        $relatives = $relation->isMultiValued() ? $relativeValue :
                ($relativeValue != null ? [$relativeValue] : []);
        foreach ($relatives as $relative) {
          $copiedRelative = $this->getCopy($relative->getOID());
          if ($copiedRelative != null) {
            $nodeCopy->addNode($copiedRelative, $otherRole);
            if ($logger->isDebugEnabled()) {
              $logger->debug("Added ".$copiedRelative->getOID()." to ".$nodeCopy->getOID());
              $logger->debug($copiedRelative->__toString());
            }
          }
        }
      }
    }
    return $nodeCopy;
  }
444301
public void publish(Object event) {
        Objects.requireNonNull(event, Required.EVENT.toString());
        
        this.eventBus.post(event);
        this.events.getAndIncrement();
    }
117390
public void writeExternal(final ObjectOutput out) throws IOException {
        out.writeLong( this.size );
        out.writeInt( this.nodeId );
    }
714069
@Override
    public ProcessorResult handleWrite(Object action) throws ODataException {
        Operation operation;
        if (action instanceof Operation) {
            operation = (Operation) action;
            Object data = operation.doOperation(getODataRequestContext(), getDataSourceFactory());
            if (data == null) {
                return new ProcessorResult(ODataResponse.Status.NO_CONTENT);
            } else {
                return new ProcessorResult(ODataResponse.Status.CREATED, QueryResult.from(data));
            }
        } else {
            throw new ODataBadRequestException("Incorrect operation instance");
        }
    }
931311
public void removeTransaction(String txId) {
            if(this.transactionMap.remove(txId) != null) {
                    if(logger.isDebugEnabled()) {
                            logger.debug("Transaction "+txId+" removed from proxy.");
                    }
            }
            checkAndCleanProxy();
    }