• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java ScriptLocation类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.alfresco.service.cmr.repository.ScriptLocation的典型用法代码示例。如果您正苦于以下问题:Java ScriptLocation类的具体用法?Java ScriptLocation怎么用?Java ScriptLocation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

ScriptLocation类属于org.alfresco.service.cmr.repository包,在下文中一共展示了ScriptLocation类的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: execute

点赞 3

import org.alfresco.service.cmr.repository.ScriptLocation; //导入依赖的package包/类
/**
 * Execute script
 * 
 * @param location  the location of the script 
 * @param model     context model
 * @return Object   the result of the script
 */
protected Object execute(ScriptProcessor processor, ScriptLocation location, Map<String, Object> model)
{
    ParameterCheck.mandatory("location", location);
    if (logger.isDebugEnabled())
    {
        logger.debug("Executing script:\n" + location);
    }
    try
    {
        return processor.execute(location, model);
    }
    catch (Throwable err)
    {
        throw translateProcessingException(location.toString(), err);
    }
}
 

开发者ID:Alfresco,
项目名称:alfresco-repository,
代码行数:24,
代码来源:ScriptServiceImpl.java

示例2: testJSAPI

点赞 3

import org.alfresco.service.cmr.repository.ScriptLocation; //导入依赖的package包/类
public void testJSAPI() throws Exception
{
    NodeRef jpgOrig = createOriginalContent(this.folder, MimetypeMap.MIMETYPE_IMAGE_JPEG);
    NodeRef gifOrig = createOriginalContent(this.folder, MimetypeMap.MIMETYPE_IMAGE_GIF);
    NodeRef pdfOrig = createOriginalContent(this.folder, MimetypeMap.MIMETYPE_PDF);
    NodeRef docOrig = createOriginalContent(this.folder, MimetypeMap.MIMETYPE_WORD);

    Map<String, Object> model = new HashMap<String, Object>(2);
    model.put("jpgOrig", jpgOrig);
    model.put("gifOrig", gifOrig);
    model.put("pdfOrig", pdfOrig);
    model.put("docOrig", docOrig);

    ScriptLocation location = new ClasspathScriptLocation("org/alfresco/repo/thumbnail/script/test_thumbnailAPI.js");
    this.scriptService.executeScript(location, model);
}
 

开发者ID:Alfresco,
项目名称:alfresco-repository,
代码行数:17,
代码来源:ThumbnailServiceImplTest.java

示例3: testJSAPI

点赞 3

import org.alfresco.service.cmr.repository.ScriptLocation; //导入依赖的package包/类
public void testJSAPI() throws Exception
{
    // Create a site with a custom property
    SiteInfo siteInfo = this.siteService.createSite(TEST_SITE_PRESET, "mySiteWithCustomProperty", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
    NodeRef siteNodeRef = siteInfo.getNodeRef();
    Map<QName, Serializable> properties = new HashMap<QName, Serializable>(1);
    properties.put(QName.createQName(SiteModel.SITE_CUSTOM_PROPERTY_URL, "additionalInformation"), "information");
    this.nodeService.addAspect(siteNodeRef, QName.createQName(SiteModel.SITE_MODEL_URL, "customSiteProperties"), properties);
    
    // Create a model to pass to the unit test scripts
    Map<String, Object> model = new HashMap<String, Object>();
    model.put("customSiteName", "mySiteWithCustomProperty");
    model.put("preexistingSiteCount", siteService.listSites(null, null).size());
    
    // Execute the unit test script
    ScriptLocation location = new ClasspathScriptLocation("org/alfresco/repo/site/script/test_siteService.js");
    this.scriptService.executeScript(location, model);
}
 

开发者ID:Alfresco,
项目名称:alfresco-repository,
代码行数:19,
代码来源:SiteServiceImplTest.java

示例4: javascriptAPI

点赞 3

import org.alfresco.service.cmr.repository.ScriptLocation; //导入依赖的package包/类
@Test @RunAsUser(userName=USER_TWO_NAME) public void javascriptAPI() throws Exception
{
    TRANSACTION_HELPER.doInTransaction(new RetryingTransactionCallback<Void>()
    {
        public Void execute() throws Throwable
        {
            Map<String, Object> model = new HashMap<String, Object>();
            model.put("testNode", testDoc_UserOne);
            
            ScriptLocation location = new ClasspathScriptLocation("org/alfresco/repo/rating/script/test_ratingService.js");
            SCRIPT_SERVICE.executeScript(location, model);
            
            return null;
        }
    });
}
 

开发者ID:Alfresco,
项目名称:alfresco-repository,
代码行数:17,
代码来源:RatingServiceIntegrationTest.java

示例5: test2ClasspathLocationBehaviour

点赞 3

import org.alfresco.service.cmr.repository.ScriptLocation; //导入依赖的package包/类
public void test2ClasspathLocationBehaviour()
{
	// Register the onCreateNode behaviour script
	ScriptLocation location = new ClasspathScriptLocation("org/alfresco/repo/jscript/test_onCreateNode_cmContent.js");
	ScriptBehaviour behaviour = new ScriptBehaviour(this.serviceRegistry, location);
	
	this.policyComponent.bindClassBehaviour(
			QName.createQName(NodeServicePolicies.OnCreateNodePolicy.NAMESPACE, "onCreateNode"),
			ContentModel.TYPE_CONTENT,
			behaviour);
	
	// Create a content node
	Map<QName, Serializable> props = new HashMap<QName, Serializable>(1);
	props.put(ContentModel.PROP_NAME, "myDoc.txt");
	ChildAssociationRef childAssoc = this.nodeService.createNode(
			this.folderNodeRef,
			ContentModel.ASSOC_CONTAINS,
			QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "myDoc.txt"),
			ContentModel.TYPE_CONTENT,
			props);
	
	// Since the behavoiour will have been run check that the titled aspect has been applied
	assertTrue(this.nodeService.hasAspect(childAssoc.getChildRef(), ContentModel.ASPECT_TITLED));
}
 

