Called when the user reorders the policies in a API.
@param apiVersion the API version
@param policyType the policy type
@param securityContext the security context
@return the audit entry
427313
public static AuditEntryBean policiesReordered(ApiVersionBean apiVersion, PolicyType policyType,
            ISecurityContext securityContext) {
        AuditEntryBean entry = newEntry(apiVersion.getApi().getOrganization().getId(), AuditEntityType.Api, securityContext);
        entry.setEntityId(apiVersion.getApi().getId());
        entry.setEntityVersion(apiVersion.getVersion());
        entry.setWhat(AuditEntryType.ReorderPolicies);
        return entry;
    }
650200
public static tmglobal_auditnslogpolicy_binding[] get(nitro_service service) throws Exception{
		tmglobal_auditnslogpolicy_binding obj = new tmglobal_auditnslogpolicy_binding();
		tmglobal_auditnslogpolicy_binding response[] = (tmglobal_auditnslogpolicy_binding[]) obj.get_resources(service);
		return response;
	}
698499
public static auditsyslogpolicy_binding get(nitro_service service, String name) throws Exception{
		auditsyslogpolicy_binding obj = new auditsyslogpolicy_binding();
		obj.set_name(name);
		auditsyslogpolicy_binding response = (auditsyslogpolicy_binding) obj.get_resource(service);
		return response;
	}
1343703
public static AuditEntryBean apiVersionUpdated(ApiVersionBean bean, EntityUpdatedData data,
            ISecurityContext securityContext) {
        if (data.getChanges().isEmpty()) {
            return null;
        }
        AuditEntryBean entry = newEntry(bean.getApi().getOrganization().getId(), AuditEntityType.Api, securityContext);
        entry.setEntityId(bean.getApi().getId());
        entry.setEntityVersion(bean.getVersion());
        entry.setWhat(AuditEntryType.Update);
        entry.setData(toJSON(data));
        return entry;
    }
189320
@Override
  public AnnotatedType api()
  {
    ServiceRefAmp delegate = delegate();
    
    if (delegate == null) {
      System.out.println("FAILED_DELEGATE: " + this);
    }
    
    return delegate().api();
  }
141208
protected ClientVersionBean getClientVersionInternal(String organizationId, String clientId, String version,
            boolean hasPermission) {
        try {
            storage.beginTx();
            ClientVersionBean clientVersion = storage.getClientVersion(organizationId, clientId, version);
            if (clientVersion == null) {
                throw ExceptionFactory.clientVersionNotFoundException(clientId, version);
            }
            // Hide some data if the user doesn't have the clientView permission
            if (!hasPermission) {
                clientVersion.setApikey(null);
            }
            storage.commitTx();
            log.debug(String.format("Got new client version %s: %s", clientVersion.getClient().getName(), clientVersion)); //$NON-NLS-1$
            return clientVersion;
        } catch (AbstractRestException e) {
            storage.rollbackTx();
            throw e;
        } catch (Exception e) {
            storage.rollbackTx();
            throw new SystemErrorException(e);
        }
    }
818068
public static AuditEntryBean clientCreated(ClientBean bean, ISecurityContext securityContext) {
        AuditEntryBean entry = newEntry(bean.getOrganization().getId(), AuditEntityType.Client, securityContext);
        entry.setEntityId(bean.getId());
        entry.setEntityVersion(null);
        entry.setData(null);
        entry.setWhat(AuditEntryType.Create);
        return entry;
    }
275497
public static EntityTypeActionOperation<String> getProtectionKeyId(
            ContentKeyType contentKeyType) {
        return new GetProtectionKeyIdActionOperation("GetProtectionKeyId")
                .addQueryParameter("contentKeyType",
                        String.format("%d", contentKeyType.getCode()))
                .setAcceptType(MediaType.APPLICATION_XML_TYPE);
    }
176931
public static appfwglobal_auditnslogpolicy_binding[] get(nitro_service service) throws Exception{
		appfwglobal_auditnslogpolicy_binding obj = new appfwglobal_auditnslogpolicy_binding();
		appfwglobal_auditnslogpolicy_binding response[] = (appfwglobal_auditnslogpolicy_binding[]) obj.get_resources(service);
		return response;
	}
