List of usage examples for javax.ejb TransactionAttributeType SUPPORTS
TransactionAttributeType SUPPORTS
To view the source code for javax.ejb TransactionAttributeType SUPPORTS.
Click Source Link
REQUIRED
case. From source file:Employee.java
@TransactionAttribute(TransactionAttributeType.SUPPORTS) public void doAction() { System.out.println("Processing..."); }
From source file:gov.nih.nci.caarray.application.translation.geosoft.GeoSoftExporterBean.java
/** * {@inheritDoc}//from ww w . j av a2s . c o m */ @Override @TransactionAttribute(TransactionAttributeType.SUPPORTS) public List<String> validateForExport(Experiment experiment) { final List<String> errors = new ArrayList<String>(); final boolean stop = checkArrayDesigns(errors, experiment); if (stop) { return errors; } final Set<String> protocolErrors = new HashSet<String>(); for (final Hybridization hyb : experiment.getHybridizations()) { final Set<Source> sources = new HashSet<Source>(); final Set<Sample> samples = new HashSet<Sample>(); final Set<Extract> extracts = new HashSet<Extract>(); final Set<LabeledExtract> labeledExtracts = new HashSet<LabeledExtract>(); GeoSoftFileWriterUtil.collectBioMaterials(hyb, sources, samples, extracts, labeledExtracts); checkRawData(errors, hyb); checkDerivedDataFileType(errors, hyb); checkBioProtocol(protocolErrors, samples, "nucleic_acid_extraction"); checkBioProtocol(protocolErrors, extracts, "labeling"); checkBioProtocol(protocolErrors, labeledExtracts, "hybridization"); checkProtocol(protocolErrors, hyb.getProtocolApplications(), "scan", "image_acquisition"); checkDataProcessingProtocol(protocolErrors, hyb.getRawDataCollection()); checkCharOrFactorValue(errors, hyb, labeledExtracts, extracts, samples, sources); checkLabeledExtract(errors, labeledExtracts, extracts); } errors.addAll(protocolErrors); return errors; }
From source file:com.flexive.ejb.beans.UserGroupEngineBean.java
/** * {@inheritDoc}/*w w w . j av a2 s. c o m*/ */ @Override @TransactionAttribute(TransactionAttributeType.SUPPORTS) public UserGroup load(long groupId) throws FxApplicationException { Connection con = null; Statement stmt = null; String sql = "SELECT MANDATOR,NAME,COLOR,AUTOMANDATOR,ISSYSTEM FROM " + TBL_USERGROUPS + " WHERE ID=" + groupId; try { // Obtain a database connection con = Database.getDbConnection(); // Create the new workflow instance stmt = con.createStatement(); // Build statement ResultSet rs = stmt.executeQuery(sql); // Does the group exist at all? if (rs == null || !rs.next()) { FxNotFoundException nfe = new FxNotFoundException("ex.account.group.notFound.id", groupId); if (LOG.isInfoEnabled()) LOG.info(nfe); throw nfe; } long autoMandator = rs.getLong(4); if (rs.wasNull()) autoMandator = -1; return new UserGroup(groupId, rs.getLong(1), autoMandator, rs.getBoolean(5), rs.getString(2), rs.getString(3)); } catch (SQLException exc) { FxLoadException de = new FxLoadException(exc, "ex.usergroup.sqlError", exc.getMessage(), sql); LOG.error(de); throw de; } finally { Database.closeObjects(UserGroupEngineBean.class, con, stmt); } }
From source file:gov.nih.nci.caarray.application.permissions.PermissionsManagementServiceBean.java
/** * {@inheritDoc}//ww w . j av a2s. co m */ @Override @TransactionAttribute(TransactionAttributeType.SUPPORTS) public List<CollaboratorGroup> getCollaboratorGroups() { LogUtil.logSubsystemEntry(LOG); final List<CollaboratorGroup> result = this.collaboratorGroupDao.getAll(); LogUtil.logSubsystemExit(LOG); return result; }
From source file:com.flexive.ejb.beans.LanguageBean.java
/** * {@inheritDoc}//from w w w . jav a 2 s. com */ @Override @TransactionAttribute(TransactionAttributeType.SUPPORTS) public FxLanguage load(long languageId) throws FxApplicationException { try { FxLanguage lang = (FxLanguage) CacheAdmin.getInstance().get(CacheAdmin.LANGUAGES_ID, languageId); if (lang == null) { loadAll(true, true); lang = (FxLanguage) CacheAdmin.getInstance().get(CacheAdmin.LANGUAGES_ID, languageId); } if (lang == null) { //check unavailable for (FxLanguage l : loadAll(false, false)) { if (l.getId() == languageId) return l; } throw new FxInvalidLanguageException("ex.language.invalid", languageId); } return lang; } catch (FxCacheException e) { throw new FxLoadException(LOG, e); } }
From source file:com.flexive.ejb.beans.HistoryTrackerEngineBean.java
/** * {@inheritDoc}/*from w w w . ja va2 s . c o m*/ */ @Override @TransactionAttribute(TransactionAttributeType.SUPPORTS) public void track(String key, Object... args) { track(null, null, null, key, args); }
From source file:gov.nih.nci.caarray.application.permissions.PermissionsManagementServiceBean.java
/** * {@inheritDoc}/*from w w w.ja v a 2 s . co m*/ */ @Override @TransactionAttribute(TransactionAttributeType.SUPPORTS) public List<CollaboratorGroup> getCollaboratorGroupsForCurrentUser() { LogUtil.logSubsystemEntry(LOG); final List<CollaboratorGroup> result = this.collaboratorGroupDao.getAllForCurrentUser(); LogUtil.logSubsystemExit(LOG); return result; }
From source file:com.flexive.ejb.beans.HistoryTrackerEngineBean.java
/** * {@inheritDoc}// w ww . java 2 s . c o m */ @Override @TransactionAttribute(TransactionAttributeType.SUPPORTS) public void trackData(String data, String key, Object... args) { track(null, null, data, key, args); }
From source file:com.flexive.ejb.beans.HistoryTrackerEngineBean.java
/** * {@inheritDoc}//from w w w . j ava 2s .com */ @Override @TransactionAttribute(TransactionAttributeType.SUPPORTS) public void track(FxType type, String key, Object... args) { track(type, null, null, key, args); }
From source file:com.flexive.ejb.beans.ContentEngineBean.java
/** * {@inheritDoc}/*from ww w . j a va 2 s . c o m*/ */ @Override @TransactionAttribute(TransactionAttributeType.SUPPORTS) public FxContent initialize(long typeId, long mandatorId, long prefACL, long prefStep, long prefLang) throws FxApplicationException { UserTicket ticket = FxContext.getUserTicket(); FxEnvironment environment; environment = CacheAdmin.getEnvironment(); FxPermissionUtils.checkMandatorExistance(mandatorId); FxPermissionUtils.checkTypeAvailable(typeId, false); FxType type = environment.getType(typeId); //security check start if (type.isUseTypePermissions() && !ticket.mayCreateACL(type.getACL().getId(), ticket.getUserId())) throw new FxNoAccessException("ex.acl.noAccess.create", type.getACL().getName()); //security check end long acl = prefACL; try { environment.getACL(acl); } catch (Exception e) { acl = type.hasDefaultInstanceACL() ? type.getDefaultInstanceACL().getId() : ACLCategory.INSTANCE.getDefaultId(); if (!ticket.isGlobalSupervisor() && type.isUseInstancePermissions() && !(ticket.mayCreateACL(acl, ticket.getUserId()) && ticket.mayReadACL(acl, ticket.getUserId()) && ticket.mayEditACL(acl, ticket.getUserId()))) { //get best fit if possible Long[] acls = ticket.getACLsId(ticket.getUserId(), ACLCategory.INSTANCE, ACLPermission.CREATE, ACLPermission.EDIT, ACLPermission.READ); if (acls.length > 0) acl = acls[0]; else throw new FxNoAccessException("ex.content.noSuitableACL", type.getName()); } } long step = -2; for (Step check : type.getWorkflow().getSteps()) { if (ticket.mayCreateACL(check.getAclId(), ticket.getUserId()) && ticket.mayReadACL(check.getAclId(), ticket.getUserId()) && ticket.mayEditACL(check.getAclId(), ticket.getUserId())) { if (check.getId() == prefStep) { step = check.getId(); break; } else if (step == -2) step = check.getId(); //first match } } if (step < 0) throw new FxInvalidParameterException("STEP", "ex.content.noSuitableStep", type.getName(), type.getWorkflow().getName()); long lang = prefLang; try { environment.getLanguage(lang); } catch (FxRuntimeException e) { lang = ticket.getLanguage().getId(); } FxPK sourcePK = null, destinationPK = null; int sourcePos = 0, destinationPos = 0; if (type.isRelation()) { sourcePK = FxPK.createNewPK(); destinationPK = FxPK.createNewPK(); sourcePos = destinationPos = 0; } FxContent content = new FxContent(FxPK.createNewPK(), FxLock.noLockPK(), type.getId(), type.isRelation(), mandatorId, acl, step, 1, environment.getStep(step).isLiveStep() ? 1 : 0, true, lang, sourcePK, destinationPK, sourcePos, destinationPos, LifeCycleInfoImpl.createNew(ticket), type.createEmptyData(type.buildXPathPrefix(FxPK.createNewPK())), BinaryDescriptor.SYS_UNKNOWN, 1) .initSystemProperties(); //scripting after start FxScriptBinding binding = null; long[] scripts = type.getScriptMapping(FxScriptEvent.AfterContentInitialize); if (scripts != null) for (long script : scripts) { if (binding == null) binding = new FxScriptBinding(); binding.setVariable("content", content); scripting.runScript(script, binding); } //scripting after end return content; }