/* (non-Javadoc)
@see eu.atos.sla.util.IModelConversion#getEnforcementJobXML(eu.atos.sla.api.datamodel.IEnforcementJob)
551069
@Override
    public EnforcementJob getEnforcementJobXML(
            IEnforcementJob enforcementJob) {

        EnforcementJob enforcementJobXML = new EnforcementJob();

        enforcementJobXML.setAgreementId(enforcementJob.getAgreement().getAgreementId());
        enforcementJobXML.setEnabled(enforcementJob.getEnabled());
        enforcementJobXML.setLastExecuted(enforcementJob.getLastExecuted());

        return enforcementJobXML;
    }
863605
public static DocumentBuilderFactory getStandardDocumentBuilderFactory(boolean validating) {
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();

        try {
            // enable validation (must specify a grammar)
            dbf.setValidating(validating);
            dbf.setFeature("http://xml.org/sax/features/validation", validating);

            dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-dtd-grammar", validating);
            dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", validating);

            dbf.setFeature("http://apache.org/xml/features/validation/schema", true);
            dbf.setFeature("http://xml.org/sax/features/namespaces", true);

            dbf.setFeature("http://apache.org/xml/features/dom/include-ignorable-whitespace", false);
        } catch (ParserConfigurationException pce) {
            throw new RuntimeException("Cannot load standard DocumentBuilderFactory. " + pce.getMessage(), pce);
        }

        dbf.setNamespaceAware(true);
        dbf.setIgnoringComments(true);
        dbf.setExpandEntityReferences(true);

        return dbf;
    }
358429
public EngineResult createNewJob(String jobname) {
        HttpPost postRequest = new HttpPost(baseUrl);
        List<NameValuePair> nvp = new LinkedList<NameValuePair>();
        nvp.add(new BasicNameValuePair("action", "create"));
        nvp.add(new BasicNameValuePair("createpath", jobname));
        StringEntity postEntity = null;
        try {
            postEntity = new UrlEncodedFormEntity(nvp);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        postEntity.setContentType("application/x-www-form-urlencoded");
        postRequest.addHeader("Accept", "application/xml");
        postRequest.setEntity(postEntity);
        return engineResult(postRequest);
    }
1237960
public Job getJobFromId(String jobName) {
    // [START ]
    JobId jobIdObject = JobId.of(jobName);
    Job job = bigquery.getJob(jobIdObject);
    if (job == null) {
      // job was not found
    }
    // [END ]
    return job;
  }
699964
public static appfwxmlschema get(nitro_service service) throws Exception{
		appfwxmlschema obj = new appfwxmlschema();
		appfwxmlschema[] response = (appfwxmlschema[])obj.get_resources(service);
		return response[0];
	}
556372
public static Document convertToElementNode(String xmlString) throws Exception {
           DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
           dbf.setNamespaceAware(true);
    	   // Fortify Mod: Disable entity expansion to foil External Entity Injections
    	   dbf.setExpandEntityReferences(false);
           Document doc = dbf.newDocumentBuilder().newDocument();
           if (xmlString != null) {
           	    // Fortify Mod: disable external entity injection
              TransformerFactory tf = TransformerFactory.newInstance();
              tf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
              Transformer t = tf.newTransformer();
    		    // End Fortify Mod
              t.transform(new StreamSource(new StringReader(xmlString)), new DOMResult(doc));
           }
           return doc;
       }
1221740
private IProvider getProviderFromTemplate(eu.atos.sla.parser.data.wsag.Template templateXML) throws ModelConversionException {
        
        Context context = templateXML.getContext();
        
        String provider = null;
        try {
            ServiceProvider ctxProvider = ServiceProvider.fromString(context.getServiceProvider());
             
            switch (ctxProvider) {
            case AGREEMENT_RESPONDER:
                provider= context.getAgreementResponder();
                break;
            case AGREEMENT_INITIATOR:
                provider= context.getAgreementInitiator();
                break;
            }
        } catch (IllegalArgumentException e) {
            throw new ModelConversionException("The Context/ServiceProvider field must match with the word "+ServiceProvider.AGREEMENT_RESPONDER+ " or "+ServiceProvider.AGREEMENT_INITIATOR);
        }
        IProvider providerObj = providerDAO.getByUUID(provider);
        return providerObj;
    }
944903
public String toXML()
    {
        RepositoryTags tags = RepositoryTags.getInstance();
        String eol = SystemUtils.LINE_SEPARATOR;

        // write opening tag
        String result = "      " + tags.getOpeningTagNonClosingById(COLLECTION_DESCRIPTOR) + eol;

        // write attributes
        // name
        result       += "        " + tags.getAttribute(FIELD_NAME,this.getAttributeName()) + eol;

        // collection class is optional
        if (getCollectionClassName() != null)
        {
            result       += "        " + tags.getAttribute(COLLECTION_CLASS,this.getCollectionClassName()) + eol;
        }

        // element-class-ref
         result       += "        " + tags.getAttribute(ITEMS_CLASS,this.getItemClassName()) + eol;

        // indirection-table is optional
        if (isMtoNRelation())
        {
             result += "        " + tags.getAttribute(INDIRECTION_TABLE,getIndirectionTable()) + eol;
        }

        // proxyReference is optional, disabled by default
        if (isLazy())
        {
            result       += "        " + tags.getAttribute(PROXY_REFERENCE,"true") + eol;
            result       += "        " + tags.getAttribute(PROXY_PREFETCHING_LIMIT, "" + this.getProxyPrefetchingLimit()) + eol;
        }

        //reference refresh is optional, disabled by default
        if (isRefresh())
        {
             result       += "        " + tags.getAttribute(REFRESH,"true") + eol;
        }

        //auto retrieve
        result += "        " + tags.getAttribute(AUTO_RETRIEVE, "" + getCascadeRetrieve()) + eol;

        //auto update
        result += "        " + tags.getAttribute(AUTO_UPDATE, getCascadeAsString(getCascadingStore())) + eol;

        //auto delete
        result += "        " + tags.getAttribute(AUTO_DELETE, getCascadeAsString(getCascadingDelete())) + eol;

        //otm-dependent is optional, disabled by default
        if (getOtmDependent())
        {
            result += "        " + tags.getAttribute(OTM_DEPENDENT, "true") + eol;
        }

        // close opening tag
        result       += "      >" + eol;

        // write elements
         // inverse fk elements
        for (int i=0;i<getForeignKeyFields().size();i++)
        {
        Object obj = getForeignKeyFields().get(i);
        if (obj instanceof Integer)
        {
                String fkId = obj.toString();
            result += "        " + tags.getOpeningTagNonClosingById(INVERSE_FK) + " ";
                result += tags.getAttribute(FIELD_ID_REF, fkId) + "/>" + eol;
        }
        else
        {
                String fk = (String) obj;
            result += "        " + tags.getOpeningTagNonClosingById(INVERSE_FK) + " ";
                result += tags.getAttribute(FIELD_REF, fk) + "/>" + eol;
        }
        }

        // write optional M:N elements
        // m:n relationship settings, optional
        if (isMtoNRelation())
        {
            // foreign keys to this class
             for (int i=0;i<getFksToThisClass().length;i++)
             {
                String fkId = getFksToThisClass()[i];
                result += "        " + tags.getOpeningTagNonClosingById(FK_POINTING_TO_THIS_CLASS) + " ";
                result += tags.getAttribute(COLUMN_NAME, fkId) + "/>" + eol;
             }

            // foreign keys to item class
             for (int i=0;i<getFksToItemClass().length;i++)
             {
                String fkId = getFksToItemClass()[i];
                result += "        " + tags.getOpeningTagNonClosingById(FK_POINTING_TO_ITEMS_CLASS) + " ";
                result += tags.getAttribute(COLUMN_NAME, fkId) + "/>" + eol;
             }
        }

        // closing tag
        result       += "      " + tags.getClosingTagById(COLLECTION_DESCRIPTOR) + eol;
        return result;
    }
25223
private static XmlOptions getXmlOptions() {
        if (System.getProperty("runtimeEnv") == null && System.getProperty("mdw.runtime.env") == null)
            return new XmlOptions().setSavePrettyPrint().setSavePrettyPrintIndent(2); // avoid errors when running in Designer

        String[] xmlOptionsProperties = new String[] { PropertyNames.MDW_TRANSLATOR_XMLBEANS_LOAD_OPTIONS,
                PropertyNames.MDW_TRANSLATOR_XMLBEANS_SAVE_OPTIONS };
        /**
         * First set it up with default compatibility options
         */
        xmlOptions = new XmlOptions();

        /**
         * Next get the options that the user needs from the properties file.
         */
        Class<?> xmlOptionsClass = xmlOptions.getClass();

        for (int i = 0; i < xmlOptionsProperties.length; i++) {
            String property = xmlOptionsProperties[i];
            String opt = PropertyManager.getProperty(property);
            /**
             * Only do reflection if we need to
             */
            if (opt != null && !"".equals(opt)) {
                try {
                    String[] propTable = opt.split(",");
                    for (int j = 0; j < propTable.length; j++) {
                        String prop = propTable[j];
                        String[] optTable = prop.split("=");
                        String option = optTable[0];
                        String value = null;

                        Class<?>[] classArray = new Class<?>[] { Object.class };
                        if (optTable.length > 1) {
                            // Check for int
                            value = optTable[1];
                            classArray = new Class<?>[] { Object.class, Object.class };
                            boolean gotInteger = true;
                            try {
                                Integer.parseInt(value);
                            }
                            catch (NumberFormatException e) {
                                // It's not an integer
                                gotInteger = false;
                            }

                            Method method = xmlOptionsClass.getMethod("put", classArray);
                            method.invoke(xmlOptions, new Object[] { option,
                                    gotInteger ? Integer.valueOf(value) : value });

                        }
                        else {

                            Method method = xmlOptionsClass.getMethod("put", classArray);
                            method.invoke(xmlOptions, new Object[] { option });

                        }
                    }
                }
                catch (Exception ex) {
                    // Just log it
                    logger.severeException("Unable to set XMLOption " + opt + " due to " + ex.getMessage(), ex);

                }

            }
        }
        return xmlOptions;

    }
