当前位置: 首页>>代码示例>>Java>>正文


Java IDProvider类代码示例

本文整理汇总了Java中de.espirit.firstspirit.access.store.IDProvider的典型用法代码示例。如果您正苦于以下问题:Java IDProvider类的具体用法?Java IDProvider怎么用?Java IDProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IDProvider类属于de.espirit.firstspirit.access.store包,在下文中一共展示了IDProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: MockingGenerationContext

import de.espirit.firstspirit.access.store.IDProvider; //导入依赖的package包/类
/**
 * Instantiates a new Mocking generation context.
 *
 * @param locale                  the locale
 * @param preview                 the preview
 * @param release                 the release
 * @param enableServiceBrokerFake the enable service broker fake
 * @param supportedEnvironments   the supported environments
 */
public MockingGenerationContext(final Locale locale, final boolean preview, final boolean release, final boolean enableServiceBrokerFake,
                                final Env supportedEnvironments) {
    super(locale, preview, release, enableServiceBrokerFake, supportedEnvironments);
    this.locale = locale;
    scheduleContext = new MockingScheduleContext(locale, supportedEnvironments);
    fileHandles = new HashMap<>();
    printable = Mockito.mock(Printable.class);
    stack = new LinkedList<>();
    contextStack = new LinkedList<>();
    pageContext = Mockito.mock(Context.class);
    dataSet = Mockito.mock(Dataset.class);
    pageParams = Mockito.mock(PageParams.class);
    closeables = new LinkedList<>();
    context = Mockito.mock(Context.class);
    urlCreator = Mockito.mock(UrlCreator.class);
    urlCreatorProvider = Mockito.mock(UrlCreatorProvider.class);
    node = Mockito.mock(ContentProducer.class);
    navigationContext = Mockito.mock(IDProvider.class);
    encoding = Charset.forName("UTF-8").name();
    font = Font.decode(Font.MONOSPACED);
    evaluator = Mockito.mock(Evaluator.class);
    characterReplacer = Mockito.mock(CharacterReplacer.class);
}
 
开发者ID:e-Spirit,项目名称:FSTestTools,代码行数:33,代码来源:MockingGenerationContext.java

示例2: addToExportOperation

import de.espirit.firstspirit.access.store.IDProvider; //导入依赖的package包/类
/**
 * Selects a StoreElement from the store corresponding to this element's uidMapping. If any
 * object matching the uid could be retrieved, a check is performed, if its class
 * matches the class specified by this identifiers class (@code {@link UidMapping#getCorrespondingType()}).
 *
 * That is, because multiple implementing classes (for example FILE and MEDIA) can share the same UidType.
 * If you query the store with uid and UidType only, you could retrieve a MEDIA item, even if you only wanted
 * a FILE item. Since uids are unique across stores, there shouldn't be further problems.
 * @param storeAgent the StoreAgent to retrieve store instances from
 * @param useReleaseState indicates whether to request elements from {@link Store#isRelease() release} or current store via given {@link StoreAgent}
 * @param exportOperation the ExportOperation matching elements should be added to
 */
@Override
public void addToExportOperation(StoreAgent storeAgent, boolean useReleaseState, ExportOperation exportOperation) {
    final IDProvider storeElement = storeAgent.getStore(getUidMapping().getStoreType(), useReleaseState).getStoreElement(getUid(), getUidMapping().getUidType());
    if(storeElement != null) {
        if(isAssignableFrom(storeElement)) {
            LOGGER.debug("Adding store element: {}", storeElement);
            exportOperation.addElement(storeElement);
        } else {
            String errorMessage = "IDProvider of class " + storeElement.getClass().getSimpleName() + " found, but expected to find one of class " + getUidMapping().getCorrespondingType().getSimpleName() + " for uid " + uid;
            throw new IDProviderNotFoundException(errorMessage);
        }
    } else {
        throw new IDProviderNotFoundException("IDProvider cannot be retrieved for " + uid);
    }
}
 
开发者ID:e-Spirit,项目名称:FSDevTools,代码行数:28,代码来源:UidIdentifier.java

示例3: exportProjectAndGetLayers

