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

Method getFileareaByName

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

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

(String name, Link link)

Source from the content-addressed store, hash-verified

1411 * @return
1412 */
1413 public static Filearea getFileareaByName(String name, Link link) {
1414 Filearea ret;
1415 name = name.toLowerCase();
1416 ret = ORMManager.get(Filearea.class).getFirstAnd("name", "=", name);
1417 if (ret == null) {
1418 if (link == null
1419 || getOptionBooleanDefFalse(link,
1420 LinkOption.BOOLEAN_AUTOCREATE_AREA)) {
1421 ret = new Filearea();
1422 ret.setName(name);
1423 ret.setDescription("Autocreated filearea");
1424 ret.setReadlevel((link != null) ? getOptionLong(link,
1425 LinkOption.LONG_LINK_LEVEL) : 0);
1426 ret.setWritelevel((link != null) ? getOptionLong(link,
1427 LinkOption.LONG_LINK_LEVEL) : 0);
1428 ret.setGroup((link != null) ? getOptionString(link,
1429 LinkOption.SARRAY_LINK_GROUPS).split(" ")[0] : "");
1430 logger.l3("Filearea " + name + " created");
1431 ORMManager.get(Filearea.class).save(ret);
1432 if (link != null) {
1433 FileSubscription sub = new FileSubscription();
1434 sub.setArea(ret);
1435 sub.setLink(link);
1436 ORMManager.get(FileSubscription.class).save(sub);
1437 }
1438 Notifier.INSTANSE.notify(new NewFileareaEvent(name, link));
1439 }
1440 } else {
1441 if (link != null
1442 && ORMManager.get(FileSubscription.class).getFirstAnd(
1443 "filearea_id", "=", ret.getId(), "link_id", "=",
1444 link.getId()) == null) {
1445 ret = null;
1446 }
1447 }
1448 return ret;
1449 }
1450
1451 public static boolean isADupe(Echoarea area, String msgid) {
1452 return ORMManager.get(Echomail.class).getFirstAnd("msgid", "=", msgid,

Callers 2

hatchToAreaMethod · 0.95
tossInboundDirectoryMethod · 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

no test coverage detected