Search in sources :

Example 6 with RMSite

use of org.alfresco.rm.rest.api.model.RMSite in project records-management by Alfresco.

the class RMSiteEntityResourceUnitTest method updateRMSiteGuid.

@Test
public void updateRMSiteGuid() throws Exception {
    String siteId = RM_SITE_ID;
    Params parameters = mock(Params.class);
    RMSite site = new RMSite();
    site.setTitle("New Title");
    site.setDescription("New Description");
    site.setGuid("newGUID");
    try {
        rmSiteEntityResource.update(siteId, site, parameters);
        fail("Expected ecxeption as rm site guid cannot be changed.");
    } catch (InvalidArgumentException ex) {
        assertEquals("Site update does not support field: guid", ex.getMsgId());
    }
    verify(mockedRMSites, never()).updateRMSite(any(String.class), any(SiteUpdate.class), any(Parameters.class));
}
Also used : RMSite(org.alfresco.rm.rest.api.model.RMSite) InvalidArgumentException(org.alfresco.rest.framework.core.exceptions.InvalidArgumentException) Parameters(org.alfresco.rest.framework.resource.parameters.Parameters) SiteUpdate(org.alfresco.rest.api.model.SiteUpdate) Params(org.alfresco.rest.framework.resource.parameters.Params) BaseUnitTest(org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest) Test(org.junit.Test)

Example 7 with RMSite

use of org.alfresco.rm.rest.api.model.RMSite in project records-management by Alfresco.

the class RMSiteEntityResourceUnitTest method updateRMSiteRole.

@Test
public void updateRMSiteRole() throws Exception {
    String siteId = RM_SITE_ID;
    Params parameters = mock(Params.class);
    RMSite site = new RMSite();
    site.setTitle("New Title");
    site.setDescription("New Description");
    site.setRole("newRole");
    try {
        rmSiteEntityResource.update(siteId, site, parameters);
        fail("Expected ecxeption as rm site role cannot be changed.");
    } catch (InvalidArgumentException ex) {
        assertEquals("Site update does not support field: role", ex.getMsgId());
    }
    verify(mockedRMSites, never()).updateRMSite(any(String.class), any(SiteUpdate.class), any(Parameters.class));
}
Also used : RMSite(org.alfresco.rm.rest.api.model.RMSite) InvalidArgumentException(org.alfresco.rest.framework.core.exceptions.InvalidArgumentException) Parameters(org.alfresco.rest.framework.resource.parameters.Parameters) SiteUpdate(org.alfresco.rest.api.model.SiteUpdate) Params(org.alfresco.rest.framework.resource.parameters.Params) BaseUnitTest(org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest) Test(org.junit.Test)

Example 8 with RMSite

use of org.alfresco.rm.rest.api.model.RMSite in project records-management by Alfresco.

the class RMSitesImpl method getRMSite.

@Override
public RMSite getRMSite(String siteId) {
    Site site = getSite(siteId);
    SiteInfo siteInfo = siteService.getSite(siteId);
    RMSiteCompliance compliance = getCompliance(siteInfo);
    return new RMSite(site, compliance);
}
Also used : Site(org.alfresco.rest.api.model.Site) RMSite(org.alfresco.rm.rest.api.model.RMSite) SiteInfo(org.alfresco.service.cmr.site.SiteInfo) RMSite(org.alfresco.rm.rest.api.model.RMSite) RMSiteCompliance(org.alfresco.rm.rest.api.model.RMSiteCompliance)

Example 9 with RMSite

use of org.alfresco.rm.rest.api.model.RMSite in project records-management by Alfresco.

the class RMSitesImpl method createRMSite.

@Override
public RMSite createRMSite(RMSite rmSite, Parameters parameters) {
    RMSiteCompliance compliance = rmSite.getCompliance();
    if (compliance == null) {
        compliance = RMSiteCompliance.STANDARD;
    }
    Site site = createSite(rmSite, parameters);
    return new RMSite(site, compliance);
}
Also used : Site(org.alfresco.rest.api.model.Site) RMSite(org.alfresco.rm.rest.api.model.RMSite) RMSite(org.alfresco.rm.rest.api.model.RMSite) RMSiteCompliance(org.alfresco.rm.rest.api.model.RMSiteCompliance)

Example 10 with RMSite

use of org.alfresco.rm.rest.api.model.RMSite in project records-management by Alfresco.

the class RMSitesImpl method updateRMSite.

/**
 * Updates the RM site
 */
public RMSite updateRMSite(String siteId, SiteUpdate update, Parameters parameters) {
    Site updatedSite = updateSite(siteId, update, parameters);
    SiteInfo siteInfo = siteService.getSite(siteId);
    RMSiteCompliance compliance = getCompliance(siteInfo);
    return new RMSite(updatedSite, compliance);
}
Also used : Site(org.alfresco.rest.api.model.Site) RMSite(org.alfresco.rm.rest.api.model.RMSite) SiteInfo(org.alfresco.service.cmr.site.SiteInfo) RMSite(org.alfresco.rm.rest.api.model.RMSite) RMSiteCompliance(org.alfresco.rm.rest.api.model.RMSiteCompliance)

Aggregations

RMSite (org.alfresco.rm.rest.api.model.RMSite)17 BaseUnitTest (org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest)13 Test (org.junit.Test)13 Parameters (org.alfresco.rest.framework.resource.parameters.Parameters)11 SiteUpdate (org.alfresco.rest.api.model.SiteUpdate)8 Params (org.alfresco.rest.framework.resource.parameters.Params)8 SiteInfo (org.alfresco.service.cmr.site.SiteInfo)7 InvalidArgumentException (org.alfresco.rest.framework.core.exceptions.InvalidArgumentException)5 NodeRef (org.alfresco.service.cmr.repository.NodeRef)5 SiteVisibility (org.alfresco.service.cmr.site.SiteVisibility)4 SiteImportPackageHandler (org.alfresco.rest.api.impl.SiteImportPackageHandler)3 Site (org.alfresco.rest.api.model.Site)3 RMSiteCompliance (org.alfresco.rm.rest.api.model.RMSiteCompliance)3 ImporterBinding (org.alfresco.service.cmr.view.ImporterBinding)3 Location (org.alfresco.service.cmr.view.Location)3 QName (org.alfresco.service.namespace.QName)3 InvalidParameterException (java.security.InvalidParameterException)1 ArrayList (java.util.ArrayList)1 ActivityInfo (org.alfresco.service.cmr.activities.ActivityInfo)1