/** * <p>fixName.</p> * * @param pack a {@link de.mhus.lib.form.DataSource} object. * @param name a {@link java.lang.String} object. * @return a {@link java.lang.String} object. */ protected String fixName(DataSource pack, String name) { if (pack != defaultSource) name = MString.afterIndex(name, '.'); return name; }
public EnvironmentPart(String part) { name = MString.afterIndex(part,'.'); int p = name.indexOf(':'); if (p >= 0) { def = name.substring(p+1); name = name.substring(0, p); } }
public SystemPart(String part) { name = MString.afterIndex(part,'.'); int p = name.indexOf(':'); if (p >= 0) { def = name.substring(p+1); name = name.substring(0, p); } }
/** * Returns the name of the current system. COMPUTERNAME or HOSTNAME. * * @return the hosts name */ public static String getHostname() { String out = System.getenv().get("COMPUTERNAME"); if (out == null) out = System.getenv().get("HOSTNAME"); if (out == null) { RuntimeMXBean rt = ManagementFactory.getRuntimeMXBean(); String name = rt.getName(); out = MString.afterIndex(name, '@'); } return out; }
public boolean isProcessActive(String deployedName) { String v = MString.afterIndex(deployedName, ':'); String n = MString.beforeIndex(deployedName, ':'); return v.equals(String.valueOf(getParameters().get("process:" + n + ":active"))); }
public FilterRequest(String text) { LinkedList<String> lText = new LinkedList<String>(); facets = new HashMap<String, String>(); for (String part : text.split(" ")) { part = part.trim(); if (MString.isSet(part)) { if (part.indexOf(':') > 0) { facets.put(MString.beforeIndex(part, ':'), MString.afterIndex(part, ':')); } else { lText.add(part); } } } this.text = lText.toArray(new String[lText.size()]); }
public void loadSettings() { try { String[] res = getRawSettings(); String[] parts = res[0].split("\n"); int cnt = 0; for (String p : parts) { p = p.trim(); if (cnt == 2) height = MCast.toint(MString.afterIndex(p, ' ').trim(),DEFAULT_HEIGHT); else if (cnt == 3) width = MCast.toint(MString.afterIndex(p, ' ').trim(), DEFAULT_WIDTH); cnt++; } } catch (IOException e) { } }
/** * Active means this is the default version for a new process instance * @param deployedName */ public void activateProcessVersion(String deployedName) { String v = MString.afterIndex(deployedName, ':'); String n = MString.beforeIndex(deployedName, ':'); getParameters().put("process:" + n + ":active", v); } public String getActiveProcessVersion(String processName) {
/** * Enabled means the version can be instantiated. * @param name * @return true if it's allowed */ public boolean isProcessEnabled(String name) { String v = MString.afterIndex(name, ':'); String n = MString.beforeIndex(name, ':'); String[] versions = String.valueOf(getParameters().getOrDefault("process:" + n + ":versions","")).split(","); return MCollection.contains(versions, v); }
void doUpdate(Element xml) { id = xml.getAttribute("id"); name = xml.getAttribute("name"); incoming.clear(); for (Element eIn : MXml.getLocalElementIterator(xml, "bpmn2:incoming")) { String ref = MXml.getValue(eIn, false); if (ref.startsWith(XElement.SEQUENCE_FLOW)) { ref = ref.substring(XElement.SEQUENCE_FLOW.length()); ref = MString.beforeIndex(ref, '_'); } incoming.add(ref); } outgoing.clear(); for (Element eOut : MXml.getLocalElementIterator(xml, "bpmn2:outgoing")) { String ref = MXml.getValue(eOut, false); if (ref.startsWith(XElement.SEQUENCE_FLOW)) { ref = ref.substring(XElement.SEQUENCE_FLOW.length()); ref = MString.afterIndex(ref, '_'); } outgoing.add(ref); } }
String tagx = MString.afterIndex(tag, MString.WHITESPACE);
public void enableProcessVersion(String deployedName) { // add version String v = MString.afterIndex(deployedName, ':'); String n = MString.beforeIndex(deployedName, ':'); String[] versions = String.valueOf(getParameters().getOrDefault("process:" + n + ":versions","")).split(","); if (!MCollection.contains(versions, v)) { versions = MCollection.append(versions, v); getParameters().put("process:" + n + ":versions", MString.join(versions,',')); } }
private SchedulerJob toIntervalJob(SchedulerService service, String i) { if (i.indexOf(',') > 0) { long s = 0; String sStr = MString.beforeIndex(i,','); if (sStr.indexOf('-') > 0 || sStr.indexOf('.') > 0 || sStr.indexOf('/') > 0 ) // it's a date string s = MDate.toDate(sStr, new Date()).getTime(); else // it should be a time interval s = System.currentTimeMillis() + MTimeInterval.toTime(sStr, -1); // delay is in every case a time interval long l = MTimeInterval.toTime(MString.afterIndex(i,','), -1); if (s > 0 && l > 0) return new IntervalWithStartTimeJob(s,l, service); } else { long l = MTimeInterval.toTime(i, -1); if (l > 0) return new IntervalJob(l, service); } return null; }
public static SchedulerJob toIntervalJob(String interval, ITimerTask task) { if (interval.indexOf(',') > 0) { long s = 0; String sStr = MString.beforeIndex(interval,','); if (sStr.indexOf('-') > 0 || sStr.indexOf('.') > 0 || sStr.indexOf('/') > 0 ) // it's a date string s = MDate.toDate(sStr, new Date()).getTime(); else // it should be a time interval s = System.currentTimeMillis() + MPeriod.toTime(sStr, -1); // delay is in every case a time interval long l = MPeriod.toTime(MString.afterIndex(interval,','), -1); if (s > 0 && l > 0) return new IntervalWithStartTimeJob(s,l, task); } else { long l = MPeriod.toTime(interval, -1); if (l > 0) return new IntervalJob(l, task); } return null; }
@SuppressWarnings("rawtypes") private ResourceNode getResource(FileResource parent, String target) { if (parent == null || target == null) return null; if (target.length() == 0) return parent; String next = null; if (MString.isIndex(target, '/')) { next = MString.beforeIndex(target, '/'); target = MString.afterIndex(target, '/'); } else { next = target; target = ""; } if (next.length() == 0) return getResource(parent,target); ResourceNode n = parent.getNode(next); if (n == null) return null; return getResource((FileResource) n, target); }
public ParameterDefinition(String line) { if (MString.isIndex(line, ',')) { name = MString.beforeIndex(line, ','); line = MString.afterIndex(line, ','); properties = MProperties.explodeToMProperties(line.split(","), ':', (char)0); } else { name = line; if (name.startsWith("*")) { mandatory = true; name = name.substring(1); } type = "string"; return; } if (name.startsWith("*")) { mandatory = true; name = name.substring(1); } type = properties.getString("type", ""); mandatory = properties.getBoolean("mandatory", mandatory); def = properties.getString("default", null); mapping = properties.getString("mapping",null); format = properties.getString("format", null); }
public static PemPriv cipherPrivFromString(String str) throws ParseException, NotSupportedException, IOException { if (MValidator.isUUID(str)) { MVault vault = MVaultUtil.loadDefault(); VaultEntry entry = vault.getEntry(UUID.fromString(str)); PemPriv key = MVaultUtil.adaptTo(entry, PemPriv.class); return key; } if (isPemBlock(str)) { PemBlockModel block = new PemBlockModel().parse(str); // return new PemKey(PemBlock.BLOCK_CIPHER).set(PemBlock.METHOD, block.getString(PemBlock.METHOD,"")).setBlock(block.getEncodedBlock()); return new PemKey(block); } String name = MString.beforeIndex(str, ':').toUpperCase().trim(); String key = MString.afterIndex(str, ':').trim(); return new PemKey(PemBlock.BLOCK_CIPHER).set(PemBlock.METHOD, name).setBlock(key); }
public static PemPriv signPrivFromString(String str) throws Exception, NotSupportedException, IOException { if (MValidator.isUUID(str)) { MVault vault = MVaultUtil.loadDefault(); VaultEntry entry = vault.getEntry(UUID.fromString(str)); PemPriv key = MVaultUtil.adaptTo(entry, PemPriv.class); return key; } if (isPemBlock(str)) { PemBlockModel block = new PemBlockModel().parse(str); // return new PemKey(PemBlock.BLOCK_CIPHER).set(PemBlock.METHOD, block.getString(PemBlock.METHOD,"")).setBlock(block.getEncodedBlock()); return new PemKey(block); } String name = MString.beforeIndex(str, ':'); String key = MString.afterIndex(str, ':'); return new PemKey(PemBlock.BLOCK_SIGN).set(PemBlock.METHOD, name).setBlock(key); }
public static PemPub signPubFromString(String str) throws NotSupportedException, IOException, ParseException { if (MValidator.isUUID(str)) { MVault vault = MVaultUtil.loadDefault(); VaultEntry entry = vault.getEntry(UUID.fromString(str)); PemPub key = MVaultUtil.adaptTo(entry, PemPub.class); return key; } if (isPemBlock(str)) { PemBlockModel block = new PemBlockModel().parse(str); // return new PemKey(PemBlock.BLOCK_CIPHER).set(PemBlock.METHOD, block.getString(PemBlock.METHOD,"")).setBlock(block.getEncodedBlock()); return new PemKey(block); } String name = MString.beforeIndex(str, ':'); String key = MString.afterIndex(str, ':'); return new PemKey(PemBlock.BLOCK_SIGN).set(PemBlock.METHOD, name).setBlock(key); }
public static PemPub cipherPubFromString(String str) throws ParseException, NotSupportedException, IOException { if (MValidator.isUUID(str)) { MVault vault = MVaultUtil.loadDefault(); VaultEntry entry = vault.getEntry(UUID.fromString(str)); PemPub key = MVaultUtil.adaptTo(entry, PemPub.class); return key; } if (isPemBlock(str)) { PemBlockModel block = new PemBlockModel().parse(str); // return new PemKey(PemBlock.BLOCK_CIPHER).set(PemBlock.METHOD, block.getString(PemBlock.METHOD,"")).setBlock(block.getEncodedBlock()); return new PemKey(block); } String name = MString.beforeIndex(str, ':'); String key = MString.afterIndex(str, ':'); return new PemKey(PemBlock.BLOCK_CIPHER).set(PemBlock.METHOD, name).setBlock(key); }