144776
public static systemglobal_auditnslogpolicy_binding[] get_filtered(nitro_service service, String filter) throws Exception{
		systemglobal_auditnslogpolicy_binding obj = new systemglobal_auditnslogpolicy_binding();
		options option = new options();
		option.set_filter(filter);
		systemglobal_auditnslogpolicy_binding[] response = (systemglobal_auditnslogpolicy_binding[]) obj.getfiltered(service, option);
		return response;
	}
217249
public static AuditEntryBean planVersionUpdated(PlanVersionBean bean, EntityUpdatedData data,
            ISecurityContext securityContext) {
        if (data.getChanges().isEmpty()) {
            return null;
        }
        AuditEntryBean entry = newEntry(bean.getPlan().getOrganization().getId(), AuditEntityType.Plan, securityContext);
        entry.setEntityId(bean.getPlan().getId());
        entry.setEntityVersion(bean.getVersion());
        entry.setWhat(AuditEntryType.Update);
        entry.setData(toJSON(data));
        return entry;
    }
664417
@SuppressWarnings("PMD.NPathComplexity")
    private static boolean isConfigured(AuditType auditType, JSONArray jsonArray) {
        if (auditType.equals(AuditType.CODE_REVIEW)) {
            return (jsonArray.toJSONString().contains(DashboardAuditStatus.DASHBOARD_REPO_CONFIGURED.name()) ? true : false);
        }
        if (auditType.equals(AuditType.CODE_QUALITY)) {
            return (jsonArray.toJSONString().contains(DashboardAuditStatus.DASHBOARD_CODEQUALITY_CONFIGURED.name()) ? true : false);
        }
        if (auditType.equals(AuditType.STATIC_SECURITY_ANALYSIS)) {
            return (jsonArray.toJSONString().contains(DashboardAuditStatus.DASHBOARD_STATIC_SECURITY_ANALYSIS_CONFIGURED.name()) ? true : false);
        }
        if (auditType.equals(AuditType.LIBRARY_POLICY)) {
            return (jsonArray.toJSONString().contains(DashboardAuditStatus.DASHBOARD_LIBRARY_POLICY_ANALYSIS_CONFIGURED.name()) ? true : false);
        }
        if (auditType.equals(AuditType.TEST_RESULT)) {
            return (jsonArray.toJSONString().contains(DashboardAuditStatus.DASHBOARD_TEST_CONFIGURED.name()) ? true : false);
        }
        if (auditType.equals(AuditType.PERF_TEST)) {
            return (jsonArray.toJSONString().contains(DashboardAuditStatus.DASHBOARD_PERFORMANCE_TEST_CONFIGURED.name()) ? true : false);
        }
        if (auditType.equals(AuditType.BUILD_REVIEW)) {
            return (jsonArray.toJSONString().contains(DashboardAuditStatus.DASHBOARD_BUILD_CONFIGURED.name()) ? true : false);
        }
        return false;
    }
1045516
public static EntityGetOperation<AccessPolicyInfo> get(String accessPolicyId) {
        return new DefaultGetOperation<AccessPolicyInfo>(ENTITY_SET,
                accessPolicyId, AccessPolicyInfo.class);
    }
7482
public static AuditEntryBean contractBrokenToApi(ContractBean bean, ISecurityContext securityContext) {
        AuditEntryBean entry = newEntry(bean.getApi().getApi().getOrganization().getId(), AuditEntityType.Api, securityContext);
        entry.setWhat(AuditEntryType.BreakContract);
        entry.setEntityId(bean.getApi().getApi().getId());
        entry.setEntityVersion(bean.getApi().getVersion());
        ContractData data = new ContractData(bean);
        entry.setData(toJSON(data));
        return entry;
    }
