MCPcopy Create free account
hub / github.com/annmuor/jnode / getAreaByName

Method getAreaByName

jnode-core/src/jnode/ftn/FtnTools.java:1368–1404  ·  view source on GitHub ↗

получение и аутокриейт @param name @param link @return

(String name, Link link)

Source from the content-addressed store, hash-verified

1366 * @return
1367 */
1368 public static Echoarea getAreaByName(String name, Link link) {
1369 Echoarea ret;
1370 name = name.toLowerCase();
1371 ret = ORMManager.get(Echoarea.class).getFirstAnd("name", "=", name);
1372 if (ret == null) {
1373 if (link == null
1374 || getOptionBooleanDefFalse(link,
1375 LinkOption.BOOLEAN_AUTOCREATE_AREA)) {
1376 ret = new Echoarea();
1377 ret.setName(name);
1378 ret.setDescription("Autocreated echoarea");
1379 ret.setReadlevel((link != null) ? getOptionLong(link,
1380 LinkOption.LONG_LINK_LEVEL) : 0);
1381 ret.setWritelevel((link != null) ? getOptionLong(link,
1382 LinkOption.LONG_LINK_LEVEL) : 0);
1383 ret.setGroup((link != null) ? getOptionString(link,
1384 LinkOption.SARRAY_LINK_GROUPS).split(" ")[0] : "");
1385 logger.l3("Echoarea " + name.toUpperCase() + " created");
1386 ORMManager.get(Echoarea.class).save(ret);
1387 if (link != null) {
1388 Subscription sub = new Subscription();
1389 sub.setArea(ret);
1390 sub.setLink(link);
1391 ORMManager.get(Subscription.class).save(sub);
1392 }
1393 Notifier.INSTANSE.notify(new NewEchoareaEvent(name, link));
1394 }
1395 } else {
1396 if (link != null
1397 && ORMManager.get(Subscription.class).getFirstAnd(
1398 "echoarea_id", "=", ret.getId(), "link_id", "=",
1399 link.getId()) == null) {
1400 ret = null;
1401 }
1402 }
1403 return ret;
1404 }
1405
1406 /**
1407 * получение и аутокриейт

Callers 10

postNewsToEchoareaMethod · 0.95
handleMethod · 0.95
handleMethod · 0.95
runMethod · 0.95
writeStringToEchoareaMethod · 0.95
reportMethod · 0.95
writeStatToEchoareaMethod · 0.95
handleMethod · 0.95
tossEchomailMethod · 0.80

Calls 15

getMethod · 0.95
setNameMethod · 0.95
setDescriptionMethod · 0.95
setReadlevelMethod · 0.95
getOptionLongMethod · 0.95
setWritelevelMethod · 0.95
setGroupMethod · 0.95
getOptionStringMethod · 0.95
setAreaMethod · 0.95
setLinkMethod · 0.95
getIdMethod · 0.95

Tested by 1

writeStatToEchoareaMethod · 0.76