//////////////////////////////////////////////////////////
196111
public static String generateMixPassword(final int n) {
		final char[] pw = new char[n];
		int c = 'A';
		int r1 = 0;
		for (int i = 0; i < n; i++) {
			r1 = (int) (Math.random() * 3);
			switch (r1) {
			case 0:
				c = '0' + (int) (Math.random() * 10);
				break;
			case 1:
				c = 'a' + (int) (Math.random() * 26);
				break;
			case 2:
				c = 'A' + (int) (Math.random() * 26);
				break;
			}
			pw[i] = (char) c;
		}
		return new String(pw);
	}
593192
@Override
    public <P> void pojoDaoCreated(PojoDaoFactoryEvent<P> event) {
        String tableName = event.getTableName();
        Schema schema = new Schema();
        event.getPojoBinding().describe(schema.createTable(tableName), schema);

        schema.items().forEach(schemaItem -> {
            final String key = schemaItem.getKey();
            final String claimId = UUID.randomUUID().toString();
            session.execute(insertStatement.bind(key, claimId));
            Row row = session.execute(selectStatement.bind(key)).one();
            if (StringUtils.equals(claimId, row.getString(0))) {
                final SchemaStatement statement = schemaItem.createStatement();
                LOGGER.info("Creating table(s) to support \"{}\":\n\t{}\n", event.getPojoBinding().getPojoType().getSimpleName(), statement);
                session.execute(statement);
            }
        });
    }
8539
function() {
         //copy to make real Array
         var args = Array.prototype.slice.call( arguments );
         var action = args.shift();
         args = deduceArgs(args);
         var txn = args[1].txn, data = args[0], callback = args[1].callback,
            comment = args[1].comment, override = args[1].override,
            fileinput = args[1].fileinput;
         var commitNow = false;
         // set changedOnly default to true unless action == replace
         var changedOnly = typeof args[1].changedOnly !== 'undefined'
                              ? args[1].changedOnly : action !== 'replace';
         if (!txn) {
             txn = this.data('currentTxn');
             if (!txn) {
                 txn = new Txn(args[1].url || $.db.url);
                 commitNow = true;
             } else if (args[1].url) {
               konsole.assert(txn.url ===  args[1].url);
             }
         }
      try {
         //konsole.log('execute', action, data, callback);
         var requestIds = [];
         if (data) {
            if (action == 'query') {
                if (!data.conditions) {
                    data = { conditions : data };
                }
                //assert data.query;
                var thisid = this.attr('itemid');
                if (thisid) {
                    if (!data.bindvars) {
                        data.bindvars = {}
                    }
                    data.bindvars['this'] =  thisid;
                }
            } else if (!data[_IDkey] && this.attr('itemid')) {
                data[_IDkey] = this.attr('itemid');
            }
            requestIds = [txn.execute(action, data, callback, this.length ? this[0] : null)];
            if (fileinput)
             txn._addFileInput(fileinput, data, requestIds[0]);
         } else {
            konsole.assert(!fileinput);
            requestIds = this.map(function() {
                var obj = bindElement(this, false, undefined, changedOnly);
                if (override) {
                  if (typeof override == 'function')
                    obj = override(obj);
                  else
                    $.extend(obj[0], override);
                }

                var requestid = txn.execute(action, obj, callback, this);
                $(this).find('[data-dbmethod]').each(function() {
                  txn._addFileInput(this, obj, requestid);
                });
                //konsole.log('about to', action, 'obj', obj);
                return requestid;
            }).get();
         }
         if (comment) { //XXX this is all kind of hacky
            comment = comment.replace('$new0', '$new'+requestIds[0]);
            if (txn.txnComment)
                txn.txnComment += ' and ' + comment;
            else
                txn.txnComment = comment;
         }
       } catch (err) {
         // invoke callback if it hasn't already been bound
         // (if we have requestIds then it has)
         var rollbackCB = null;
         if (callback && !requestIds.length) {
           var elem = this;
           rollbackCB = function(response) {
              // note: if callback returns false event bubbling is stopped
              return callback.call(elem, null, response.error);
           };
         }
         this.dbRollback(rollbackCB, err, txn);
         return this;
       }
         if (commitNow)
            txn.commit(null, this);
         return this;
     }