开发者ID:Alfresco,
项目名称:alfresco-repository,
代码行数:25,
代码来源:ScriptBehaviourTest.java

示例6: testJSAPI

点赞 3

import org.alfresco.service.cmr.repository.ScriptLocation; //导入依赖的package包/类
@Test public void testJSAPI() throws Exception
{
    TRANSACTION_HELPER.doInTransaction(new RetryingTransactionCallback<Void>()
    {
        @Override public Void execute() throws Throwable
        {
            // This test is running as user1 and the JavaScript needs to know that.
            Map<String, Object> model = new HashMap<String, Object>();
            model.put("username1", testUser1.getUsername());
            model.put("username2", testUser2.getUsername());
            
            ScriptLocation location = new ClasspathScriptLocation("org/alfresco/repo/preference/script/test_preferenceService.js");
            SCRIPT_SERVICE.executeScript(location, model);
            
            return null;
        }
    });
}
 

开发者ID:Alfresco,
项目名称:alfresco-repository,
代码行数:19,
代码来源:PreferenceServiceImplTest.java

示例7: test92JSAPI

点赞 3

import org.alfresco.service.cmr.repository.ScriptLocation; //导入依赖的package包/类
public void test92JSAPI() throws Exception
{
    asyncOccurs.awaitExecution(new RetryingTransactionCallback<Void>()
    {
        @Override
        public Void execute() throws Throwable
        {
             Map<String, Object> model = new HashMap<String, Object>(0);
             model.put("folder", folder);
             model.put("subFolder", subFolder);
             model.put("document", document);
             model.put("subDocument", subDocument);
             model.put("tagScopeTest", false);
             
             ScriptLocation location = new ClasspathScriptLocation("org/alfresco/repo/tagging/script/test_taggingService.js");
             scriptService.executeScript(location, model);
             
             // Let the script run
             return null;
        }
    });
}
 

开发者ID:Alfresco,
项目名称:community-edition-old,
代码行数:23,
代码来源:TaggingServiceImplTest.java

示例8: executeInScope

点赞 3

import org.alfresco.service.cmr.repository.ScriptLocation; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@SuppressWarnings("unchecked")
@Override
public Object executeInScope(final ScriptLocation location, final Object scope)
{
    final ScriptProcessor scriptProcessor = this.processorByName.containsKey(this.activeScriptProcessor) ? this.processorByName
            .get(this.activeScriptProcessor) : this.defaultScriptProcessor;

    final Object result;
    if (scriptProcessor instanceof EnhancedScriptProcessor<?>)
    {
        result = ((EnhancedScriptProcessor<ScriptLocation>) scriptProcessor).executeInScope(location, scope);
    }
    else
    {
        throw new ScriptException("Active script processor does not support EnhancedScriptProcessor");
    }

    return result;
}
 

开发者ID:AFaust,
项目名称:alfresco-enhanced-script-environment,
代码行数:23,
代码来源:SwitchableScriptProcessor.java

