當前位置: 首頁>>代碼示例>>Java>>正文


Java RepoUsageStatus類代碼示例

本文整理匯總了Java中org.alfresco.service.cmr.admin.RepoUsageStatus的典型用法代碼示例。如果您正苦於以下問題:Java RepoUsageStatus類的具體用法?Java RepoUsageStatus怎麽用?Java RepoUsageStatus使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


RepoUsageStatus類屬於org.alfresco.service.cmr.admin包,在下文中一共展示了RepoUsageStatus類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onChangeRestriction

import org.alfresco.service.cmr.admin.RepoUsageStatus; //導入依賴的package包/類
/**
 * Checks the current status, logs messages and sets a read-write veto, if necessary
 */
@Override
public void onChangeRestriction(RepoUsage restrictions)
{
    RepoUsageStatus status = repoUsageComponent.getUsageStatus();
    if (logger.isDebugEnabled())
    {
        logger.debug("Current status is " + status);
    }
    
    status.logMessages(logger);
    
    if (status.getLevel() == RepoUsageLevel.LOCKED_DOWN)
    {
        transactionService.setAllowWrite(false, vetoName);
    }
    else
    {
        transactionService.setAllowWrite(true, vetoName);
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:24,代碼來源:RepoUsageMonitor.java

示例2: test4FullUse

import org.alfresco.service.cmr.admin.RepoUsageStatus; //導入依賴的package包/類
public void test4FullUse() throws Exception
{
    // Update usage
    updateUsage(UsageType.USAGE_ALL);

	// Set the restrictions
    RepoUsage restrictions = new RepoUsage(
            System.currentTimeMillis(),
            getUsage().getUsers(),
            getUsage().getDocuments(),
            LicenseMode.TEAM,
            System.currentTimeMillis() + 24*3600000,
            false);
    repoUsageComponent.setRestrictions(restrictions);
    // Get the restrictions (should not need a txn for this)
    RepoUsage restrictionsCheck = repoUsageComponent.getRestrictions();
    assertEquals("Restrictions should return without change.", restrictions, restrictionsCheck);

    // Update use
    updateUsage(UsageType.USAGE_ALL);

    // Get the usage
    RepoUsage usage = getUsage();        
    
    // Check
    assertNotNull("Usage is null", usage);
    assertNotNull("Invalid user count", usage.getUsers());
    assertNotNull("Invalid document count", usage.getDocuments());
    assertEquals("License mode not set", restrictions.getLicenseMode(), usage.getLicenseMode());
    assertEquals("License expiry not set", restrictions.getLicenseExpiryDate(), usage.getLicenseExpiryDate());
    assertEquals("Read-only state not set", restrictions.isReadOnly(), usage.isReadOnly());
    
    RepoUsageStatus status = repoUsageComponent.getUsageStatus();
    logger.debug(status);
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:36,代碼來源:RepoUsageComponentTest.java

示例3: executeImpl

import org.alfresco.service.cmr.admin.RepoUsageStatus; //導入依賴的package包/類
@Override
protected Map<String, Object> executeImpl(final WebScriptRequest req, final Status status, final Cache cache)
{
    // Runas system to obtain the info
    RunAsWork<Map<String, Object>> runAs = new RunAsWork<Map<String,Object>>()
    {
        @Override
        public Map<String, Object> doWork() throws Exception
        {
            Map<String, Object> model = new HashMap<String, Object>(7);
            
            RepoUsageStatus usageStatus = repoAdminService.getUsageStatus();
            RepoUsage usage = usageStatus.getUsage();
            
            putUsageInModel(
                    model,
                    usage,
                    false);
          
            // Add usage messages
            model.put(JSON_KEY_LEVEL, usageStatus.getLevel().ordinal());
            model.put(JSON_KEY_WARNINGS, usageStatus.getWarnings());
            model.put(JSON_KEY_ERRORS, usageStatus.getErrors());
          
            // Done
            if (logger.isDebugEnabled())
            {
                logger.debug("Result: \n\tRequest: " + req + "\n\tModel: " + model);
            }
            return model;
        }
    };
    return AuthenticationUtil.runAs(runAs, AuthenticationUtil.getSystemUserName());
}
 
開發者ID:Alfresco,項目名稱:alfresco-remote-api,代碼行數:35,代碼來源:RepoUsageGet.java

示例4: testGetUsage

import org.alfresco.service.cmr.admin.RepoUsageStatus; //導入依賴的package包/類
public void testGetUsage() throws Exception
{
    RepoUsageStatus usageStatus = repoAdminService.getUsageStatus();
    RepoUsage usage = usageStatus.getUsage();
    LicenseDescriptor licenseDescriptor = descriptorService.getLicenseDescriptor();
    Date validUntil = (licenseDescriptor == null) ? null : licenseDescriptor.getValidUntil(); // might be null
    Integer checkLevel = new Integer(usageStatus.getLevel().ordinal());
    
    String url = "/api/admin/usage";
    TestWebScriptServer.GetRequest req = new TestWebScriptServer.GetRequest(url);
    
    Response response = sendRequest(req, Status.STATUS_OK, guest);
    System.out.println(response.getContentAsString());
    JSONObject json = new JSONObject(response.getContentAsString());
    Long users = json.isNull(AbstractAdminWebScript.JSON_KEY_USERS) ? null : json.getLong(AbstractAdminWebScript.JSON_KEY_USERS);
    assertEquals("Mismatched users", usage.getUsers(), users);
    Long documents = json.isNull(AbstractAdminWebScript.JSON_KEY_DOCUMENTS) ? null : json.getLong(AbstractAdminWebScript.JSON_KEY_DOCUMENTS);
    assertEquals("Mismatched documents", usage.getDocuments(), documents);
    String licenseMode = json.isNull(AbstractAdminWebScript.JSON_KEY_LICENSE_MODE) ? null : json.getString(AbstractAdminWebScript.JSON_KEY_LICENSE_MODE);
    assertEquals("Mismatched licenseMode", usage.getLicenseMode().toString(), licenseMode);
    boolean readOnly = json.getBoolean(AbstractAdminWebScript.JSON_KEY_READ_ONLY);
    assertEquals("Mismatched readOnly", usage.isReadOnly(), readOnly);
    boolean updated = json.getBoolean(AbstractAdminWebScript.JSON_KEY_UPDATED);
    assertEquals("Mismatched updated", false, updated);
    Long licenseValidUntil = json.isNull(AbstractAdminWebScript.JSON_KEY_LICENSE_VALID_UNTIL) ? null : json.getLong(AbstractAdminWebScript.JSON_KEY_LICENSE_VALID_UNTIL);
    assertEquals("Mismatched licenseValidUntil",
            (validUntil == null) ? null : validUntil.getTime(),
            licenseValidUntil);
    Integer level = json.isNull(AbstractAdminWebScript.JSON_KEY_LEVEL) ? null : json.getInt(AbstractAdminWebScript.JSON_KEY_LEVEL);
    assertEquals("Mismatched level", checkLevel, level);
    json.getJSONArray(AbstractAdminWebScript.JSON_KEY_WARNINGS);
    json.getJSONArray(AbstractAdminWebScript.JSON_KEY_ERRORS);
}
 
開發者ID:Alfresco,項目名稱:alfresco-remote-api,代碼行數:34,代碼來源:AdminWebScriptTest.java

示例5: getUsageStatus

import org.alfresco.service.cmr.admin.RepoUsageStatus; //導入依賴的package包/類
@Override
public RepoUsageStatus getUsageStatus()
{
    return repoUsageComponent.getUsageStatus();
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:6,代碼來源:RepoAdminServiceImpl.java

示例6: getUsageStatus

import org.alfresco.service.cmr.admin.RepoUsageStatus; //導入依賴的package包/類
/**
 * Calculate and retrieve full status alerts based on the usage and license expiry state.
 * 
 * @return              Returns the usage status bean
 */
RepoUsageStatus getUsageStatus();
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:7,代碼來源:RepoUsageComponent.java


注:本文中的org.alfresco.service.cmr.admin.RepoUsageStatus類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。