Package uk.gov.nationalarchives.droid.profile

Examples of uk.gov.nationalarchives.droid.profile.ProfileInstance


            report.addItem(item);
           
            Map<String, GroupedFieldItem> groups = new LinkedHashMap<String, GroupedFieldItem>();
           
            for (String profileId : request.getProfileIds()) {
                ProfileInstance profile = profileContextLocator.getProfileInstance(profileId);
                report.addProfile(profile);
               
                ProfileInstanceManager profileInstanceManager =
                    profileContextLocator.openProfileInstanceManager(profile);
               
                Filter filterToUse = optionalFilter == null ? profile.getFilter() : optionalFilter;
               
                Criterion filter = ReportUtils.buildFilter(filterToUse, specItem.getFilter());
               
                List<ReportLineItem> reportData = profileInstanceManager.getReportData(
                        filter, specItem.getField(), specItem.getGroupByFields());
View Full Code Here


        final String profileLocation = "profiles/12345.droid";
        final String destination = "tmp/destination.xml";
        new File("tmp").mkdirs();
        final String profileId = "12345";
       
        final ProfileInstance profile = mock(ProfileInstance.class);
        when(profile.getUuid()).thenReturn(profileId);
       
        when(profileManager.open(eq(new File(profileLocation)), any(ProgressObserver.class)))
            .thenReturn(profile);
       
        reportCommand.setReportType("MyCustomReport");
View Full Code Here

        final String destination = "tmp/destination.xml";
        new File("tmp").mkdirs();
        final String profileId = "12345";
       
       
        final ProfileInstance profile = mock(ProfileInstance.class);
        when(profile.getUuid()).thenReturn(profileId);
       
        when(profileManager.open(eq(new File(profileLocation)), any(ProgressObserver.class)))
            .thenReturn(profile);
       
        reportCommand.setReportType("MyCustomReport");
View Full Code Here

        final String destination = File.createTempFile("droid", "exportCommandTest").getAbsolutePath();
       
        ExportManager exportManager = mock(ExportManager.class);
        ProfileManager profileManager = mock(ProfileManager.class);
       
        ProfileInstance profile1 = mock(ProfileInstance.class);
        when(profile1.getUuid()).thenReturn("profile1");
       
        ProfileInstance profile2 = mock(ProfileInstance.class);
        when(profile2.getUuid()).thenReturn("profile2");

        ProfileInstance profile3 = mock(ProfileInstance.class);
        when(profile3.getUuid()).thenReturn("profile3");

        when(profileManager.open(eq(new File("foo1")), any(ProgressObserver.class))).thenReturn(profile1);
        when(profileManager.open(eq(new File("foo2")), any(ProgressObserver.class))).thenReturn(profile2);
        when(profileManager.open(eq(new File("foo3")), any(ProgressObserver.class))).thenReturn(profile3);
       
View Full Code Here

    public void testExportProfileWithNarrowFilter() throws Exception {
       
        ExportManager exportManager = mock(ExportManager.class);
        ProfileManager profileManager = mock(ProfileManager.class);
       
        ProfileInstance profile1 = mock(ProfileInstance.class);
        when(profile1.getUuid()).thenReturn("profile1");
       
        when(profileManager.open(eq(new File("foo1")), any(ProgressObserver.class))).thenReturn(profile1);
       
        Future future = mock(Future.class);
        when(exportManager.exportProfiles(any(List.class), eq("destination"), any(Filter.class), eq(ExportOptions.ONE_ROW_PER_FORMAT), any(String.class))).thenReturn(future);
View Full Code Here

        Map<SignatureType, SignatureFileInfo> sigs = new HashMap<SignatureType, SignatureFileInfo>();
        sigs.put(SignatureType.BINARY, sig);
       
        when(signatureManager.getDefaultSignatures()).thenReturn(sigs);
       
        ProfileInstance profileInstance = mock(ProfileInstance.class);
        when(profileInstance.getUuid()).thenReturn("abcde");
        when(profileManager.createProfile(sigs)).thenReturn(profileInstance);
       
        Future future = mock(Future.class);
        when(profileManager.start("abcde")).thenReturn(future);
       
View Full Code Here

            }
        }
       
        // load each profile
        for (String profileLocation : profiles) {
            ProfileInstance profile;
            try {
                profile = profileManager.open(new File(profileLocation), new ProgressObserver() {
                    @Override
                    public void onProgress(Integer progress) {
                    }
                });
                profileIds.add(profile.getUuid());
            } catch (IOException e) {
                throw new CommandExecutionException(e);
            }
        }
       
View Full Code Here

     */
    @Override
    public void execute() throws CommandExecutionException {
        try {
            Map<SignatureType, SignatureFileInfo> sigs = signatureManager.getDefaultSignatures();
            ProfileInstance profile = profileManager.createProfile(sigs);
            profile.changeState(ProfileState.VIRGIN);

            for (String resource : resources) {
                profile.addResource(locationResolver.getResource(resource, recursive));
            }
           
            Future<?> future = profileManager.start(profile.getUuid());
            future.get();
           
            ProgressObserver progressCallback = new ProgressObserver() {
                @Override
                public void onProgress(Integer progress) {
                }
            };
           
            profileManager.save(profile.getUuid(), new File(destination), progressCallback);
            profileManager.closeProfile(profile.getUuid());
        } catch (ProfileManagerException e) {
            throw new CommandExecutionException(e);
        } catch (InterruptedException e) {
            throw new CommandExecutionException(e);
        } catch (ExecutionException e) {
View Full Code Here

            }
        }
       
        // load each profile
        for (String profileLocation : profiles) {
            ProfileInstance profile;
            try {
                profile = profileManager.open(new File(profileLocation),
                        new ProgressObserver() {
                            @Override
                            public void onProgress(Integer progress) {
                            }
                        });
                profileIds.add(profile.getUuid());
            } catch (IOException e) {
                throw new CommandExecutionException(e);
            }
        }
View Full Code Here

TOP

Related Classes of uk.gov.nationalarchives.droid.profile.ProfileInstance

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.