示例9: initializeScope

点赞 3

import org.alfresco.service.cmr.repository.ScriptLocation; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@SuppressWarnings("unchecked")
@Override
public Object initializeScope(final ScriptLocation location)
{
    final ScriptProcessor scriptProcessor = this.processorByName.containsKey(this.activeScriptProcessor) ? this.processorByName
            .get(this.activeScriptProcessor) : this.defaultScriptProcessor;

    final Object result;
    if (scriptProcessor instanceof EnhancedScriptProcessor<?>)
    {
        result = ((EnhancedScriptProcessor<ScriptLocation>) scriptProcessor).initializeScope(location);
    }
    else
    {
        throw new ScriptException("Active script processor does not support EnhancedScriptProcessor");
    }

    return result;
}
 

开发者ID:AFaust,
项目名称:alfresco-enhanced-script-environment,
代码行数:23,
代码来源:SwitchableScriptProcessor.java

示例10: getSupportedReferencePathTypes

点赞 3

import org.alfresco.service.cmr.repository.ScriptLocation; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Collection<ReferencePathType> getSupportedReferencePathTypes()
{
    final Collection<ReferencePathType> supportedTypes = new ArrayList<ReferenceScript.ReferencePathType>(
            Arrays.<ReferencePathType> asList(CommonReferencePath.FILE, CommonReferencePath.CLASSPATH));

    final ScriptLocation scriptLocation = this.getScriptLocation();

    if (scriptLocation instanceof NodeScriptLocation)
    {
        supportedTypes.add(RepositoryReferencePath.NODE_REF);
        supportedTypes.add(RepositoryReferencePath.CONTENT_PROPERTY);
    }

    supportedTypes.add(RepositoryReferencePath.FILE_FOLDER_PATH);

    return supportedTypes;
}
 

开发者ID:AFaust,
项目名称:alfresco-enhanced-script-environment,
代码行数:22,
代码来源:ScriptLocationAdapter.java

示例11: getScript

点赞 3

import org.alfresco.service.cmr.repository.ScriptLocation; //导入依赖的package包/类
/**
 *
 * {@inheritDoc}
 */
@Override
protected RegisterableScript<ScriptLocation> getScript(final String resourcePath)
{
    final RegisterableScript<ScriptLocation> result;
    if (resourcePath.matches("^(classpath(\\*)?:)+.*$"))
    {
        final ClasspathRegisterableScript script = new ClasspathRegisterableScript();
        final String simplePath = resourcePath.replaceAll("classpath(\\*)?:", "");
        final ClassPathResource classpathResource = new ClassPathResource(simplePath);
        script.setScriptResource(classpathResource);
        result = script;
    }
    else
    {
        LOGGER.warn("Can't create script from {} - needs to be a classpath resource", resourcePath);
        result = null;
    }
    return result;
}
 

开发者ID:AFaust,
项目名称:alfresco-enhanced-script-environment,
代码行数:24,
代码来源:RepositoryVersionRegisterableScriptClasspathScanner.java

示例12: executeScript

点赞 2

import org.alfresco.service.cmr.repository.ScriptLocation; //导入依赖的package包/类
/**
 * @see org.alfresco.service.cmr.repository.ScriptService#executeScript(org.alfresco.service.cmr.repository.ScriptLocation, java.util.Map)
 */
public Object executeScript(ScriptLocation location, Map<String, Object> model)
	throws ScriptException
{
	ParameterCheck.mandatory("location", location);
    ScriptProcessor scriptProcessor = getScriptProcessor(location.toString());
    return execute(scriptProcessor, location, model);
}
 

开发者ID:Alfresco,
项目名称:alfresco-repository,
代码行数:11,
代码来源:ScriptServiceImpl.java

示例13: ScriptBehaviour

点赞 2

import org.alfresco.service.cmr.repository.ScriptLocation; //导入依赖的package包/类
public ScriptBehaviour(ServiceRegistry serviceRegistry, ScriptLocation location, NotificationFrequency frequency)
{
	super(frequency);
    ParameterCheck.mandatory("Location", location);
    ParameterCheck.mandatory("ServiceRegistry", serviceRegistry);
    this.location = location;
    this.serviceRegistry = serviceRegistry;
}
 

开发者ID:Alfresco,
项目名称:alfresco-repository,
代码行数:9,
代码来源:ScriptBehaviour.java

示例14: testJavascriptAPI

