use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.
the class CommunicationRepository method createPostal.
@Programmatic
public Communication createPostal(final String subject, final String atPath, final PostalAddress to) {
final DateTime createdAt = clockService.nowAsDateTime();
final Communication communication = Communication.newPostal(atPath, subject, createdAt);
serviceRegistry2.injectServicesInto(communication);
communication.addCorrespondent(CommChannelRoleType.TO, to);
repositoryService.persist(communication);
return communication;
}
use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.
the class DocumentService method createAndAttachDocumentForBlob.
/**
* @param documentName - override the name of the blob (if null, then uses the blob's name)
*/
@Programmatic
public Document createAndAttachDocumentForBlob(final DocumentType documentType, final String documentAtPath, String documentName, final Blob blob, final String paperclipRoleName, final Object paperclipAttachTo) {
final Document document = createForBlob(documentType, documentAtPath, documentName, blob);
paperclipRepository.attach(document, paperclipRoleName, paperclipAttachTo);
return document;
}
use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.
the class DocFragmentService method render.
/**
* Overload of {@link #render(Object, String)}, but allowing the atPath to be specified explicitly rather than inferred from the supplied domain object.
*
* @param domainObject provides the state for the interpolation into the fragment's {@link DocFragment#getTemplateText() template text}
* @param name corresponds to the {@link DocFragment#getName() name} of the {@link DocFragment} to use to render.
* @param atPath corrsponds to the {@link ApplicationTenancyService#atPathFor(Object) atPath} of the {@link DocFragment} to use to render
*
* @throws IOException
* @throws TemplateException
* @throws RenderException - if could not locate any {@link DocFragment}.
*/
@Programmatic
public String render(final Object domainObject, final String name, final String atPath) throws IOException, TemplateException, RenderException {
final String objectType = objectTypeFor(domainObject);
final DocFragment fragment = repo.findByObjectTypeAndNameAndApplicableToAtPath(objectType, name, atPath);
if (fragment != null)
return fragment.render(domainObject);
else
throw new RenderException("No fragment found for objectType: %s, name: %s, atPath: %s", objectType, name, atPath);
}
use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.
the class CommChannelRole method getId.
// endregion
// region > id (programmatic, for comparison)
@Programmatic
public String getId() {
Object objectId = JDOHelper.getObjectId(this);
if (objectId == null) {
return "";
}
String objectIdStr = objectId.toString();
final String id = objectIdStr.split("\\[OID\\]")[0];
return id;
}
use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.
the class BudgetItem method createCopyFor.
@Programmatic
public BudgetItem createCopyFor(final Budget budget) {
// only copies of budgeted values are made
BudgetItem newBudgetItemCopy = budget.newBudgetItem(getBudgetedValue(), getCharge());
for (PartitionItem partitionItem : partitionItemRepository.findByBudgetItem(this)) {
// only copies of budgeted items are made
if (partitionItem.getPartitioning().getType() == BudgetCalculationType.BUDGETED) {
String keyTableName = partitionItem.getKeyTable().getName();
KeyTable correspondingTableOnbudget = keyTableRepository.findByBudgetAndName(budget, keyTableName);
newBudgetItemCopy.createPartitionItemForBudgeting(partitionItem.getCharge(), correspondingTableOnbudget, partitionItem.getPercentage());
}
}
return newBudgetItemCopy;
}
Aggregations