import de.espirit.firstspirit.access.store.IDProvider; //导入依赖的package包/类
private List<String> exportProjectAndGetLayers(final String sourceProjectName, final File exportSyncDirectory) throws Exception {

        LOGGER.info("Export project '" + sourceProjectName + "' to " + exportSyncDirectory.getPath());

        final ExportCommand exportCommand = new ExportCommand();
        exportCommand.setProject(sourceProjectName);
        initContextWithDefaultConfiguration(exportCommand);
        final ProjectScriptContext context = new CliContextImpl(exportCommand);
        exportCommand.setContext(context);
        exportCommand.setSynchronizationDirectory(exportSyncDirectory.getPath());
        exportCommand.setIncludeProjectProperties(true);
        exportCommand.addIdentifier(new RootNodeIdentifier(IDProvider.UidType.TEMPLATESTORE).toString());
        final com.espirit.moddev.cli.results.ExportResult exportResult = exportCommand.call();
        assertFalse("Export not successful! Take a look at " + exportSyncDirectory.getPath(), exportResult.isError());

        final List<String> sourceLayers = exportCommand.getContext().getProject().getLayers();

        if (PROJECT_NAME_WITH_DB.equals(sourceProjectName)) {
            assertThat("Expected exported project to have database layers", sourceLayers.isEmpty(), is(false));
            System.out.println("sourceLayers: " + sourceLayers);
        }

        return sourceLayers;
    }
 
开发者ID:e-Spirit,项目名称:FSDevTools,代码行数:25,代码来源:LayerMappingImportIT.java

示例4: getReferences

import de.espirit.firstspirit.access.store.IDProvider; //导入依赖的package包/类
/**
 * Convenience method to get referenced objects of storeElement and its parents.
 *
 * @param releaseWithMedia Determines if media references should also be checked.
 * @return the list of referenced objects.
 */
private List<Object> getReferences(final boolean releaseWithMedia) {
    List<Object> references = new ArrayList<Object>();

    // add outgoing references
    addOutgoingReferences(storeElement, references, releaseWithMedia);

    // add outgoing references of parent objects if element was never released before
    if (isNeverReleased((IDProvider) storeElement)) {
        StoreElement elem = storeElement;
        while (elem.getParent() != null) {
            elem = elem.getParent();
            addOutgoingReferences(elem, references, releaseWithMedia);
        }
    }

    //Special cases in ContentCreator
    if (workflowScriptContext.is(BaseContext.Env.WEBEDIT)) {
        addParentFoldersInCaseOfMovedFolder(references);
        addParentFolderIfChanged(references);
    }

    return references;
}
 
开发者ID:e-Spirit,项目名称:basicworkflows,代码行数:30,代码来源:WorkflowObject.java

示例5: hasReleaseIssues

import de.espirit.firstspirit.access.store.IDProvider; //导入依赖的package包/类
private static boolean hasReleaseIssues(WorkflowScriptContext workflowScriptContext, IDProvider idProvider) {
    final WorkflowObject workflowObject = new WorkflowObject(workflowScriptContext);
    ArrayList<Object> referencedObjects = new ArrayList<Object>();
    if (idProvider != null) {
        workflowObject.setStoreElement(idProvider);
    }

    if (workflowScriptContext.getWorkflowable() != null && workflowScriptContext.getWorkflowable() instanceof ContentWorkflowable) {
        referencedObjects.addAll(workflowObject.getRefObjectsFromEntity(true));
    } else {
        referencedObjects.addAll(workflowObject.getRefObjectsFromStoreElement(true));
    }

    FormEvaluator formEvaluator = new FormEvaluator(workflowScriptContext);
    boolean releaseWithMedia = formEvaluator.getCheckboxValue("wf_releasewmedia");

    final ReferenceResult referenceResult = workflowObject.checkReferences(referencedObjects, releaseWithMedia);

    return referenceResult.hasReleaseIssues(releaseWithMedia);
}
 
开发者ID:e-Spirit,项目名称:basicworkflows,代码行数:21,代码来源:WfFindRelatedObjectsExecutable.java

示例6: getCustomReleaseElements

