
com.flowcentraltech.flowcentral.studio.business.policies.StudioOnCreateFormActionPolicy Maven / Gradle / Ivy
/*
* Copyright 2021-2024 FlowCentral Technologies Limited.
*
* 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.flowcentraltech.flowcentral.studio.business.policies;
import com.flowcentraltech.flowcentral.application.constants.ApplicationPrivilegeConstants;
import com.flowcentraltech.flowcentral.application.entities.AppFormAction;
import com.flowcentraltech.flowcentral.application.util.PrivilegeNameUtils;
import com.flowcentraltech.flowcentral.common.business.policies.EntityActionContext;
import com.flowcentraltech.flowcentral.common.business.policies.EntityActionResult;
import com.flowcentraltech.flowcentral.common.constants.ConfigType;
import com.flowcentraltech.flowcentral.studio.constants.StudioSessionAttributeConstants;
import com.tcdng.unify.core.UnifyException;
import com.tcdng.unify.core.annotation.Component;
import com.tcdng.unify.core.database.Entity;
/**
* Studio on create application form action policy.
*
* @author FlowCentral Technologies Limited
* @since 1.0
*/
@Component("studiooncreateformaction-policy")
public class StudioOnCreateFormActionPolicy extends AbstractStudioAppletActionPolicy {
@Override
public boolean checkAppliesTo(Entity inst) throws UnifyException {
return true;
}
@Override
protected EntityActionResult doExecutePreAction(EntityActionContext ctx) throws UnifyException {
return null;
}
@Override
protected EntityActionResult doExecutePostAction(EntityActionContext ctx) throws UnifyException {
final AppFormAction appFormAction = (AppFormAction) ctx.getInst();
Long applicationId = (Long) getSessionAttribute(StudioSessionAttributeConstants.CURRENT_APPLICATION_ID);
String privilegeCode = PrivilegeNameUtils.getFormActionPrivilegeName(appFormAction.getName());
registerPrivilege(ConfigType.CUSTOM, applicationId, ApplicationPrivilegeConstants.APPLICATION_FORMACTION_CATEGORY_CODE,
privilegeCode, appFormAction.getDescription());
return new EntityActionResult(ctx);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy