public void addAttributes(Node node,params NodeAttribute[] attributes) { if(transaction!=null){ transaction.addAttributes(node, attributes); }else{ validateSchemaEntity(node); int schemaId=sessionMetaData.getSchemaId(); int coreManagerId=core.getCoreManager().getKey(); int sessionId=core.getSessionMetaData().GetSessionId(); Command command = commandBuilder.buildAddAttributes(node.getId(), schemaId, coreManagerId, sessionId, schemaAdapter.getLockTimeout(), attributes); List<NodeAttribute> values = node.getAttributes().values(); command.Push(PlanckDBConstants.OLD_ATTRIBUTES, PlanckDBConstants.ATTRIBUTE_MAP, values.ToArray()); command.Push(PlanckDBConstants.TRANSACTION, PlanckDBConstants.INTEGER, PlanckDBConstants.TRUE); commandExecutor.consume(command); commandsList.Add(command); } }
/** * addAttribute method; * Add attribute * using this method ensure that the server has have accepted * the attribute addition, and it also ensure that all the clients will * receive the change by the same sequence in which the server has. * But it is impossible predict the change acceptance time in the remote * clients because of networks limits. * @param node * @param attributes * @throws AbstractPlanckDBException */ public void AddAttributes(Node node, NodeAttribute[] attributes) { List<NodeAttribute> values = node.getAttributes().values(); NodeAttribute[] oldAttributes = values.ToArray(); Command command = commandBuilder.buildAddAttributes(node.getId(), sessionMetaData.getSchemaId(), core.getCoreManager().getKey(), sessionMetaData.GetSessionId(), lockTimeout ,attributes); command.Push(PlanckDBConstants.OLD_ATTRIBUTES,PlanckDBConstants.ATTRIBUTE_MAP,oldAttributes); commandExecutor.produce(command); }
/** * deleteNode method; * Delete node * Deleting node by this method ensure that the server has have accepted * the node deletion, and it also ensure that all the clients will * receive the change by the same sequence in which the server has. * But it is impossible predict the change acceptance time in the remote * clients because of networks limits. * @param node * @throws PlanckDBException * @throws TransactionException */ public void DeleteNode(Node node) { List<NodeAttribute> values = node.getAttributes().values(); NodeAttribute[] oldAttributes =values.ToArray(); Command command = commandBuilder.buildDeleteNode(node.getId(), node.getLock(), sessionMetaData.getSchemaId(), core.getCoreManager().getKey(), sessionMetaData.GetSessionId(), lockTimeout,oldAttributes); commandExecutor.produce(command); }