import de.espirit.firstspirit.access.store.IDProvider; //导入依赖的package包/类
private List<IDProvider> getCustomReleaseElements(String type) {
    List<IDProvider> customReleaseElements = new ArrayList<IDProvider>();
    if (type.equals(WorkflowConstants.RELEASE_PAGEREF_ELEMENTS)) {
        Object releasePageRefElements = workflowScriptContext.getSession().get(WorkflowConstants.RELEASE_PAGEREF_ELEMENTS);
        if (releasePageRefElements != null) {
            @SuppressWarnings("unchecked")
            final List<String> releasePageRefUids = (List<String>) releasePageRefElements;
            for (String pageRefUid : releasePageRefUids) {
                PageRef pageRef = new StoreUtil(workflowScriptContext).loadPageRefByUid(pageRefUid);
                customReleaseElements.add(pageRef);
                customReleaseElements.add(pageRef.getPage());
            }
        }
    }
    return customReleaseElements;
}
 
开发者ID:e-Spirit,项目名称:basicworkflows,代码行数:17,代码来源:ReleaseObject.java

示例7: createErrorString

import de.espirit.firstspirit.access.store.IDProvider; //导入依赖的package包/类
/**
 * Convenience method to generate an error message for an object.
 *
 * @param id the object to generate a message for.
 * @return the error message.
 */
private String createErrorString(Object id) {
    final QueryAgent queryAgent = workflowScriptContext.requireSpecialist(QueryAgent.TYPE);
    final Iterable<IDProvider> hits = queryAgent.answer("fs.id=" + id);
    if (hits.iterator().hasNext()) {
        IDProvider element = hits.iterator().next();
        if (element.hasUid()) {
            return element.getDisplayName(new FsLocale(workflowScriptContext).getLanguage()) + " (" + element.getUid() + ", " + element.getId()
                + ")\n";
        } else {
            return "";
        }
    } else {
        Logging.logError("Found no element with id " + id, LOGGER);
        return "";
    }
}
 
开发者ID:e-Spirit,项目名称:basicworkflows,代码行数:23,代码来源:ReleaseObject.java

示例8: storeReferences

import de.espirit.firstspirit.access.store.IDProvider; //导入依赖的package包/类
/**
 * Convenience method to store uid names of objects that reference the object to be deleted in the workflow session.
 *
 * @param lckObjects A list of IDProvider objects that reference the object to be deleted.
 */
public void storeReferences(List<IDProvider> lckObjects) {
    List<List<String>> lockedObjects = new ArrayList<List<String>>();
    for (IDProvider idProv : lckObjects) {
        List<String> lockedObjectList = new ArrayList<String>();
        lockedObjectList.add(idProv.getElementType());
        if (idProv.hasUid()) {
            lockedObjectList.add(idProv.getUid());
        } else {
            lockedObjectList.add(idProv.getName());
        }
        lockedObjects.add(lockedObjectList);
    }
    // put referenced objects to session for further use
    workflowScriptContext.getSession().put("wfLockedObjects", lockedObjects);
}
 
开发者ID:e-Spirit,项目名称:basicworkflows,代码行数:21,代码来源:DeleteObject.java

示例9: displayMessageWithReferences

import de.espirit.firstspirit.access.store.IDProvider; //导入依赖的package包/类
private void displayMessageWithReferences(final WorkflowScriptContext workflowScriptContext, final StoreElement element,
                                          final ReferenceEntry... incomingReferences) {
    final FsLocale fsLocale = new FsLocale(workflowScriptContext);
    ResourceBundle bundle = ResourceBundle.getBundle(WorkflowConstants.MESSAGES, fsLocale.get());
    StringBuilder builder = new StringBuilder();
    for (ReferenceEntry referencedObject : incomingReferences) {
        if (referencedObject.getReferencedObject() instanceof IDProvider) {
            IDProvider storeElement = (IDProvider) referencedObject.getReferencedObject();
            builder.append("\n- ");
            builder.append(storeElement.getDisplayName(fsLocale.getLanguage()));
            builder.append(" (").append(storeElement.getId()).append(")");
        }
    }
    final String refs = builder.toString();
    Logging.logWarning("Cannot be deleted, because " + element.getReferenceName() + " has incoming refs:" + refs, LOGGER);
    if(element instanceof Media) {
        showDialog(workflowScriptContext, bundle.getString(WorkflowConstants.WARNING),
                   bundle.getString(WorkflowConstants.IMAGE_HAS_REFERENCES) + refs);
    } else {
        showDialog(workflowScriptContext, bundle.getString(WorkflowConstants.WARNING),
                               bundle.getString(WorkflowConstants.IMAGE_FOLDER_HAS_REFERENCES) + refs);
    }
}
 