9636
function ElementDataSource(config) {
	var newData = [],
		newColumns = [];

	var headings = config.data.all('tr th');

	headings.each(function(th){
		newColumns.push(th.getHtml());
	});

	config.data.all('tr').each(function(tr){
		var newRow = {},
			populated = false;

		for (var i = 0, numCols = headings.size(); i < numCols; i++) {

			if (!tr.all('td').item(i)) { continue; }

			newRow[headings.item(i).getHtml()] = tr.all('td').item(i).getHtml();
			populated = true;
		}

		if (populated) {
			newData.push(newRow);
		}
	});

	config.columns = newColumns;
	config.data = newData;

	return new JSONDataSource(config);
}
799726
void onDataSetSelected() {
        String selectedUUID = view.getSelectedDataSetId();
        for (DataSetDef dataSetDef : _dataSetDefList) {
            if (dataSetDef.getUUID().equals(selectedUUID)) {
                fetchMetadata(selectedUUID,
                              new RemoteCallback<DataSetMetadata>() {

                                  public void callback(DataSetMetadata metadata) {
                                      dataSetLookup = lookupConstraints.newDataSetLookup(metadata);
                                      updateDataSetLookup();
                                      changeEvent.fire(new DataSetLookupChangedEvent(dataSetLookup));
                                  }
                              });
            }
        }
    }
819036
void submit() {

        CmsObject cms = A_CmsUI.getCmsObject();
        try {
            List<CmsUUID> changedIds = Lists.newArrayList();
            CmsResourceDeleteMode mode = (CmsResourceDeleteMode)m_deleteSiblings.getValue();
            for (CmsResource resource : m_context.getResources()) {
                changedIds.add(resource.getStructureId());
                CmsLockActionRecord lockRecord = CmsLockUtil.ensureLock(cms, resource);
                try {
                    cms.deleteResource(cms.getSitePath(resource), mode);
                } finally {
                    if (lockRecord.getChange().equals(LockChange.locked)) {
                        if (!resource.getState().isNew()) {
                            try {
                                cms.unlockResource(resource);
                            } catch (CmsVfsResourceNotFoundException e) {
                                LOG.warn(e.getLocalizedMessage(), e);
                            } catch (CmsLockException e) {
                                LOG.warn(e.getLocalizedMessage(), e);
                            }
                        }
                    }
                }
            }
            m_context.finish(changedIds);
        } catch (Exception e) {
            m_context.error(e);
        }
    }
788560
@Override
    public void selectionChanged(IAction action, ISelection selection) {

        bugInstance = null;
        // TODO learn to deal with ALL elements
        IMarker markerFromSelection = MarkerUtil.getMarkerFromSingleSelection(selection);
        marker = markerFromSelection;

        if (marker == null) {
            // No marker selected.
            return;
        }
        if (DEBUG) {
            System.out.println("Found a marker!");
        }

        bugInstance = MarkerUtil.findBugInstanceForMarker(marker);
        if (bugInstance != null) {
            if (DEBUG) {
                System.out.println("Found BugInstance for SpotBugs warning marker!");
            }
        }
    }
1238792
function(){
        var helperParameters = this.parameters;
        var linkTextPath = helperParameters.options.linkTextPath;
        var paths = getResolvedPaths(helperParameters);
        var length = paths.length;
        var path, i, normalizedPath;

        if (linkTextPath) {
          normalizedPath = getNormalizedPath(linkTextPath, helperParameters);
          this.registerObserver(normalizedPath.root, normalizedPath.path, this, this.rerender);
        }

        for(i=0; i < length; i++) {
          path = paths[i];
          if (null === path) {
            // A literal value was provided, not a path, so nothing to observe.
            continue;
          }

          normalizedPath = getNormalizedPath(path, helperParameters);
          this.registerObserver(normalizedPath.root, normalizedPath.path, this, this._paramsChanged);
        }

        var queryParamsObject = this.queryParamsObject;
        if (queryParamsObject) {
          var values = queryParamsObject.values;

          // Install observers for all of the hash options
          // provided in the (query-params) subexpression.
          for (var k in values) {
            if (!values.hasOwnProperty(k)) { continue; }

            if (queryParamsObject.types[k] === 'ID') {
              normalizedPath = getNormalizedPath(values[k], helperParameters);
              this.registerObserver(normalizedPath.root, normalizedPath.path, this, this._paramsChanged);
            }
          }
        }
      }
