extractDialog [sv]

extractDialog (swedish)

Scripts

Dataset
Last changed
07/06/2018 14:57:22
Code
extractDialog
Name
extractDialog
Swedish

Source code
var result = false; var IndexService = Java.type("se.altrusoft.entitymachine.index.IndexService"); var Schema = Java.type("se.altrusoft.entitymachine.schema.Schema"); var PropertyType = Java.type("se.altrusoft.entitymachine.schema.PropertyType"); var PropertyValue = Java.type("se.altrusoft.entitymachine.entity.PropertyValue"); var PropertyStatus = Java.type("se.altrusoft.entitymachine.entity.PropertyStatus"); var KulturNavPropertyStatus = Java.type("models.KulturNavPropertyStatus"); var SecurityUtils = Java.type("security.SecurityUtils") var ServiceUtils = Java.type("util.ServiceUtils") var Constants = Java.type("util.Constants") var EntityUtils = Java.type("util.EntityUtils") var UserEnv = Java.type("util.UserEnv") var dialogProperties = entity.getProperty(Constants.PROPERTY_SUPERCONCEPT_DIALOG); var dialogCount = dialogProperties.size(); if (dialogCount > 0) { result = true; var user = UserEnv.getUser(); for (var ii = 0; ii < dialogCount; ii++) { var dialogProperty = dialogProperties.get(ii); dialogProperty.setStatus(KulturNavPropertyStatus.Obsolete); var dialogMessage = dialogProperty.getValue(); dialogMessage.setInline(false); dialogMessage.setAcl(entity.getAcl()); dialogMessage.addProperty(Constants.PROPERTY_EXTDATA_APPLIES_TO, new PropertyValue(null, PropertyType.ValueType.ENTITY_REFERENCE, entity.getUuid().toString())); dialogMessage.setSavedSource("SYSTEM"); if (storageService.put(dialogMessage, user, false)) { indexService.index(dialogMessage, IndexService.CommitMode.None); } } }