开发者ID:e-Spirit,项目名称:basicworkflows,代码行数:24,代码来源:WfCheckPrerequisitesExecutable.java

示例10: runDelete

import de.espirit.firstspirit.access.store.IDProvider; //导入依赖的package包/类
private void runDelete() {
    DeleteObject deleteObject = new DeleteObject(workflowScriptContext){
        @Override
        protected ServerActionHandle<? extends DeleteProgress, Boolean> deleteIgnoringReferences(List<IDProvider> deleteObjects) {
            return null;
        }

        @Override
        protected ServerActionHandle<? extends ReleaseProgress, Boolean> releaseWithAccessibilityAndNewOnly(IDProvider idProv) {
            return null;
        }
    };
    final boolean deleted = deleteObject.delete(false);

    assertTrue("Expect true", deleted);
}
 
开发者ID:e-Spirit,项目名称:basicworkflows,代码行数:17,代码来源:DeleteObjectTest.java

示例11: testGetReleaseStatePage

import de.espirit.firstspirit.access.store.IDProvider; //导入依赖的package包/类
@Theory
public void testGetReleaseStatePage(final ReleaseStateChangedTestData testData) throws Exception {

    final PageRef element = mock(PageRef.class);
    final Page page = mock(Page.class);

    when(element.isReleaseSupported()).thenReturn(Boolean.TRUE);
    when(element.getReleaseStatus()).thenReturn(IDProvider.RELEASED);
    when(element.hasTask()).thenReturn(Boolean.FALSE);
    when(element.getPage()).thenReturn(page);
    when(page.isReleaseSupported()).thenReturn(testData.isReleaseSupported());
    when(page.getReleaseStatus()).thenReturn(testData.getProvidedState());
    when(page.hasTask()).thenReturn(testData.hasTasks());
    when(element.getParent()).thenReturn(element);

    final WebeditElementStatusProviderPlugin.State releaseState = testling.getReleaseState(element);

    assertThat("unexpected State", releaseState, is(testData.getExpectedState()));
}
 
开发者ID:e-Spirit,项目名称:basicworkflows,代码行数:20,代码来源:BasicWorkflowStatusProviderTest.java

示例12: testGetReleaseStateDocumentGroup

import de.espirit.firstspirit.access.store.IDProvider; //导入依赖的package包/类
@Theory
public void testGetReleaseStateDocumentGroup(final ReleaseStateChangedTestData testData) throws Exception {

    final DocumentGroup group = mock(DocumentGroup.class);
    final PageRef element = mock(PageRef.class);
    final Page page = mock(Page.class);

    final Listable<StoreElement> listable = new CollectionListable<StoreElement>(Arrays.asList((StoreElement) element));

    when(group.getChildCount()).thenReturn(1);
    when(group.getChildren()).thenReturn(listable);

    when(element.isReleaseSupported()).thenReturn(Boolean.TRUE);
    when(element.getReleaseStatus()).thenReturn(IDProvider.RELEASED);
    when(element.hasTask()).thenReturn(Boolean.FALSE);
    when(element.getPage()).thenReturn(page);
    when(page.isReleaseSupported()).thenReturn(testData.isReleaseSupported());
    when(page.getReleaseStatus()).thenReturn(testData.getProvidedState());
    when(page.hasTask()).thenReturn(testData.hasTasks());
    when(element.getParent()).thenReturn(element);

    final WebeditElementStatusProviderPlugin.State releaseState = testling.getReleaseState(group);

    assertThat("unexpected State", releaseState, is(testData.getExpectedState()));
}
 
开发者ID:e-Spirit,项目名称:basicworkflows,代码行数:26,代码来源:BasicWorkflowStatusProviderTest.java

示例13: testGetWorkflowGroupsNotNull