点赞 2

import org.alfresco.service.cmr.repository.ScriptLocation; //导入依赖的package包/类
public void testJavascriptAPI() throws Exception
{
   ServiceRegistry serviceRegistry = (ServiceRegistry)ctx.getBean("ServiceRegistry");
   
   // Setup some replication tasks
   ReplicationDefinition empty = replicationService.createReplicationDefinition(ACTION_NAME, "Empty");
   
   ReplicationDefinition persisted = replicationService.createReplicationDefinition(ACTION_NAME2, "Persisted");
   persisted.setTargetName(TRANSFER_TARGET);
   persisted.getPayload().add(
         new NodeRef("workspace://SpacesStore/Testing")
   );
   persisted.getPayload().add(
         new NodeRef("workspace://SpacesStore/Testing2")
   );
   replicationService.saveReplicationDefinition(persisted);
   
   ReplicationDefinition persisted2 = replicationService.createReplicationDefinition(ACTION_NAME3, "Persisted2");
   persisted2.setTargetName("AnotherTarget");
   replicationService.saveReplicationDefinition(persisted2);
   
   // Call the test 
   Map<String, Object> model = new HashMap<String, Object>();
   model.put("Empty", new ScriptReplicationDefinition(serviceRegistry, replicationService, null, empty));
   model.put("EmptyName", ACTION_NAME);
   model.put("Persisted", new ScriptReplicationDefinition(serviceRegistry, replicationService, null, persisted));
   model.put("PersistedName", ACTION_NAME2);
   model.put("PersistedNodeRef", persisted.getNodeRef().toString());
   model.put("PersistedTarget", persisted.getTargetName());
   model.put("Persisted2", new ScriptReplicationDefinition(serviceRegistry, replicationService, null, persisted2));
   model.put("Persisted2Name", ACTION_NAME3);
   model.put("Persisted2NodeRef", persisted2.getNodeRef().toString());
   model.put("Persisted2Target", persisted2.getTargetName());
   
   ScriptLocation location = new ClasspathScriptLocation("org/alfresco/repo/replication/script/test_replicationService.js");
   this.scriptService.executeScript(location, model);
}
 

开发者ID:Alfresco,
项目名称:alfresco-repository,
代码行数:38,
代码来源:ReplicationServiceIntegrationTest.java

示例15: testJavascriptAPI

点赞 2

import org.alfresco.service.cmr.repository.ScriptLocation; //导入依赖的package包/类
public void testJavascriptAPI() throws Exception
{
    Map<String, Object> model = new HashMap<String, Object>();
    model.put("testDoc", this.document.toString());
    model.put("testDocName", this.documentName);
    model.put("testAssociatedDoc", this.associatedDoc.toString());
    model.put("folder", this.folder.toString());
    model.put("folderName", this.folderName);
    
    ScriptLocation location = new ClasspathScriptLocation("org/alfresco/repo/forms/script/test_formService.js");
    this.scriptService.executeScript(location, model);
}
 

开发者ID:Alfresco,
项目名称:alfresco-repository,
代码行数:13,
代码来源:FormServiceImplTest.java

示例16: testJSAPI

点赞 2

import org.alfresco.service.cmr.repository.ScriptLocation; //导入依赖的package包/类
public void testJSAPI() throws Exception
{
    ScriptLocation location = new ClasspathScriptLocation("org/alfresco/repo/activities/script/test_activityService.js");
    String result = (String)this.scriptService.executeScript(location, new HashMap<String, Object>(0));
    
    // Check the result and fail if message returned
    if (result != null && result.length() != 0)
    {
        fail("The activity service test JS script failed: " + result);
    }
}
 

开发者ID:Alfresco,
项目名称:alfresco-repository,
代码行数:12,
代码来源:ActivityServiceImplTest.java

示例17: testJSAPI

点赞 2