109584
function(conf, params, debug, wiring_collection, cb) {
	simpleflow.run(conf, params, debug, function(name, cb) {
		wiring_collection.findOne({
			//_id: ObjectID.createFromHexString(req.param('id')) 
			name: name
		}, function(error, wiring) {
			if(error) { throw error; }
			
			if(!wiring) {
				throw "Wiring '"+name+"' was not found !";
			}
			/*console.log("error");
			console.log(error);
			console.log("wiring");
			console.log(wiring);*/
			
			cb(wiring.config);
		});
	}, cb);
}
424409
function (params, viewModel, clientLocals, cb) {
                  viewModel = viewModel || {};
                  clientLocals = clientLocals || {};

                  var generateOptions = {
                    directory: options.directory,
                    packName: options.packName,
                    cardName: options.cardName,
                    url: options.url,
                    key: params.cardKey,
                    title: viewModel.title || '',
                    link: viewModel.link,
                    css: params.light !== true,
                    client$Support: Card.client$Support || false,
                    clientStateSupport: Card.clientStateSupport || false,
                    clientProxySupport: Card.clientProxySupport || false,
                    clientAnalyticsSupport: Card.clientAnalyticsSupport || false,
                    viewModel: viewModel,
                    clientLocals: clientLocals
                  };

                  generateCardDocument(generateOptions, function (html) {
                    cb(null, html);
                  });
                }
295230
public static List<UserCustomColumn> createRequiredColumns(
			int startingIndex, String idColumnName) {

		if (idColumnName == null) {
			idColumnName = COLUMN_ID;
		}

		List<UserCustomColumn> columns = new ArrayList<>();
		columns.add(createIdColumn(startingIndex++, idColumnName));
		columns.add(createDataColumn(startingIndex++));
		columns.add(createContentTypeColumn(startingIndex++));

		return columns;
	}