184871
private static Node getXmlSignatureInsertLocation(final Element elem) {
        val nodeListExtensions = elem.getElementsByTagNameNS(SAMLConstants.SAML20P_NS, "Extensions");
        if (nodeListExtensions.getLength() != 0) {
            return nodeListExtensions.item(nodeListExtensions.getLength() - 1);
        }
        val nodeListStatus = elem.getElementsByTagNameNS(SAMLConstants.SAML20P_NS, "Status");
        return nodeListStatus.item(nodeListStatus.getLength() - 1);
    }
1297106
private void processWebModulePersistenceXml(JPAApplInfo applInfo, ContainerInfo warContainerInfo, ClassLoader warClassLoader) {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled()) {
            Tr.entry(tc, "processWebModulePersistenceXml : " + applInfo.getApplName() + "#" + warContainerInfo);
        }

        String archiveName = warContainerInfo.getName();
        Container warContainer = warContainerInfo.getContainer();

        // ------------------------------------------------------------------------
        // JPA 2.0 Specification - 8.2 Persistence Unit Packaging
        //
        // A persistence unit is defined by a persistence.xml file. The jar file or
        // directory whose META-INF directory contains the persistence.xml file is
        // termed the root of the persistence unit. In Java EE environments, the
        // root of a persistence unit may be one of the following:
        //
        // -> the WEB-INF/classes directory of a WAR file
        // -> a jar file in the WEB-INF/lib directory of a WAR file
        // ------------------------------------------------------------------------

        // Obtain any persistence.xml in WEB-INF/classes/META-INF
        Entry pxml = warContainer.getEntry("WEB-INF/classes/META-INF/persistence.xml");
        if (pxml != null) {
            String appName = applInfo.getApplName();
            URL puRoot = getPXmlRootURL(appName, archiveName, pxml);
            applInfo.addPersistenceUnits(new OSGiJPAPXml(applInfo, archiveName, JPAPuScope.Web_Scope, puRoot, warClassLoader, pxml));
        }

        // Obtain any persistenc.xml in WEB-INF/lib/*.jar. This includes 'utility'
        // jars and web fragments. Any PUs found are WEB scoped and considered to
        // be in the WAR, so just use the WAR archiveName (don't use a root prefix
        // that is prepended to the jar/fragment name).
        Entry webInfLib = warContainer.getEntry("WEB-INF/lib/");
        if (webInfLib != null) {
            try {
                Container webInfLibContainer = webInfLib.adapt(Container.class);
                processLibraryJarPersistenceXml(applInfo, webInfLibContainer, archiveName, null, JPAPuScope.Web_Scope, warClassLoader);
            } catch (UnableToAdaptException ex) {
                // Should never occur... just propagate failure
                throw new RuntimeException("Failure locating persistence.xml", ex);
            }
        }

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "processWebModulePersistenceXml : " + applInfo.getApplName() +
                        "#" + warContainer);
    }
