本文整理汇总了Java中org.alfresco.service.cmr.replication.ReplicationDefinition类的典型用法代码示例。如果您正苦于以下问题:Java ReplicationDefinition类的具体用法?Java ReplicationDefinition怎么用?Java ReplicationDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ReplicationDefinition类属于org.alfresco.service.cmr.replication包,在下文中一共展示了ReplicationDefinition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadReplicationDefinitions
import org.alfresco.service.cmr.replication.ReplicationDefinition; //导入依赖的package包/类
public List<ReplicationDefinition> loadReplicationDefinitions()
{
checkReplicationActionRootNodeExists();
// Note that in the call to getChildAssocs below, only the specified
// types are included.
// Subtypes of the type action:action will not be returned.
List<ChildAssociationRef> childAssocs = nodeService.getChildAssocs(REPLICATION_ACTION_ROOT_NODE_REF, ACTION_TYPES);
List<ReplicationDefinition> replicationActions = new ArrayList<ReplicationDefinition>(childAssocs.size());
for (ChildAssociationRef actionAssoc : childAssocs)
{
Action nextAction = runtimeActionService.createAction(actionAssoc.getChildRef());
replicationActions.add(new ReplicationDefinitionImpl(nextAction));
}
return replicationActions;
}
示例2: loadReplicationDefinition
import org.alfresco.service.cmr.replication.ReplicationDefinition; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public ReplicationDefinition loadReplicationDefinition(String replicationDefinitionName) {
ReplicationDefinitionImpl rd = (ReplicationDefinitionImpl)
replicationDefinitionPersister.loadReplicationDefinition(replicationDefinitionName);
if(rd != null)
{
// TODO we should rework relationship between action and target
String targetName = rd.getTargetName();
if(targetName != null)
{
// Decorate RD with targetExists
rd.setTargetExists(getTransferService().targetExists(targetName));
}
rd.setSchedule(
scheduledPersistedActionService.getSchedule(rd)
);
}
return rd;
}
示例3: buildTransferDefinition
import org.alfresco.service.cmr.replication.ReplicationDefinition; //导入依赖的package包/类
/**
* Takes a {@link ReplicationDefinition} and a list of
* {@link NodeRef}s, and returns the
* {@link TransferDefinition} which will allow the
* replication to be run.
*/
protected TransferDefinition buildTransferDefinition(
ReplicationDefinition replicationDef, Set<NodeRef> toTransfer)
{
TransferDefinition transferDefinition =
new TransferDefinition();
transferDefinition.setNodes(toTransfer);
transferDefinition.setSync(true);
transferDefinition.setReadOnly(replicationParams.getTransferReadOnly());
// Exclude aspects from transfer
// NOTE: this list of aspects should be synced up with the NodeCrawler in expandPayload to
// ensure a coherent set of nodes are transferred
transferDefinition.setExcludedAspects(excludedAspects);
return transferDefinition;
}
示例4: writeDefinitionReports
import org.alfresco.service.cmr.replication.ReplicationDefinition; //导入依赖的package包/类
private void writeDefinitionReports(final ReplicationDefinition replicationDef, NodeRef sourceReport, NodeRef destinationReport)
{
replicationDef.setLocalTransferReport(sourceReport);
replicationDef.setRemoteTransferReport(destinationReport);
if (replicationDef.getNodeRef() != null)
{
// Record details of the transfer reports
transactionService.getRetryingTransactionHelper().doInTransaction(
new RetryingTransactionHelper.RetryingTransactionCallback<Object>()
{
public Object execute() throws Throwable
{
if (logger.isDebugEnabled())
logger.debug("Exception - writing replication def reports");
replicationDefinitionPersister.saveReplicationDefinition(replicationDef);
return null;
}
}, false, true);
}
}
示例5: testCreation
import org.alfresco.service.cmr.replication.ReplicationDefinition; //导入依赖的package包/类
public void testCreation() throws Exception
{
ReplicationDefinition replicationAction =
replicationService.createReplicationDefinition(ACTION_NAME, "Test Definition");
assertNotNull(replicationAction);
assertEquals("Test Definition", replicationAction.getDescription());
assertEquals(ACTION_NAME, replicationAction.getReplicationName());
String id = replicationAction.getId();
assertNotNull(id);
assertTrue(id.length() > 0);
assertNotNull(replicationAction.getPayload());
assertEquals(0, replicationAction.getPayload().size());
assertNull(replicationAction.getLocalTransferReport());
assertNull(replicationAction.getRemoteTransferReport());
}
示例6: testCreation
import org.alfresco.service.cmr.replication.ReplicationDefinition; //导入依赖的package包/类
public void testCreation() throws Exception
{
ReplicationDefinition replicationAction =
replicationService.createReplicationDefinition(ACTION_NAME, "Test Definition");
assertNotNull(replicationAction);
assertEquals("Test Definition", replicationAction.getDescription());
assertEquals(ACTION_NAME, replicationAction.getReplicationName());
assertEquals(ACTION_QNAME, replicationAction.getReplicationQName());
String id = replicationAction.getId();
assertNotNull(id);
assertTrue(id.length() > 0);
assertNotNull(replicationAction.getPayload());
assertEquals(0, replicationAction.getPayload().size());
assertNull(replicationAction.getLocalTransferReport());
assertNull(replicationAction.getRemoteTransferReport());
}
示例7: testLoadList
import org.alfresco.service.cmr.replication.ReplicationDefinition; //导入依赖的package包/类
public void testLoadList() throws Exception
{
assertEquals(0, replicationService.loadReplicationDefinitions().size());
// Create and store
ReplicationDefinition rd1 = replicationService.createReplicationDefinition(ACTION_NAME, "Test 1");
ReplicationDefinition rd2 = replicationService.createReplicationDefinition(ACTION_NAME2, "Test 2");
assertEquals(0, replicationService.loadReplicationDefinitions().size());
replicationService.saveReplicationDefinition(rd1);
assertEquals(1, replicationService.loadReplicationDefinitions().size());
assertEquals(ACTION_NAME, replicationService.loadReplicationDefinitions().get(0).getReplicationName());
replicationService.saveReplicationDefinition(rd2);
assertEquals(2, replicationService.loadReplicationDefinitions().size());
}
示例8: testLoadByTarget
import org.alfresco.service.cmr.replication.ReplicationDefinition; //导入依赖的package包/类
public void testLoadByTarget() throws Exception
{
assertEquals(0, replicationService.loadReplicationDefinitions().size());
assertEquals(0, replicationService.loadReplicationDefinitions("TestTarget").size());
assertEquals(0, replicationService.loadReplicationDefinitions("TestTarget2").size());
// Store some
ReplicationDefinition rdTT = replicationService.createReplicationDefinition(ACTION_NAME, "Test");
rdTT.setTargetName("TestTarget");
replicationService.saveReplicationDefinition(rdTT);
// Check it shows up correctly
assertEquals(1, replicationService.loadReplicationDefinitions().size());
assertEquals(1, replicationService.loadReplicationDefinitions("TestTarget").size());
assertEquals(0, replicationService.loadReplicationDefinitions("TestTarget2").size());
}
示例9: testTransferDefinitionBuilding
import org.alfresco.service.cmr.replication.ReplicationDefinition; //导入依赖的package包/类
/**
* Test that we turn a replication definition correctly
* into a transfer definition
*/
public void testTransferDefinitionBuilding() throws Exception
{
ReplicationDefinition rd = replicationService.createReplicationDefinition(ACTION_NAME, "Test");
Set<NodeRef> nodes = new HashSet<NodeRef>();
nodes.add(folder1);
nodes.add(content1_1);
TransferDefinition td = replicationActionExecutor.buildTransferDefinition(rd, nodes);
assertEquals(true, td.isSync());
assertEquals(replicationParams.getTransferReadOnly(), td.isReadOnly());
assertEquals(2, td.getNodes().size());
assertEquals(true, td.getNodes().contains(folder1));
assertEquals(true, td.getNodes().contains(content1_1));
}
示例10: buildModel
import org.alfresco.service.cmr.replication.ReplicationDefinition; //导入依赖的package包/类
@Override
protected Map<String, Object> buildModel(ReplicationModelBuilder modelBuilder,
WebScriptRequest req, Status status, Cache cache)
{
// Which definition did they ask for?
String replicationDefinitionName =
req.getServiceMatch().getTemplateVars().get("replication_definition_name");
ReplicationDefinition replicationDefinition =
replicationService.loadReplicationDefinition(replicationDefinitionName);
// Does it exist?
if(replicationDefinition == null) {
throw new WebScriptException(
Status.STATUS_NOT_FOUND,
"No Replication Definition found with that name"
);
}
// Have it turned into simple models
return modelBuilder.buildDetails(replicationDefinition);
}
示例11: buildModel
import org.alfresco.service.cmr.replication.ReplicationDefinition; //导入依赖的package包/类
@Override
protected Map<String, Object> buildModel(ReplicationModelBuilder modelBuilder,
WebScriptRequest req, Status status, Cache cache)
{
// Get all the defined replication definitions
List<ReplicationDefinition> definitions = replicationService.loadReplicationDefinitions();
// How do we need to sort them?
Comparator<Map<String,Object>> sorter = new ReplicationModelBuilder.SimpleSorterByName();
String sort = req.getParameter("sort");
if(sort == null) {
// Default was set above
} else if(sort.equalsIgnoreCase("status")) {
sorter = new ReplicationModelBuilder.SimpleSorterByStatus();
} else if(sort.equalsIgnoreCase("lastRun") ||
sort.equalsIgnoreCase("lastRunTime")) {
sorter = new ReplicationModelBuilder.SimpleSorterByLastRun();
}
// Have them turned into simple models
return modelBuilder.buildSimpleList(definitions, sorter);
}
示例12: tearDown
import org.alfresco.service.cmr.replication.ReplicationDefinition; //导入依赖的package包/类
@Override
protected void tearDown() throws Exception
{
super.tearDown();
UserTransaction txn = transactionService.getUserTransaction();
txn.begin();
personManager.clearPeople();
// Zap any replication definitions we created
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
for(ReplicationDefinition rd : replicationService.loadReplicationDefinitions()) {
replicationService.deleteReplicationDefinition(rd);
}
AuthenticationUtil.clearCurrentSecurityContext();
txn.commit();
}
示例13: createReplicationDefinition
import org.alfresco.service.cmr.replication.ReplicationDefinition; //导入依赖的package包/类
/**
* Creates a new {@link ScriptReplicationDefinition} and sets the replication name and
* the description to the specified values.
*
* @param replicationName A unique identifier used to specify the created
* {@link ScriptReplicationDefinition}.
* @param description A description of the replication
* @return the created {@link ScriptReplicationDefinition}.
* @see org.alfresco.service.cmr.replication.ReplicationService#createReplicationDefinition(String, String)
*/
public ScriptReplicationDefinition createReplicationDefinition(String replicationName, String description)
{
if (logger.isDebugEnabled())
{
StringBuilder msg = new StringBuilder();
msg.append("Creating ScriptReplicationDefinition [")
.append(replicationName).append(", ")
.append(description).append("]");
logger.debug(msg.toString());
}
ReplicationDefinition replicationDefinition = replicationService.createReplicationDefinition(replicationName, description);
return new ScriptReplicationDefinition(serviceRegistry, replicationService, this.getScope(), replicationDefinition);
}
示例14: saveReplicationDefinition
import org.alfresco.service.cmr.replication.ReplicationDefinition; //导入依赖的package包/类
public void saveReplicationDefinition(ScriptReplicationDefinition definition)
{
if (logger.isDebugEnabled())
{
StringBuilder msg = new StringBuilder();
msg.append("Saving ScriptReplicationDefinition [")
.append(definition.getReplicationName()).append(", ")
.append(definition.getDescription()).append("]");
logger.debug(msg.toString());
}
ReplicationDefinition replicationDefinition = definition.getReplicationDefinition();
replicationService.saveReplicationDefinition(replicationDefinition);
}
示例15: loadReplicationDefinition
import org.alfresco.service.cmr.replication.ReplicationDefinition; //导入依赖的package包/类
public ScriptReplicationDefinition loadReplicationDefinition(String replicationName)
{
ReplicationDefinition replicationDefinition = replicationService.loadReplicationDefinition(replicationName);
if(replicationDefinition == null)
return null;
return new ScriptReplicationDefinition(serviceRegistry, replicationService, this.getScope(), replicationDefinition);
}