import de.espirit.firstspirit.access.store.IDProvider; //导入依赖的package包/类
@Theory(nullsAccepted = false)
public void testGetWorkflowGroupsNotNull(final IDProvider element) {

    final List<WorkflowGroup> workflowGroupList = testling.getWorkflowGroups(element);

    assertThat("Expect a list", workflowGroupList, hasSize(1));

    final WorkflowGroup workflowGroup = workflowGroupList.get(0);

    assertThat("Expect a list", workflowGroup.getElements(), hasSize(1));
    assertThat("Expect same instance in list", workflowGroup.getElements(), contains(sameInstance(element)));

    final ResourceBundle bundle = ResourceBundle.getBundle(WorkflowConstants.MESSAGES, Locale.GERMANY);

    if (element instanceof PageRef || element instanceof Page) {
        assertThat("Expect a specific value", workflowGroup.getDisplayName(), is(bundle.getString("pageReference")));
    }

    if (element instanceof DocumentGroup) {
        assertThat("Expect a specific value", workflowGroup.getDisplayName(), is(bundle.getString("documentGroup")));
    }

    if (element instanceof Dataset) {
        assertThat("Expect a specific value", workflowGroup.getDisplayName(), is(bundle.getString("dataset")));
    }
}
 
开发者ID:e-Spirit,项目名称:basicworkflows,代码行数:27,代码来源:BasicWorkflowStatusProviderTest.java

示例14: setUp

import de.espirit.firstspirit.access.store.IDProvider; //导入依赖的package包/类
@Before
public void setUp() throws Exception {

    Connection connection = parameters.getConnection();

    when(connection.getProjectByName(PROJECT)).thenReturn(project);

    when(html.getUid()).thenReturn("html");
    when(project.getUserService()).thenReturn(userService);
    when(project.getTemplateSets()).thenReturn(Arrays.asList(html));

    when(userService.getStore(anyObject(), eq(false))).then(new Answer<Store>() {
        @Override
        public Store answer(InvocationOnMock invocation) throws Throwable {
            Store.Type storeType = (Store.Type) invocation.getArguments()[0];
            switch (storeType){
                case PAGESTORE:
                    return pageStore;
                case SITESTORE:
                    return siteStore;
                case TEMPLATESTORE:
                    when(templateStore.getFormatTemplates()).thenReturn(formatTemplates);
                    when(formatTemplates.createFormatTemplate(parameters.getName())).thenReturn(formatTemplate);

                    when(templateStore.getScripts()).thenReturn(scriptes);
                    when(scriptes.createScript(parameters.getName(), "")).thenReturn(script);

                    when(templateStore.getStoreElement(parameters.getName(),
                                                       IDProvider.UidType.TEMPLATESTORE_FORMATTEMPLATE)).thenReturn(formatTemplate);

                    when(templateStore.getStoreElement(parameters.getName(), IDProvider.UidType.TEMPLATESTORE)).thenReturn(template);

                    return templateStore;
            }
            return null;
        }
    });
}
 
开发者ID:e-Spirit,项目名称:FSTestTools,代码行数:39,代码来源:ModifyStoreCommandTest.java

示例15: MockingContextMenuContext

import de.espirit.firstspirit.access.store.IDProvider; //导入依赖的package包/类
/**
 * Instantiates a new mocking context menu context.
 *
 * @param locale                  the locale
 * @param enableServiceBrokerFake the enable service broker fake
 * @param storeType               the store type
 * @param supportedEnvironments   the supported environments
 */
public MockingContextMenuContext(Locale locale, boolean enableServiceBrokerFake, Type storeType, Env... supportedEnvironments) {
    super(locale, enableServiceBrokerFake, supportedEnvironments);
    this.storeType = storeType;
    elements = new ArrayList<>();
    list = new Listable<IDProvider>() {

        @Override
        public Iterator<IDProvider> iterator() {
            return elements.iterator();
        }

        @Override
        public List<IDProvider> toList() {
            return Collections.unmodifiableList(elements);
        }

        @Override
        public IDProvider getFirst() {
            if (elements.isEmpty()) {
                return null;
            } else {
                return elements.get(0);
            }
        }
    };
}
 
开发者ID:e-Spirit,项目名称:FSTestTools,代码行数:35,代码来源:MockingContextMenuContext.java


注:本文中的de.espirit.firstspirit.access.store.IDProvider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。