718331
public boolean getForceXMLConfigurationValue(InitParams initParams)
   {
      ValueParam valueParam = initParams.getValueParam("force-xml-configuration");
      return (valueParam != null ? Boolean.valueOf(valueParam.getValue()) : false);
   }
327957
@Override
    public IProvider getProviderFromProviderXML(eu.atos.sla.parser.data.Provider providerXML) {

        IProvider provider = new eu.atos.sla.datamodel.bean.Provider();

        if (providerXML.getUuid() != null) {

            provider.setUuid(providerXML.getUuid());
        } else {

            provider.setUuid(UUID.randomUUID().toString());
        }

        if (providerXML.getName() != null) {
            provider.setName(providerXML.getName());
        }

        return provider;
    }
169551
@Override
    public List<OperableTrigger> getTriggersForJob(final JobKey jobKey) throws JobPersistenceException {
        return doWithLock(new LockCallback<List<OperableTrigger>>() {
            @Override
            public List<OperableTrigger> doWithLock(JedisCommands jedis) throws JobPersistenceException {
                return storage.getTriggersForJob(jobKey, jedis);
            }
        }, "Could not retrieve triggers for job.");
    }
193344
protected void traceJobXML(String jobXML) {

        if (logger.isLoggable(Level.FINE)) {
            int concatLen = jobXML.length() > 200 ? 200 : jobXML.length();
            logger.fine("Starting job: " + jobXML.substring(0, concatLen) + "... truncated ...");
        }
    }
1055643
@Override
    public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
        StringBuilder buf = new StringBuilder();

        buf.append('<').append(getElementName()).append(" xmlns=\"");
        buf.append(getNamespace()).append("\" ");

        synchronized (candidates) {
            if (getCandidatesCount() > 0) {
                buf.append('>');
                Iterator<JingleTransportCandidate> iter = getCandidates();

                while (iter.hasNext()) {
                    JingleTransportCandidate candidate = iter.next();
                    buf.append(candidate.toXML());
                }
                buf.append("</").append(getElementName()).append('>');
            } else {
                buf.append("/>");
            }
        }

        return buf.toString();
    }
313229
public static appfwprofile_xmlxss_binding[] get(nitro_service service, String name) throws Exception{
		appfwprofile_xmlxss_binding obj = new appfwprofile_xmlxss_binding();
		obj.set_name(name);
		appfwprofile_xmlxss_binding response[] = (appfwprofile_xmlxss_binding[]) obj.get_resources(service);
		return response;
	}