254596
function showRelated(opt, divId, relatedListXML, relatedColumnsXML) {

        var columnSelectSelected;
        var thisFunction = "SPServices.SPDisplayRelatedInfo";

        // Find the column's select (dropdown)
        var columnSelect = $().SPServices.SPDropdownCtl({
            displayName: opt.columnName
        });

        // Get the current column selection(s)
        columnSelectSelected = getDropdownSelected(columnSelect, opt.matchOnId);
        if (columnSelect.Type === dropdownType.complex && opt.numChars > 0 && columnSelectSelected[0].length < opt.numChars) {
            return;
        }

        // If the selection hasn't changed, then there's nothing to do right now.  This is useful to reduce
        // the number of Web Service calls when the parentSelect.Type = dropdownType.complex, as there are multiple propertychanges
        // which don't require any action.
        if (columnSelect.Obj.attr("showRelatedSelected") === columnSelectSelected[0]) {
            return;
        }
        columnSelect.Obj.attr("showRelatedSelected", columnSelectSelected[0]);

        // Remove the old container...
        $("#" + divId).remove();
        // ...and append a new, empty one
        columnSelect.Obj.parent().append("<div id=" + divId + "></div>");

        // Get the list items which match the current selection
        var camlQuery = "<Query><Where>";
        if (opt.CAMLQuery.length > 0) {
            camlQuery += "<And>";
        }

        // Need to handle Lookup columns differently than static columns
        var relatedListColumnType = relatedColumnsXML[opt.relatedListColumn].attr("Type");
        if (relatedListColumnType === "Lookup") {
            camlQuery += "<Eq><FieldRef Name='" + opt.relatedListColumn +
            (opt.matchOnId ? "' LookupId='True'/><Value Type='Integer'>" : "'/><Value Type='Text'>") +
            escapeColumnValue(columnSelectSelected[0]) + "</Value></Eq>";
        } else {
            camlQuery += "<Eq><FieldRef Name='" +
            (opt.matchOnId ? "ID' /><Value Type='Counter'>" : opt.relatedListColumn + "'/><Value Type='Text'>") +
            escapeColumnValue(columnSelectSelected[0]) + "</Value></Eq>";
        }

        if (opt.CAMLQuery.length > 0) {
            camlQuery += opt.CAMLQuery + "</And>";
        }
        camlQuery += "</Where></Query>";

        var viewFields = " ";
        for (i = 0; i < opt.relatedColumns.length; i++) {
            viewFields += "<FieldRef Name='" + opt.relatedColumns[i] + "' />";
        }

        $().SPServices({
            operation: "GetListItems",
            async: false,
            webURL: opt.relatedWebURL,
            listName: opt.relatedList,
            // Filter based on the column's currently selected value
            CAMLQuery: camlQuery,
            CAMLViewFields: "<ViewFields>" + viewFields + "</ViewFields>",
            // Override the default view rowlimit and get all appropriate rows
            CAMLRowLimit: 0,
            completefunc: function (xData) {

                // Handle errors
                $(xData.responseXML).find("errorstring").each(function () {
                    var errorText = $(this).text();
                    if (opt.debug && errorText === "One or more field types are not installed properly. Go to the list settings page to delete these fields.") {
                        errBox(thisFunction,
                            "relatedListColumn: " + opt.relatedListColumn,
                            "Column not found in relatedList " + opt.relatedList);
                    } else if (opt.debug && errorText === "Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).") {
                        errBox(thisFunction,
                            "relatedList: " + opt.relatedList,
                            "List not found");
                    }

                });

                var outString;
                // Output each row
                switch (opt.displayFormat) {
                    // Only implementing the table format in the first iteration (v0.2.9)
                    case "table":
                        outString = "<table>";
                        outString += "<tr>";
                        for (i = 0; i < opt.relatedColumns.length; i++) {
                            if (typeof relatedColumnsXML[opt.relatedColumns[i]] === "undefined" && opt.debug) {
                                errBox(thisFunction, "columnName: " + opt.relatedColumns[i], "Column not found in relatedList");
                                return;
                            }
                            outString += "<th class='" + opt.headerCSSClass + "'>" + relatedColumnsXML[opt.relatedColumns[i]].attr("DisplayName") + "</th>";
                        }
                        outString += "</tr>";
                        // Add an option for each child item
                        $(xData.responseXML).SPFilterNode("z:row").each(function () {
                            outString += "<tr>";
                            for (i = 0; i < opt.relatedColumns.length; i++) {
                                outString += "<td class='" + opt.rowCSSClass + "'>" + showColumn(relatedListXML, relatedColumnsXML[opt.relatedColumns[i]], $(this).attr("ows_" + opt.relatedColumns[i]), opt) + "</td>";
                            }
                            outString += "</tr>";
                        });
                        outString += "</table>";
                        break;
                    // list format implemented in v0.5.0. Still table-based, but vertical orientation.
                    case "list":
                        outString = "<table>";
                        $(xData.responseXML).SPFilterNode("z:row").each(function () {
                            for (i = 0; i < opt.relatedColumns.length; i++) {
                                if (typeof relatedColumnsXML[opt.relatedColumns[i]] === "undefined" && opt.debug) {
                                    errBox(thisFunction, "columnName: " + opt.relatedColumns[i], "Column not found in relatedList");
                                    return;
                                }
                                outString += "<tr>";
                                outString += "<th class='" + opt.headerCSSClass + "'>" + relatedColumnsXML[opt.relatedColumns[i]].attr("DisplayName") + "</th>";
                                outString += "<td class='" + opt.rowCSSClass + "'>" + showColumn(relatedListXML, relatedColumnsXML[opt.relatedColumns[i]], $(this).attr("ows_" + opt.relatedColumns[i]), opt) + "</td>";
                                outString += "</tr>";
                            }
                        });
                        outString += "</table>";
                        break;
                    default:
                        break;
                }
                // Write out the results
                $("#" + divId).html(outString);
            }
        });
        // If present, call completefunc when all else is done
        if (opt.completefunc !== null) {
            opt.completefunc();
        }
    }
