use of org.structr.core.entity.Principal in project structr by structr.
the class AbstractStructrFtpFile method getOwnerName.
@Override
public String getOwnerName() {
try (Tx tx = StructrApp.getInstance(securityContext).tx()) {
final Principal owner = getOwner();
String name = "";
if (owner != null) {
name = owner.getProperty(User.name);
}
tx.success();
return name;
} catch (FrameworkException fex) {
logger.error("Error while getting owner name of " + this, fex);
}
return null;
}
use of org.structr.core.entity.Principal in project structr by structr.
the class AbstractStructrFtpFile method getGroupName.
@Override
public String getGroupName() {
try (Tx tx = StructrApp.getInstance(securityContext).tx()) {
final Principal owner = getOwner();
String name = "";
if (owner != null) {
final List<Principal> parents = owner.getParents();
if (!parents.isEmpty()) {
name = parents.get(0).getProperty(AbstractNode.name);
}
}
tx.success();
return name;
} catch (FrameworkException fex) {
logger.error("Error while getting group name of " + this, fex);
}
return "";
}
use of org.structr.core.entity.Principal in project structr by structr.
the class AbstractStructrFtpFile method getOwner.
private Principal getOwner() {
try (Tx tx = StructrApp.getInstance(securityContext).tx()) {
Principal owner = structrFile.getProperty(File.owner);
tx.success();
return owner;
} catch (FrameworkException fex) {
logger.error("Error while getting owner of " + this, fex);
}
return null;
}
use of org.structr.core.entity.Principal in project structr by structr.
the class FtpFilePageWrapper method getOwnerName.
@Override
public String getOwnerName() {
String name = "";
try (Tx tx = StructrApp.getInstance().tx()) {
Principal owner = getOwner();
if (owner != null) {
name = owner.getProperty(Principal.name);
}
tx.success();
} catch (FrameworkException fex) {
logger.error("Error while getting owner name of " + this, fex);
}
return name;
}
use of org.structr.core.entity.Principal in project structr by structr.
the class FtpFilePageWrapper method getOwner.
private Principal getOwner() {
try (Tx tx = StructrApp.getInstance().tx()) {
Principal owner = page.getProperty(File.owner);
tx.success();
return owner;
} catch (FrameworkException fex) {
logger.error("Error while getting owner of " + this, fex);
}
return null;
}
Aggregations