import org.alfresco.service.cmr.repository.ScriptLocation; //导入依赖的package包/类
public void testJSAPI() throws Exception
{
    /**
     * Prepare some dummy data for tests
     */
    TransferTargetImpl dummyTarget = new TransferTargetImpl();
    dummyTarget.setName("dummyTarget");
    dummyTarget.setNodeRef(new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "4"));
    
    Set<TransferTarget>dummyTargets = new HashSet<TransferTarget>();
    dummyTargets.add(dummyTarget);
    
    TransferService mockedTransferService = Mockito.mock(TransferService.class);
    scriptTransferService.setTransferService(mockedTransferService);
    
    // When the transfer method is called return a node ref - mocks a good call.
    // When the transfer method is called with a transfer name of exception - throw a transferException
    Mockito.when(mockedTransferService.transfer(Matchers.anyString(), Matchers.isA(TransferDefinition.class))).thenReturn(new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "123"));
    Mockito.when(mockedTransferService.transfer(Matchers.eq("exception"), Matchers.isA(TransferDefinition.class))).thenThrow(new TransferException("mocked transfer exception"));
    
    // When getTransferTarget called return a TransferTarget      
    Mockito.when(mockedTransferService.getTransferTarget(Matchers.anyString())).thenReturn(dummyTarget);
    Mockito.when(mockedTransferService.getTransferTargets(Matchers.anyString())).thenReturn(dummyTargets);
    Mockito.when(mockedTransferService.getTransferTargets()).thenReturn(dummyTargets);
    
    // Execute the unit test script
    Map<String, Object> model = new HashMap<String, Object>(1);
    ScriptLocation location = new ClasspathScriptLocation("org/alfresco/repo/transfer/script/test_transferService.js");
    this.scriptService.executeScript(location, model);
        
 }
 

开发者ID:Alfresco,
项目名称:alfresco-repository,
代码行数:32,
代码来源:ScriptTransferServiceTest.java

示例18: testJavascriptAPI

点赞 2

import org.alfresco.service.cmr.repository.ScriptLocation; //导入依赖的package包/类
public void testJavascriptAPI() throws Exception
{
    Map<String, Object> model = new HashMap<String, Object>();
    model.put("testSourceNode", this.nodeWithImageContent);
    model.put("testDocNode", this.nodeWithDocContent);
    
    ScriptLocation location = new ClasspathScriptLocation("org/alfresco/repo/rendition/script/test_renditionService.js");
    this.scriptService.executeScript(location, model);
}
 

开发者ID:Alfresco,
项目名称:alfresco-repository,
代码行数:10,
代码来源:RenditionServiceIntegrationTest.java

示例19: test1EnableDisableBehaviour

点赞 2

import org.alfresco.service.cmr.repository.ScriptLocation; //导入依赖的package包/类
public void test1EnableDisableBehaviour()
{
	// Register the onCreateNode behaviour script
	ScriptLocation location = new ClasspathScriptLocation("org/alfresco/repo/jscript/test_onCreateNode_cmContent.js");
	ScriptBehaviour behaviour = new ScriptBehaviour(this.serviceRegistry, location);
	
	this.policyComponent.bindClassBehaviour(
			QName.createQName(NodeServicePolicies.OnCreateNodePolicy.NAMESPACE, "onCreateNode"),
			ContentModel.TYPE_CONTENT,
			behaviour);
	
	behaviour.disable();
	
	// Create a content node
	Map<QName, Serializable> props = new HashMap<QName, Serializable>(1);
	props.put(ContentModel.PROP_NAME, "myDoc.txt");
	ChildAssociationRef childAssoc = this.nodeService.createNode(
			this.folderNodeRef,
			ContentModel.ASSOC_CONTAINS,
			QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "myDoc.txt"),
			ContentModel.TYPE_CONTENT,
			props);
	assertFalse(this.nodeService.hasAspect(childAssoc.getChildRef(), ContentModel.ASPECT_TITLED));
	
	behaviour.enable();
	
	Map<QName, Serializable> props2 = new HashMap<QName, Serializable>(1);
	props2.put(ContentModel.PROP_NAME, "myDoc1.txt");
	ChildAssociationRef childAssoc2 = this.nodeService.createNode(
			this.folderNodeRef,
			ContentModel.ASSOC_CONTAINS,
			QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "myDoc1.txt"),
			ContentModel.TYPE_CONTENT,
			props2);
	assertTrue(this.nodeService.hasAspect(childAssoc2.getChildRef(), ContentModel.ASPECT_TITLED));		
}
 

开发者ID:Alfresco,
项目名称:alfresco-repository,
代码行数:37,
代码来源:ScriptBehaviourTest.java

示例20: testJavascriptAPI

点赞 2

import org.alfresco.service.cmr.repository.ScriptLocation; //导入依赖的package包/类
/**
 * JavaScript tests for the Category Service.
 * Note that this test lives here because that's where the Java
 *  CategeoryService tests are, and this also has all the required
 *  SetUp and TearDown to make it easier.
 */
