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


Java ScriptLocationType類代碼示例

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


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

示例1: getLocationType

import org.xdi.model.ScriptLocationType; //導入依賴的package包/類
public ScriptLocationType getLocationType() {
	SimpleCustomProperty moduleProperty = getModuleProperty(LOCATION_TYPE_MODEL_PROPERTY);
	if (moduleProperty == null) {
		return null;
	}

	return ScriptLocationType.getByValue(moduleProperty.getValue2());
}
 
開發者ID:GluuFederation,項目名稱:oxCore,代碼行數:9,代碼來源:CustomScript.java

示例2: getLocationTypes

import org.xdi.model.ScriptLocationType; //導入依賴的package包/類
public ScriptLocationType[] getLocationTypes() {
	return new ScriptLocationType[] { ScriptLocationType.LDAP,  ScriptLocationType.FILE };
}
 
開發者ID:AgarwalNeha1,項目名稱:gluu,代碼行數:4,代碼來源:ApplianceService.java

示例3: save

import org.xdi.model.ScriptLocationType; //導入依賴的package包/類
@Restrict("#{s:hasPermission('configuration', 'access')}")
public String save() {
	try {
		List<CustomScript> oldCustomScripts = customScriptService.findCustomScripts(Arrays.asList(this.applianceService.getCustomScriptTypes()), "dn", "inum");

		List<String> updatedInums = new ArrayList<String>();

		for (Entry<CustomScriptType, List<CustomScript>> customScriptsByType : this.customScriptsByTypes.entrySet()) {
			List<CustomScript> customScripts = customScriptsByType.getValue();

			for (CustomScript customScript : customScripts) {
				
				String configId = customScript.getName();
				if (StringHelper.equalsIgnoreCase(configId, OxConstants.SCRIPT_TYPE_INTERNAL_RESERVED_NAME)) {
					facesMessages.add(Severity.ERROR, "'{0}' is reserved script name", configId);
					return OxTrustConstants.RESULT_FAILURE;
				}

				customScript.setRevision(customScript.getRevision() + 1);

				boolean update = true;
				String dn = customScript.getDn();
				String customScriptId = customScript.getInum();
				if (StringHelper.isEmpty(dn)) {
					String basedInum = OrganizationService.instance().getOrganizationInum();
					customScriptId = basedInum + "!" + INumGenerator.generate(2);
					dn = customScriptService.buildDn(customScriptId);

					customScript.setDn(dn);
					customScript.setInum(customScriptId);
					update = false;
				};

				customScript.setDn(dn);
				customScript.setInum(customScriptId);
				
				if (ScriptLocationType.LDAP == customScript.getLocationType()) {
					customScript.removeModuleProperty(CustomScript.LOCATION_PATH_MODEL_PROPERTY);
				}
				
				if (customScript.getConfigurationProperties().size() == 0) {
					customScript.setConfigurationProperties(null);
				}
				
				if (customScript.getModuleProperties().size() == 0) {
					customScript.setModuleProperties(null);
				}
				
				updatedInums.add(customScriptId);

				if (update) {
					customScriptService.update(customScript);
				} else {
					customScriptService.add(customScript);
				}
			}
		}
		
		// Remove removed scripts
		for (CustomScript oldCustomScript : oldCustomScripts) {
			if (!updatedInums.contains(oldCustomScript.getInum())) {
				customScriptService.remove(oldCustomScript);
			}
		}
	} catch (LdapMappingException ex) {
		log.error("Failed to update custom scripts", ex);
		return OxTrustConstants.RESULT_FAILURE;
	}

	reset();

	return OxTrustConstants.RESULT_SUCCESS;
}
 
開發者ID:AgarwalNeha1,項目名稱:gluu,代碼行數:74,代碼來源:ManageCustomScriptAction.java

示例4: save

import org.xdi.model.ScriptLocationType; //導入依賴的package包/類
public String save() {
	try {
		List<CustomScript> oldCustomScripts = customScriptService.findCustomScripts(Arrays.asList(this.applianceService.getCustomScriptTypes()), "dn", "inum");

		List<String> updatedInums = new ArrayList<String>();

		for (Entry<CustomScriptType, List<CustomScript>> customScriptsByType : this.customScriptsByTypes.entrySet()) {
			List<CustomScript> customScripts = customScriptsByType.getValue();

			for (CustomScript customScript : customScripts) {
				
				String configId = customScript.getName();
				if (StringHelper.equalsIgnoreCase(configId, OxConstants.SCRIPT_TYPE_INTERNAL_RESERVED_NAME)) {
					facesMessages.add(FacesMessage.SEVERITY_ERROR, "'{0}' is reserved script name", configId);
					return OxTrustConstants.RESULT_FAILURE;
				}

				customScript.setRevision(customScript.getRevision() + 1);

				boolean update = true;
				String dn = customScript.getDn();
				String customScriptId = customScript.getInum();
				if (StringHelper.isEmpty(dn)) {
					String basedInum = organizationService.getOrganizationInum();
					customScriptId = basedInum + "!" + INumGenerator.generate(2);
					dn = customScriptService.buildDn(customScriptId);

					customScript.setDn(dn);
					customScript.setInum(customScriptId);
					update = false;
				};

				customScript.setDn(dn);
				customScript.setInum(customScriptId);
				
				if (ScriptLocationType.LDAP == customScript.getLocationType()) {
					customScript.removeModuleProperty(CustomScript.LOCATION_PATH_MODEL_PROPERTY);
				}
				
				if ((customScript.getConfigurationProperties() != null) && (customScript.getConfigurationProperties().size() == 0)) {
					customScript.setConfigurationProperties(null);
				}
				
				if ((customScript.getConfigurationProperties() != null) && (customScript.getModuleProperties().size() == 0)) {
					customScript.setModuleProperties(null);
				}
				
				updatedInums.add(customScriptId);

				if (update) {
					customScriptService.update(customScript);
				} else {
					customScriptService.add(customScript);
				}
			}
		}
		
		// Remove removed scripts
		for (CustomScript oldCustomScript : oldCustomScripts) {
			if (!updatedInums.contains(oldCustomScript.getInum())) {
				customScriptService.remove(oldCustomScript);
			}
		}
	} catch (BaseMappingException ex) {
		log.error("Failed to update custom scripts", ex);
		facesMessages.add(FacesMessage.SEVERITY_ERROR, "Failed to update custom script configuration");

		return OxTrustConstants.RESULT_FAILURE;
	}

	facesMessages.add(FacesMessage.SEVERITY_INFO, "Custom script configuration updated successfully");

	return OxTrustConstants.RESULT_SUCCESS;
}
 
開發者ID:GluuFederation,項目名稱:oxTrust,代碼行數:75,代碼來源:ManageCustomScriptAction.java

示例5: setLocationType

import org.xdi.model.ScriptLocationType; //導入依賴的package包/類
public void setLocationType(ScriptLocationType locationType) {
	if(locationType != null)
		setModuleProperty(LOCATION_TYPE_MODEL_PROPERTY, locationType.getValue());
}
 
開發者ID:GluuFederation,項目名稱:oxCore,代碼行數:5,代碼來源:CustomScript.java


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