1183692
public static void main(String[] args) throws Exception {

		final List<String> arguments = new ArrayList<String>(args.length);

		final Settings settings = new Settings();
		final PartialCmdLineParser parser = new PartialCmdLineParser(settings);
		int position = 0;

		while (position < args.length) {
			final int consumed = parser.parseArgument(args, position);
			if (consumed == 0) {
				arguments.add(args[position++]);
			} else {
				position += consumed;
			}
		}

		if (!arguments.contains(JsonixPlugin.OPTION)) {
			arguments.add(JsonixPlugin.OPTION);
		}

		if (!arguments.contains("-extension")) {
			arguments.add("-extension");
		}

		// TODO
		arguments.add("-disableXmlSecurity");
		// TODO
		System.setProperty("javax.xml.accessExternalSchema", "all");
		// TODO
		System.setProperty("javax.xml.accessExternalDTD", "all");

		File targetDirectory = settings.getTargetDirectory();

		if (targetDirectory == null) {
			targetDirectory = new File(".");
		}

		if (!targetDirectory.exists()) {
			targetDirectory.mkdirs();
		}

		arguments.add("-d");
		arguments.add(targetDirectory.getAbsolutePath());

		final Options options = new Options();

		options.parseArguments(arguments.toArray(new String[arguments.size()]));

		new JsonixMain(settings, options).execute();
	}
1309773
protected void init() {

        m_elementMappings = new HashMap<String, List<String>>();
        m_elementWidgets = new HashMap<String, I_CmsWidget>();
        m_validationErrorRules = new HashMap<String, String>();
        m_validationErrorMessages = new HashMap<String, String>();
        m_validationWarningRules = new HashMap<String, String>();
        m_validationWarningMessages = new HashMap<String, String>();
        m_defaultValues = new HashMap<String, String>();
        m_configurationValues = new HashMap<String, String>();
        m_searchSettings = new HashMap<String, Boolean>();
        m_relations = new HashMap<String, CmsRelationType>();
        m_relationChecks = new HashMap<String, Boolean>();
        m_previewLocation = null;
        m_modelFolder = null;
        m_tabs = new ArrayList<CmsXmlContentTab>();
        m_cssHeadIncludes = new LinkedHashSet<String>();
        m_jsHeadIncludes = new LinkedHashSet<String>();
        m_settings = new LinkedHashMap<String, CmsXmlContentProperty>();
        m_titleMappings = new ArrayList<String>(2);
        m_formatters = new ArrayList<CmsFormatterBean>();
        m_searchFields = new HashMap<String, CmsSearchField>();
        m_searchFieldsPage = new HashMap<String, CmsSearchField>();
        m_allowedTemplates = new CmsDefaultSet<String>();
        m_allowedTemplates.setDefaultMembership(true);
        m_displayTypes = new HashMap<String, DisplayType>();
        m_synchronizations = new ArrayList<String>();
        m_editorChangeHandlers = new ArrayList<I_CmsXmlContentEditorChangeHandler>();
        m_nestedFormatterElements = new HashSet<String>();
        try (
        InputStream stream = CmsDefaultXmlContentHandler.class.getResourceAsStream("simple-searchsetting-configs.st")) {
            m_searchTemplateGroup = CmsStringUtil.readStringTemplateGroup(stream);
        } catch (IOException e) {
            LOG.error(e.getLocalizedMessage(), e);
        }
    }
1024419
@Override
    public void postCostConstraints() {
        if (!costActivated) {
            costActivated = true;
            rp.getLogger().debug("Post the cost-oriented constraints");
            List<IntVar> mttrs = Stream.concat(rp.getVMActions().stream(), rp.getNodeActions().stream())
                    .map(Transition::getEnd).collect(Collectors.toList());

            rp.getModel().post(rp.getModel().sum(mttrs.toArray(new IntVar[0]), "=", cost));
        }
    }