public void testJavascriptAPI() throws Exception
{
   TransactionService transactionService = serviceRegistry.getTransactionService();
   UserTransaction tx = transactionService.getUserTransaction();
   tx.begin();
   buildBaseIndex();
   
   ServiceRegistry services = (ServiceRegistry)ctx.getBean("ServiceRegistry");
   
   // Call the test 
   Map<String, Object> model = new HashMap<String, Object>();
   model.put("catRoot",   new CategoryNode(catRoot, services));
   model.put("catACBase", new CategoryNode(catACBase, services));
   model.put("catACOne",  new CategoryNode(catACOne, services));
   model.put("catACTwo",  new CategoryNode(catACTwo, services));
   model.put("catACThree",  new CategoryNode(catACThree, services));
   model.put("catRBase",  new CategoryNode(catRBase, services));
   model.put("catROne",   new CategoryNode(catROne, services));
   model.put("catRTwo",   new CategoryNode(catRTwo, services));
   model.put("catRThree", new CategoryNode(catRThree, services));
   
   ScriptLocation location = new ClasspathScriptLocation("org/alfresco/repo/search/impl/lucene/test_categoryService.js");
   this.scriptService.executeScript(location, model);
   
   // Tidy up
   tx.rollback();
}
 

开发者ID:Alfresco,
项目名称:community-edition-old,
代码行数:34,
代码来源:ADMLuceneCategoryTest.java

示例21: execute

点赞 2

import org.alfresco.service.cmr.repository.ScriptLocation; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Object execute(final ScriptLocation location, final Map<String, Object> model)
{
    final ScriptProcessor scriptProcessor = this.processorByName.containsKey(this.activeScriptProcessor) ? this.processorByName
            .get(this.activeScriptProcessor) : this.defaultScriptProcessor;
    return scriptProcessor.execute(location, model);
}
 

开发者ID:AFaust,
项目名称:alfresco-enhanced-script-environment,
代码行数:11,
代码来源:SwitchableScriptProcessor.java

示例22: compareTo

点赞 2

import org.alfresco.service.cmr.repository.ScriptLocation; //导入依赖的package包/类
/**
 * 
 * {@inheritDoc}
 */
@Override
public int compareTo(final RegisterableScript<ScriptLocation> o)
{
    final ScriptLocation otherScriptLocation = o.getScriptInstance();
    final ScriptLocation scriptLocation = this.getScriptInstance();

    final String otherPath = otherScriptLocation.getPath();
    final String path = scriptLocation.getPath();
    return path.compareTo(otherPath);
}
 

开发者ID:AFaust,
项目名称:alfresco-enhanced-script-environment,
代码行数:15,
代码来源:ClasspathRegisterableScript.java

示例23: getScriptInstance

点赞 2

import org.alfresco.service.cmr.repository.ScriptLocation; //导入依赖的package包/类
/**
 * 
 * {@inheritDoc}
 */
@Override
public ScriptLocation getScriptInstance()
{
    final String path = this.scriptResource.getPath();
    final String realPath = path.startsWith("classpath:") ? path.substring("classpath:".length()) : path;
    final ClasspathScriptLocation scriptLocation = new ClasspathScriptLocation(realPath);
    return scriptLocation;
}
 

开发者ID:AFaust,
项目名称:alfresco-enhanced-script-environment,
代码行数:13,
代码来源:ClasspathRegisterableScript.java

示例24: execute

点赞 2

import org.alfresco.service.cmr.repository.ScriptLocation; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Object execute(final ScriptLocation location, final Map<String, Object> model)
{
    ParameterCheck.mandatory("location", location);

    final ReferenceScript actualScript = new ScriptLocationAdapter(location);
    final Script script = this.getCompiledScript(actualScript);
    final String debugScriptName;
    {
        final String path = location.getPath();
        final int i = path.lastIndexOf('/');
        debugScriptName = i != -1 ? path.substring(i + 1) : path;
    }

    final Context cx = Context.enter();
    try
    {
        this.updateLocationChainsBeforeExceution(cx);
        this.activeScriptLocationChain.get(cx).add(actualScript);
        try
        {
            return this.executeScriptImpl(script, model, location.isSecure(), debugScriptName);
        }
        finally
        {
            this.updateLocationChainsAfterReturning(cx);
        }
    }
    finally
    {
        Context.exit();
    }
}
 

开发者ID:AFaust,
项目名称:alfresco-enhanced-script-environment,
代码行数:37,
代码来源:EnhancedRhinoScriptProcessor.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)