478946
@Override
    public boolean checkTopicAccess(Subject authenticatedSubject, String topicSpace, String topicName, String operationType) throws MessagingAuthorizationException {
        String busName = null;
        String messagingEngine = null;
        String[] roles = null;
        String resource = null;
        
        if (auditManager != null) {
            if (auditManager.getJMSBusName() != null)
                busName = auditManager.getJMSBusName();
            if (auditManager.getJMSMessagingEngine() != null)
                messagingEngine = auditManager.getJMSMessagingEngine();
        }

        String destinationName = topicSpace;
        resource = "topicSpace";
        if (topicName != null) {
            destinationName = topicSpace + MessagingSecurityConstants.TOPIC_DELIMITER + topicName;
            resource = "topic";
        }
        
        SibTr.entry(tc, CLASS_NAME + "checkTopicAccess", new Object[] { authenticatedSubject, destinationName, operationType });
        checkIfUserIsAuthenticated(authenticatedSubject);
        String userName = null;
        String user = authenticatedSubject.getPrincipals().iterator().next().getName();
        
        Map<String, TopicPermission> mq = messagingSecurityService.getTopicPermissions();
        roles = messagingSecurityService.getDestinationRoles(mq, destinationName, user);
        SibTr.debug(tc, "checkTopicAccess, roles: " + Arrays.toString(roles));
        
        try {
            userName = MessagingSecurityUtility.getUniqueUserName(authenticatedSubject);
        } catch (MessagingSecurityException e) {
            if (auditManager != null && auditManager.getJMSConversationMetaData() != null) {
                ConversationMetaData cmd = (ConversationMetaData) auditManager.getJMSConversationMetaData();

                Audit.audit(Audit.EventID.SECURITY_JMS_AUTHZ_01, user, cmd.getRemoteAddress().getHostAddress(), new Integer(cmd.getRemotePort()).toString(),
                            cmd.getChainName(), busName, messagingEngine, destinationName, operationType, roles, resource,
                            Integer.valueOf("201"));
            } else {
                Audit.audit(Audit.EventID.SECURITY_JMS_AUTHZ_01, user, null, null, null, busName, messagingEngine, destinationName, operationType, 
                            roles, resource, Integer.valueOf("201"));
            }

            throw new MessagingAuthorizationException(Tr.formatMessage(tc, "USER_NOT_AUTHORIZED_MSE1010", userName, operationType, destinationName), e);
        }
        Map<String, TopicPermission> topicPermissions = messagingSecurityService.getTopicPermissions();
        TopicPermission permission = getTopicPermission(topicPermissions, destinationName);
        boolean result = checkPermission(permission, operationType, userName);
        if (!result) {
            if (auditManager != null && auditManager.getJMSConversationMetaData() != null) {
                ConversationMetaData cmd = (ConversationMetaData) auditManager.getJMSConversationMetaData();

                Audit.audit(Audit.EventID.SECURITY_JMS_AUTHZ_01, user, cmd.getRemoteAddress().getHostAddress(), new Integer(cmd.getRemotePort()).toString(),
                            cmd.getChainName(), busName, messagingEngine, destinationName, operationType, roles, resource,
                            Integer.valueOf("201"));
            } else {
                Audit.audit(Audit.EventID.SECURITY_JMS_AUTHZ_01, user, null, null, null, busName, messagingEngine, destinationName, operationType, 
                            roles, resource, Integer.valueOf("201"));
            }

            SibTr.debug(tc, "USER_NOT_AUTHORIZED_MSE1010",
                        new Object[] { userName, operationType, destinationName });
            throw new MessagingAuthorizationException(Tr.formatMessage(tc, "USER_NOT_AUTHORIZED_MSE1010", userName, operationType, destinationName));
        } else {
            if (auditManager != null && auditManager.getJMSConversationMetaData() != null) {
                ConversationMetaData cmd = (ConversationMetaData) auditManager.getJMSConversationMetaData();

                Audit.audit(Audit.EventID.SECURITY_JMS_AUTHZ_01, user, cmd.getRemoteAddress().getHostAddress(), new Integer(cmd.getRemotePort()).toString(),
                            cmd.getChainName(), busName, messagingEngine, destinationName, operationType, roles, resource,
                            Integer.valueOf("200"));
            } else {
                Audit.audit(Audit.EventID.SECURITY_JMS_AUTHZ_01, user, null, null, null, busName, messagingEngine, destinationName, operationType, 
                            roles, resource, Integer.valueOf("200"));
            }
        }

        SibTr.exit(tc, CLASS_NAME + "checkTopicAccess", result);
        return result;
    }
384615
public static Optional<MappingColumn> getVersionMappingColumn(final Class<?> entityType) {
		return Arrays.stream(getMappingColumns(entityType))
				.filter(MappingColumn::isVersion)
				.findFirst();
	}
433313
public static AuditEntryBean apiPublished(ApiVersionBean bean,
            ISecurityContext securityContext) {
        AuditEntryBean entry = newEntry(bean.getApi().getOrganization().getId(), AuditEntityType.Api, securityContext);
        entry.setEntityId(bean.getApi().getId());
        entry.setEntityVersion(bean.getVersion());
        entry.setWhat(AuditEntryType.Publish);
        return entry;
    }