4310
private void createDayPanel() {

        CmsCheckBox box = new CmsCheckBox(Messages.get().key(Messages.GUI_SERIALDATE_DAY_MONDAY_0));
        box.setInternalValue(WeekDay.MONDAY.toString());
        box.addValueChangeHandler(m_checkBoxValueChangeHandler);
        m_checkboxes.add(box);
        m_dayPanel.add(box);
        box = new CmsCheckBox(Messages.get().key(Messages.GUI_SERIALDATE_DAY_TUESDAY_0));
        box.setInternalValue(WeekDay.TUESDAY.toString());
        box.addValueChangeHandler(m_checkBoxValueChangeHandler);
        m_checkboxes.add(box);
        m_dayPanel.add(box);
        box = new CmsCheckBox(Messages.get().key(Messages.GUI_SERIALDATE_DAY_WEDNESDAY_0));
        box.setInternalValue(WeekDay.WEDNESDAY.toString());
        box.addValueChangeHandler(m_checkBoxValueChangeHandler);
        m_checkboxes.add(box);
        m_dayPanel.add(box);
        box = new CmsCheckBox(Messages.get().key(Messages.GUI_SERIALDATE_DAY_THURSDAY_0));
        box.setInternalValue(WeekDay.THURSDAY.toString());
        box.addValueChangeHandler(m_checkBoxValueChangeHandler);
        m_checkboxes.add(box);
        m_dayPanel.add(box);
        box = new CmsCheckBox(Messages.get().key(Messages.GUI_SERIALDATE_DAY_FRIDAY_0));
        box.setInternalValue(WeekDay.FRIDAY.toString());
        box.addValueChangeHandler(m_checkBoxValueChangeHandler);
        m_checkboxes.add(box);
        m_dayPanel.add(box);
        box = new CmsCheckBox(Messages.get().key(Messages.GUI_SERIALDATE_DAY_SATURDAY_0));
        box.setInternalValue(WeekDay.SATURDAY.toString());
        box.addValueChangeHandler(m_checkBoxValueChangeHandler);
        m_checkboxes.add(box);
        m_dayPanel.add(box);
        box = new CmsCheckBox(Messages.get().key(Messages.GUI_SERIALDATE_DAY_SUNDAY_0));
        box.setInternalValue(WeekDay.SUNDAY.toString());
        box.addValueChangeHandler(m_checkBoxValueChangeHandler);
        box.addValueChangeHandler(m_checkBoxValueChangeHandler);
        m_checkboxes.add(box);
        m_dayPanel.add(box);
    }
786778
@Override
    public void resolveColumnIndexes()
    {
        // First, assert that our topology is sane and then
        // recursively resolve all child/inline column indexes
        IndexScanPlanNode index_scan =
            (IndexScanPlanNode) getInlinePlanNode(PlanNodeType.INDEXSCAN);
        assert(m_children.size() == 2 && index_scan == null);
        for (AbstractPlanNode child : m_children) {
            child.resolveColumnIndexes();
        }

        final NodeSchema outer_schema = m_children.get(0).getOutputSchema();
        final NodeSchema inner_schema = m_children.get(1).getOutputSchema();
        final int outerSize = outer_schema.size();
        final int innerSize = inner_schema.size();

        // resolve predicates
        resolvePredicate(m_preJoinPredicate, outer_schema, inner_schema);
        resolvePredicate(m_joinPredicate, outer_schema, inner_schema);
        resolvePredicate(m_wherePredicate, outer_schema, inner_schema);

        // Resolve subquery expression indexes
        resolveSubqueryColumnIndexes();

        // Resolve TVE indexes for each schema column.
        for (int i = 0; i < m_outputSchemaPreInlineAgg.size(); ++i) {
            SchemaColumn col = m_outputSchemaPreInlineAgg.getColumn(i);

            // These will all be TVEs.
            assert(col.getExpression() instanceof TupleValueExpression);
            TupleValueExpression tve = (TupleValueExpression)col.getExpression();
            int index;
            if (i < outerSize) {
                index = tve.setColumnIndexUsingSchema(outer_schema);
            }
            else {
                index = tve.setColumnIndexUsingSchema(inner_schema);
                index += outerSize;
            }

            if (index == -1) {
                throw new RuntimeException("Unable to find index for column: " +
                                               col.toString());
            }

            tve.setColumnIndex(index);
            tve.setDifferentiator(index);
        }

        // We want the output columns to be ordered like [outer table columns][inner table columns],
        // and further ordered by TVE index within the left- and righthand sides.
        // generateOutputSchema already places outer columns on the left and inner on the right,
        // so we just need to order the left- and righthand sides by TVE index separately.
        m_outputSchemaPreInlineAgg.sortByTveIndex(0, outer_schema.size());
        m_outputSchemaPreInlineAgg.sortByTveIndex(outer_schema.size(), m_outputSchemaPreInlineAgg.size());
        m_hasSignificantOutputSchema = true;

        resolveRealOutputSchema();
    }