com.tcdng.jacklyn.common.controllers.CommonRemoteCallGateImpl Maven / Gradle / Ivy
/*
* Copyright 2018-2019 The Code Department.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.tcdng.jacklyn.common.controllers;
import com.tcdng.jacklyn.common.business.RemoteCallSystemAssetProvider;
import com.tcdng.jacklyn.common.constants.CommonModuleNameConstants;
import com.tcdng.jacklyn.common.constants.JacklynApplicationAttributeConstants;
import com.tcdng.jacklyn.common.constants.CommonModuleErrorConstants;
import com.tcdng.jacklyn.shared.system.SystemAssetType;
import com.tcdng.unify.core.UnifyException;
import com.tcdng.unify.core.annotation.Component;
import com.tcdng.unify.web.AbstractRemoteCallGate;
/**
* Jacklyn application service gate.
*
* @author Lateef Ojulari
* @since 1.0
*/
@Component(CommonModuleNameConstants.JACKLYNAPPLICATIONSERVICEGATE)
public class CommonRemoteCallGateImpl extends AbstractRemoteCallGate {
@Override
protected void doGrantPass(String clientAppCode, String methodCode) throws UnifyException {
if (!getRemoteCallSystemAssetProvider().accessSystemAsset(clientAppCode, SystemAssetType.REMOTECALLMETHOD,
methodCode)) {
throw new UnifyException(CommonModuleErrorConstants.APPLICATION_SERVICE_ACCESSDENIED, clientAppCode,
methodCode);
}
}
private RemoteCallSystemAssetProvider getRemoteCallSystemAssetProvider() throws UnifyException {
return (RemoteCallSystemAssetProvider) getApplicationAttribute(
JacklynApplicationAttributeConstants.RC_SYSTEMASSET_PROVIDER);
}
}