/** * @param aInstance * @param aNameSpace * @param aInstanceType * @param aActions * @param aAmount * @return */ @Override public long setQuota( String aInstance, String aNameSpace, String aInstanceType, String aActions, long aAmount) { IQuotaSingleInstance lQSingle = getQuota(aInstance, aNameSpace, aInstanceType, aActions); // if the instanceType request is Group then update the father quota. if (lQSingle.getInstanceType().equals("Group") && aInstanceType.equals("Group")) { return setQuota(lQSingle.getUuid(), aAmount); } /** * if the quota type of the getQuota method is User, it is possible that this quota be part of a * father quota. */ if (lQSingle.getInstanceType().equals("User")) { if (mQuotaStorage.quotaExist( aNameSpace, mQuotaIdentifier, lQSingle.getInstance(), lQSingle.getActions())) { return setQuota(lQSingle.getUuid(), aAmount); } else { IQuotaSingleInstance lSingleInstance = mQuotaStorage.getQuotaByUuid(lQSingle.getUuid()); QuotaChildSI lQChild = lSingleInstance.getChildQuota(lQSingle.getInstance()); lQChild.setValue(aAmount); if (lSingleInstance.getInstanceType().equals("User")) { return mQuotaStorage.update(lSingleInstance.getUuid(), lQChild.getValue()); } return mQuotaStorage.update(lQChild); } } else { return -1; } }